Bläddra i källkod

✨ channel 之间的关系设置:继承自、捆绑逐词、降级版本、术语路径

- 新表 channel_links(channel_uid → target_uid,kind 区分四种关系,position 排序)
- GET / PATCH /v3/channels/{channel}/links(单例;服务端只记录,降级拼接等以后由客户端做)
  - 读:能读 channel 的人;看不见 / 已删的目标不出现
  - 写:channel 的 update 能力;AI 模型 403(不支持 agent 写入)
  - 校验:不能指向自己、目标须看得见;逐词须 wbw;降级须与本 channel 同类型、最多 3 个;
    术语路径只对 translation channel 有效、目标只能是 translation、最多 10 个
  - 不对外暴露 channel_links 的自增 id
- dashboard-v6:channel 设置页加「关联」页签,候选按类型过滤
- 测试:Pest ChannelLinkV3Test、api-test 15_channel_links、dashboard-test channel-links.spec

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 11 timmar sedan
förälder
incheckning
a36f8a28f5
28 ändrade filer med 5195 tillägg och 204 borttagningar
  1. 82 0
      api-test/cases/15_channel_links.php
  2. 15 0
      api-test/client/.openapi-generator/FILES
  3. 849 204
      api-test/client/lib/Api/ChannelsApi.php
  4. 409 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200Response.php
  5. 593 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseData.php
  6. 545 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom.php
  7. 545 0
      api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner.php
  8. 525 0
      api-test/client/lib/Model/PatchApiV3ChannelsChannelLinksRequest.php
  9. 68 0
      api-v13/app/Http/Controllers/V3/ChannelLinkController.php
  10. 36 0
      api-v13/app/Http/Requests/V3/UpdateChannelLinksRequest.php
  11. 49 0
      api-v13/app/Http/Resources/V3/ChannelLinksResource.php
  12. 45 0
      api-v13/app/Models/ChannelLink.php
  13. 180 0
      api-v13/app/Services/V3/ChannelLinkService.php
  14. 31 0
      api-v13/database/migrations/2026_11_17_042509_create_channel_links_table.php
  15. 6 0
      api-v13/resources/lang/en/messages.php
  16. 6 0
      api-v13/resources/lang/zh-Hans/messages.php
  17. 10 0
      api-v13/routes/v3/channel.php
  18. 237 0
      api-v13/tests/Feature/ChannelLinkV3Test.php
  19. 138 0
      dashboard-test/src/tests/channel-links.spec.ts
  20. 29 0
      dashboard-v6/src/api/channel.ts
  21. 178 0
      dashboard-v6/src/api/schema.d.ts
  22. 392 0
      dashboard-v6/src/components/channel/ChannelLinks.tsx
  23. 14 0
      dashboard-v6/src/locales/en-US.ts
  24. 14 0
      dashboard-v6/src/locales/zh-Hans.ts
  25. 14 0
      dashboard-v6/src/locales/zh-Hant.ts
  26. 6 0
      dashboard-v6/src/pages/workspace/channel/setting.tsx
  27. 2 0
      openapi/public/assets/protocol/main.yaml
  28. 177 0
      openapi/public/assets/protocol/resources/auto/v3-channels-channel-links.yaml

+ 82 - 0
api-test/cases/15_channel_links.php

@@ -0,0 +1,82 @@
+<?php
+
+use \WikipaliApi\Api\ChannelsApi;
+use \WikipaliApi\Api\StudiosApi;
+use \WikipaliApi\Model\PatchApiV3ChannelsChannelLinksRequest;
+use \WikipaliApi\Model\PostApiV3StudiosStudioChannelsRequest;
+
+/*
+ * channel 之间的关系设置:GET / PATCH /v3/channels/{channel}/links
+ *
+ * 写操作用两个临时 channel(e2e-tmp-links-*),测完清空关系并删掉(软删)。
+ * 权限矩阵(团队角色、AI 模型)、目标可见性、N+1 由 api-v13 的 ChannelLinkV3Test 覆盖。
+ */
+
+/** 在本人名下建一个临时 channel,返回 uid */
+function links_tmp_channel(string $token, string $suffix): string
+{
+    $me = raw('GET', '/v3/me', null, null, $token);
+    assert_status(200, $me, 'me');
+    $body = new PostApiV3StudiosStudioChannelsRequest();
+    $body->setName("e2e-tmp-links-{$suffix}-".time());
+    $body->setType('translation');
+    $body->setLang('en');
+    $res = request(fn () => api(StudiosApi::class, $token)->postApiV3StudiosStudioChannelsWithHttpInfo($me['body']['data']['id'], $body));
+    assert_status(201, $res, "建临时 channel {$suffix}");
+
+    return $res['body']['data']['id'];
+}
+
+test('GET /v3/channels/{channel}/links → 200,四种关系都在', function () {
+    $res = request(fn () => api(ChannelsApi::class)->getApiV3ChannelsChannelLinksWithHttpInfo(fixtures()['channel']));
+    assert_status(200, $res, 'links');
+    foreach (['channel_id', 'derived_from', 'wbw', 'fallback', 'term_source', 'can_update'] as $key) {
+        assert_has_key($key, $res['body']['data'], 'links');
+    }
+    assert_eq(false, $res['body']['data']['can_update'], '匿名不能改');
+});
+
+test('GET /v3/channels/{不存在}/links → 404', function () {
+    assert_status(404, raw('GET', '/v3/channels/11111111-1111-4111-8111-111111111111/links'), '不存在的 channel');
+});
+
+test('PATCH /v3/channels/{channel}/links(无 token)→ 401', function () {
+    $res = raw('PATCH', '/v3/channels/'.fixtures()['channel'].'/links', null, ['fallback' => []]);
+    assert_status(401, $res, 'links 无 token');
+    assert_problem($res, 'links 无 token');
+});
+
+test('channel links 一轮:设置 200 → 读回 → 指向自己 422 → 清空 200', function () {
+    $token = required_token();
+    $a = links_tmp_channel($token, 'a');
+    $b = links_tmp_channel($token, 'b');
+
+    $body = new PatchApiV3ChannelsChannelLinksRequest();
+    $body->setDerivedFrom($b);
+    $body->setFallback([$b]);
+    $body->setTermSource([$b]);
+    $set = request(fn () => api(ChannelsApi::class, $token)->patchApiV3ChannelsChannelLinksWithHttpInfo($a, $body));
+    assert_status(200, $set, '设置关系');
+    assert_eq($b, $set['body']['data']['derived_from']['id'] ?? null, 'derived_from');
+    assert_eq(true, $set['body']['data']['can_update'], '拥有者能改');
+
+    $read = request(fn () => api(ChannelsApi::class, $token)->getApiV3ChannelsChannelLinksWithHttpInfo($a));
+    assert_status(200, $read, '读回');
+    assert_eq([$b], array_column($read['body']['data']['fallback'], 'id'), 'fallback 读回');
+
+    $self = raw('PATCH', "/v3/channels/{$a}/links", null, ['derived_from' => $a], $token);
+    assert_status(422, $self, '指向自己');
+    assert_field_error('derived_from', $self, '指向自己');
+
+    $bad = raw('PATCH', "/v3/channels/{$a}/links", null, ['wbw' => $b], $token);
+    assert_status(422, $bad, '逐词目标不是 wbw');
+    assert_field_error('wbw', $bad, '逐词目标不是 wbw');
+
+    $clear = raw('PATCH', "/v3/channels/{$a}/links", null, ['derived_from' => null, 'fallback' => [], 'term_source' => []], $token);
+    assert_status(200, $clear, '清空');
+    assert_eq(null, $clear['body']['data']['derived_from'], '清空后 derived_from');
+
+    foreach ([$a, $b] as $uid) {
+        assert_status(200, request(fn () => api(ChannelsApi::class, $token)->deleteApiV3ChannelsChannelWithHttpInfo($uid)), '删临时 channel');
+    }
+});

+ 15 - 0
api-test/client/.openapi-generator/FILES

@@ -74,6 +74,10 @@ docs/Model/GetApiV3Channels200ResponseDataInner.md
 docs/Model/GetApiV3Channels200ResponseDataInnerAbilities.md
 docs/Model/GetApiV3Channels200ResponseDataInnerAbilities.md
 docs/Model/GetApiV3Channels200ResponseDataInnerOwner.md
 docs/Model/GetApiV3Channels200ResponseDataInnerOwner.md
 docs/Model/GetApiV3ChannelsChannel200Response.md
 docs/Model/GetApiV3ChannelsChannel200Response.md
+docs/Model/GetApiV3ChannelsChannelLinks200Response.md
+docs/Model/GetApiV3ChannelsChannelLinks200ResponseData.md
+docs/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom.md
+docs/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner.md
 docs/Model/GetApiV3CreditPolicy200Response.md
 docs/Model/GetApiV3CreditPolicy200Response.md
 docs/Model/GetApiV3CreditPolicy200ResponseData.md
 docs/Model/GetApiV3CreditPolicy200ResponseData.md
 docs/Model/GetApiV3CreditPolicy200ResponseDataDailyFree.md
 docs/Model/GetApiV3CreditPolicy200ResponseDataDailyFree.md
@@ -135,6 +139,7 @@ docs/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseDataInner.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.md
 docs/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.md
 docs/Model/PaginationMeta.md
 docs/Model/PaginationMeta.md
+docs/Model/PatchApiV3ChannelsChannelLinksRequest.md
 docs/Model/PatchApiV3ChannelsChannelRequest.md
 docs/Model/PatchApiV3ChannelsChannelRequest.md
 docs/Model/PatchApiV3DiscussionsDiscussionRequest.md
 docs/Model/PatchApiV3DiscussionsDiscussionRequest.md
 docs/Model/PatchApiV3GroupsGroupMembersMemberRequest.md
 docs/Model/PatchApiV3GroupsGroupMembersMemberRequest.md
@@ -264,6 +269,10 @@ lib/Model/GetApiV3Channels200ResponseDataInner.php
 lib/Model/GetApiV3Channels200ResponseDataInnerAbilities.php
 lib/Model/GetApiV3Channels200ResponseDataInnerAbilities.php
 lib/Model/GetApiV3Channels200ResponseDataInnerOwner.php
 lib/Model/GetApiV3Channels200ResponseDataInnerOwner.php
 lib/Model/GetApiV3ChannelsChannel200Response.php
 lib/Model/GetApiV3ChannelsChannel200Response.php
+lib/Model/GetApiV3ChannelsChannelLinks200Response.php
+lib/Model/GetApiV3ChannelsChannelLinks200ResponseData.php
+lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom.php
+lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner.php
 lib/Model/GetApiV3CreditPolicy200Response.php
 lib/Model/GetApiV3CreditPolicy200Response.php
 lib/Model/GetApiV3CreditPolicy200ResponseData.php
 lib/Model/GetApiV3CreditPolicy200ResponseData.php
 lib/Model/GetApiV3CreditPolicy200ResponseDataDailyFree.php
 lib/Model/GetApiV3CreditPolicy200ResponseDataDailyFree.php
@@ -326,6 +335,7 @@ lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200Response.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.php
 lib/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInner.php
 lib/Model/ModelInterface.php
 lib/Model/ModelInterface.php
 lib/Model/PaginationMeta.php
 lib/Model/PaginationMeta.php
+lib/Model/PatchApiV3ChannelsChannelLinksRequest.php
 lib/Model/PatchApiV3ChannelsChannelRequest.php
 lib/Model/PatchApiV3ChannelsChannelRequest.php
 lib/Model/PatchApiV3DiscussionsDiscussionRequest.php
 lib/Model/PatchApiV3DiscussionsDiscussionRequest.php
 lib/Model/PatchApiV3GroupsGroupMembersMemberRequest.php
 lib/Model/PatchApiV3GroupsGroupMembersMemberRequest.php
@@ -452,6 +462,10 @@ test/Model/GetApiV3Channels200ResponseDataInnerOwnerTest.php
 test/Model/GetApiV3Channels200ResponseDataInnerTest.php
 test/Model/GetApiV3Channels200ResponseDataInnerTest.php
 test/Model/GetApiV3Channels200ResponseTest.php
 test/Model/GetApiV3Channels200ResponseTest.php
 test/Model/GetApiV3ChannelsChannel200ResponseTest.php
 test/Model/GetApiV3ChannelsChannel200ResponseTest.php
+test/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFromTest.php
+test/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInnerTest.php
+test/Model/GetApiV3ChannelsChannelLinks200ResponseDataTest.php
+test/Model/GetApiV3ChannelsChannelLinks200ResponseTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataDailyFreeTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataDailyFreeTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataEarnReadingTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataEarnReadingTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataEarnTest.php
 test/Model/GetApiV3CreditPolicy200ResponseDataEarnTest.php
@@ -513,6 +527,7 @@ test/Model/GetApiV3TipitakaRelatedParagraphsAggregate200ResponseTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInnerTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseDataInnerTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseTest.php
 test/Model/GetApiV3TipitakaRelatedParagraphsAggregateBookName200ResponseTest.php
 test/Model/PaginationMetaTest.php
 test/Model/PaginationMetaTest.php
+test/Model/PatchApiV3ChannelsChannelLinksRequestTest.php
 test/Model/PatchApiV3ChannelsChannelRequestTest.php
 test/Model/PatchApiV3ChannelsChannelRequestTest.php
 test/Model/PatchApiV3DiscussionsDiscussionRequestTest.php
 test/Model/PatchApiV3DiscussionsDiscussionRequestTest.php
 test/Model/PatchApiV3GroupsGroupMembersMemberRequestTest.php
 test/Model/PatchApiV3GroupsGroupMembersMemberRequestTest.php

Filskillnaden har hållts tillbaka eftersom den är för stor
+ 849 - 204
api-test/client/lib/Api/ChannelsApi.php


+ 409 - 0
api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200Response.php

@@ -0,0 +1,409 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelLinks200Response
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3ChannelsChannelLinks200Response Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelLinks200Response implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_links_200_response';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'data' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseData'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'data' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'data' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'data' => 'data'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'data' => 'setData'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'data' => 'getData'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('data', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets data
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseData|null
+     */
+    public function getData()
+    {
+        return $this->container['data'];
+    }
+
+    /**
+     * Sets data
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseData|null $data data
+     *
+     * @return self
+     */
+    public function setData($data)
+    {
+        if (is_null($data)) {
+            throw new \InvalidArgumentException('non-nullable data cannot be null');
+        }
+        $this->container['data'] = $data;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 593 - 0
api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseData.php

@@ -0,0 +1,593 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseData
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseData Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelLinks200ResponseData implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_links_200_response_data';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'channel_id' => 'string',
+        'derived_from' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom',
+        'wbw' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom',
+        'fallback' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]',
+        'term_source' => '\WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]',
+        'can_update' => 'bool'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'channel_id' => null,
+        'derived_from' => null,
+        'wbw' => null,
+        'fallback' => null,
+        'term_source' => null,
+        'can_update' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'channel_id' => false,
+        'derived_from' => true,
+        'wbw' => true,
+        'fallback' => false,
+        'term_source' => false,
+        'can_update' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'channel_id' => 'channel_id',
+        'derived_from' => 'derived_from',
+        'wbw' => 'wbw',
+        'fallback' => 'fallback',
+        'term_source' => 'term_source',
+        'can_update' => 'can_update'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'channel_id' => 'setChannelId',
+        'derived_from' => 'setDerivedFrom',
+        'wbw' => 'setWbw',
+        'fallback' => 'setFallback',
+        'term_source' => 'setTermSource',
+        'can_update' => 'setCanUpdate'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'channel_id' => 'getChannelId',
+        'derived_from' => 'getDerivedFrom',
+        'wbw' => 'getWbw',
+        'fallback' => 'getFallback',
+        'term_source' => 'getTermSource',
+        'can_update' => 'getCanUpdate'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('channel_id', $data ?? [], null);
+        $this->setIfExists('derived_from', $data ?? [], null);
+        $this->setIfExists('wbw', $data ?? [], null);
+        $this->setIfExists('fallback', $data ?? [], null);
+        $this->setIfExists('term_source', $data ?? [], null);
+        $this->setIfExists('can_update', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets channel_id
+     *
+     * @return string|null
+     */
+    public function getChannelId()
+    {
+        return $this->container['channel_id'];
+    }
+
+    /**
+     * Sets channel_id
+     *
+     * @param string|null $channel_id channel_id
+     *
+     * @return self
+     */
+    public function setChannelId($channel_id)
+    {
+        if (is_null($channel_id)) {
+            throw new \InvalidArgumentException('non-nullable channel_id cannot be null');
+        }
+        $this->container['channel_id'] = $channel_id;
+
+        return $this;
+    }
+
+    /**
+     * Gets derived_from
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom|null
+     */
+    public function getDerivedFrom()
+    {
+        return $this->container['derived_from'];
+    }
+
+    /**
+     * Sets derived_from
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom|null $derived_from derived_from
+     *
+     * @return self
+     */
+    public function setDerivedFrom($derived_from)
+    {
+        if (is_null($derived_from)) {
+            array_push($this->openAPINullablesSetToNull, 'derived_from');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('derived_from', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['derived_from'] = $derived_from;
+
+        return $this;
+    }
+
+    /**
+     * Gets wbw
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom|null
+     */
+    public function getWbw()
+    {
+        return $this->container['wbw'];
+    }
+
+    /**
+     * Sets wbw
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom|null $wbw wbw
+     *
+     * @return self
+     */
+    public function setWbw($wbw)
+    {
+        if (is_null($wbw)) {
+            array_push($this->openAPINullablesSetToNull, 'wbw');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('wbw', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['wbw'] = $wbw;
+
+        return $this;
+    }
+
+    /**
+     * Gets fallback
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]|null
+     */
+    public function getFallback()
+    {
+        return $this->container['fallback'];
+    }
+
+    /**
+     * Sets fallback
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]|null $fallback fallback
+     *
+     * @return self
+     */
+    public function setFallback($fallback)
+    {
+        if (is_null($fallback)) {
+            throw new \InvalidArgumentException('non-nullable fallback cannot be null');
+        }
+        $this->container['fallback'] = $fallback;
+
+        return $this;
+    }
+
+    /**
+     * Gets term_source
+     *
+     * @return \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]|null
+     */
+    public function getTermSource()
+    {
+        return $this->container['term_source'];
+    }
+
+    /**
+     * Sets term_source
+     *
+     * @param \WikipaliApi\Model\GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner[]|null $term_source term_source
+     *
+     * @return self
+     */
+    public function setTermSource($term_source)
+    {
+        if (is_null($term_source)) {
+            throw new \InvalidArgumentException('non-nullable term_source cannot be null');
+        }
+        $this->container['term_source'] = $term_source;
+
+        return $this;
+    }
+
+    /**
+     * Gets can_update
+     *
+     * @return bool|null
+     */
+    public function getCanUpdate()
+    {
+        return $this->container['can_update'];
+    }
+
+    /**
+     * Sets can_update
+     *
+     * @param bool|null $can_update can_update
+     *
+     * @return self
+     */
+    public function setCanUpdate($can_update)
+    {
+        if (is_null($can_update)) {
+            throw new \InvalidArgumentException('non-nullable can_update cannot be null');
+        }
+        $this->container['can_update'] = $can_update;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 545 - 0
api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom.php

@@ -0,0 +1,545 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelLinks200ResponseDataDerivedFrom implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_links_200_response_data_derived_from';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'name' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'status' => 'int'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'id' => null,
+        'name' => null,
+        'type' => null,
+        'lang' => null,
+        'status' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'name' => false,
+        'type' => false,
+        'lang' => false,
+        'status' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'id' => 'id',
+        'name' => 'name',
+        'type' => 'type',
+        'lang' => 'lang',
+        'status' => 'status'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'name' => 'setName',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'status' => 'setStatus'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'name' => 'getName',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'status' => 'getStatus'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('id', $data ?? [], null);
+        $this->setIfExists('name', $data ?? [], null);
+        $this->setIfExists('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('status', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets id
+     *
+     * @return string|null
+     */
+    public function getId()
+    {
+        return $this->container['id'];
+    }
+
+    /**
+     * Sets id
+     *
+     * @param string|null $id id
+     *
+     * @return self
+     */
+    public function setId($id)
+    {
+        if (is_null($id)) {
+            throw new \InvalidArgumentException('non-nullable id cannot be null');
+        }
+        $this->container['id'] = $id;
+
+        return $this;
+    }
+
+    /**
+     * Gets name
+     *
+     * @return string|null
+     */
+    public function getName()
+    {
+        return $this->container['name'];
+    }
+
+    /**
+     * Sets name
+     *
+     * @param string|null $name name
+     *
+     * @return self
+     */
+    public function setName($name)
+    {
+        if (is_null($name)) {
+            throw new \InvalidArgumentException('non-nullable name cannot be null');
+        }
+        $this->container['name'] = $name;
+
+        return $this;
+    }
+
+    /**
+     * Gets type
+     *
+     * @return string|null
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string|null $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $this->container['type'] = $type;
+
+        return $this;
+    }
+
+    /**
+     * Gets lang
+     *
+     * @return string|null
+     */
+    public function getLang()
+    {
+        return $this->container['lang'];
+    }
+
+    /**
+     * Sets lang
+     *
+     * @param string|null $lang lang
+     *
+     * @return self
+     */
+    public function setLang($lang)
+    {
+        if (is_null($lang)) {
+            throw new \InvalidArgumentException('non-nullable lang cannot be null');
+        }
+        $this->container['lang'] = $lang;
+
+        return $this;
+    }
+
+    /**
+     * Gets status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status status
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 545 - 0
api-test/client/lib/Model/GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner.php

@@ -0,0 +1,545 @@
+<?php
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class GetApiV3ChannelsChannelLinks200ResponseDataFallbackInner implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'get_api_v3_channels_channel_links_200_response_data_fallback_inner';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'id' => 'string',
+        'name' => 'string',
+        'type' => 'string',
+        'lang' => 'string',
+        'status' => 'int'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'id' => null,
+        'name' => null,
+        'type' => null,
+        'lang' => null,
+        'status' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'id' => false,
+        'name' => false,
+        'type' => false,
+        'lang' => false,
+        'status' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'id' => 'id',
+        'name' => 'name',
+        'type' => 'type',
+        'lang' => 'lang',
+        'status' => 'status'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'id' => 'setId',
+        'name' => 'setName',
+        'type' => 'setType',
+        'lang' => 'setLang',
+        'status' => 'setStatus'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'id' => 'getId',
+        'name' => 'getName',
+        'type' => 'getType',
+        'lang' => 'getLang',
+        'status' => 'getStatus'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('id', $data ?? [], null);
+        $this->setIfExists('name', $data ?? [], null);
+        $this->setIfExists('type', $data ?? [], null);
+        $this->setIfExists('lang', $data ?? [], null);
+        $this->setIfExists('status', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets id
+     *
+     * @return string|null
+     */
+    public function getId()
+    {
+        return $this->container['id'];
+    }
+
+    /**
+     * Sets id
+     *
+     * @param string|null $id id
+     *
+     * @return self
+     */
+    public function setId($id)
+    {
+        if (is_null($id)) {
+            throw new \InvalidArgumentException('non-nullable id cannot be null');
+        }
+        $this->container['id'] = $id;
+
+        return $this;
+    }
+
+    /**
+     * Gets name
+     *
+     * @return string|null
+     */
+    public function getName()
+    {
+        return $this->container['name'];
+    }
+
+    /**
+     * Sets name
+     *
+     * @param string|null $name name
+     *
+     * @return self
+     */
+    public function setName($name)
+    {
+        if (is_null($name)) {
+            throw new \InvalidArgumentException('non-nullable name cannot be null');
+        }
+        $this->container['name'] = $name;
+
+        return $this;
+    }
+
+    /**
+     * Gets type
+     *
+     * @return string|null
+     */
+    public function getType()
+    {
+        return $this->container['type'];
+    }
+
+    /**
+     * Sets type
+     *
+     * @param string|null $type type
+     *
+     * @return self
+     */
+    public function setType($type)
+    {
+        if (is_null($type)) {
+            throw new \InvalidArgumentException('non-nullable type cannot be null');
+        }
+        $this->container['type'] = $type;
+
+        return $this;
+    }
+
+    /**
+     * Gets lang
+     *
+     * @return string|null
+     */
+    public function getLang()
+    {
+        return $this->container['lang'];
+    }
+
+    /**
+     * Sets lang
+     *
+     * @param string|null $lang lang
+     *
+     * @return self
+     */
+    public function setLang($lang)
+    {
+        if (is_null($lang)) {
+            throw new \InvalidArgumentException('non-nullable lang cannot be null');
+        }
+        $this->container['lang'] = $lang;
+
+        return $this;
+    }
+
+    /**
+     * Gets status
+     *
+     * @return int|null
+     */
+    public function getStatus()
+    {
+        return $this->container['status'];
+    }
+
+    /**
+     * Sets status
+     *
+     * @param int|null $status status
+     *
+     * @return self
+     */
+    public function setStatus($status)
+    {
+        if (is_null($status)) {
+            throw new \InvalidArgumentException('non-nullable status cannot be null');
+        }
+        $this->container['status'] = $status;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 525 - 0
api-test/client/lib/Model/PatchApiV3ChannelsChannelLinksRequest.php

@@ -0,0 +1,525 @@
+<?php
+/**
+ * PatchApiV3ChannelsChannelLinksRequest
+ *
+ * PHP version 8.1
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ */
+
+/**
+ * MINT API
+ *
+ * International Academy Of Pali Tipitaka(国际巴利三藏学院)  由 `php openapi/scripts/generate.php` 依据 api-v13 的路由与控制器源码生成。 响应统一封装为 `{ok, message, data}`;`ok=false` 时 `message` 为错误信息。
+ *
+ * The version of the OpenAPI document: 1.0.0
+ * Generated by: https://openapi-generator.tech
+ * Generator version: 7.25.0
+ */
+
+/**
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
+ * https://openapi-generator.tech
+ * Do not edit the class manually.
+ */
+
+namespace WikipaliApi\Model;
+
+use \ArrayAccess;
+use \WikipaliApi\ObjectSerializer;
+
+/**
+ * PatchApiV3ChannelsChannelLinksRequest Class Doc Comment
+ *
+ * @category Class
+ * @package  WikipaliApi
+ * @author   OpenAPI Generator team
+ * @link     https://openapi-generator.tech
+ * @implements \ArrayAccess<string, mixed>
+ */
+class PatchApiV3ChannelsChannelLinksRequest implements ModelInterface, ArrayAccess, \JsonSerializable
+{
+    public const DISCRIMINATOR = null;
+
+    /**
+     * The original name of the model.
+     *
+     * @var string
+     */
+    protected static $openAPIModelName = 'patch_api_v3_channels_channel_links_request';
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @var string[]
+     */
+    protected static $openAPITypes = [
+        'derived_from' => 'string',
+        'wbw' => 'string',
+        'fallback' => 'string[]',
+        'term_source' => 'string[]'
+    ];
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @var string[]
+     * @phpstan-var array<string, string|null>
+     * @psalm-var array<string, string|null>
+     */
+    protected static $openAPIFormats = [
+        'derived_from' => null,
+        'wbw' => null,
+        'fallback' => null,
+        'term_source' => null
+    ];
+
+    /**
+     * Array of nullable properties. Used for (de)serialization
+     *
+     * @var boolean[]
+     */
+    protected static array $openAPINullables = [
+        'derived_from' => true,
+        'wbw' => true,
+        'fallback' => false,
+        'term_source' => false
+    ];
+
+    /**
+     * If a nullable field gets set to null, insert it here
+     *
+     * @var boolean[]
+     */
+    protected array $openAPINullablesSetToNull = [];
+
+    /**
+     * Array of property to type mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPITypes()
+    {
+        return self::$openAPITypes;
+    }
+
+    /**
+     * Array of property to format mappings. Used for (de)serialization
+     *
+     * @return array
+     */
+    public static function openAPIFormats()
+    {
+        return self::$openAPIFormats;
+    }
+
+    /**
+     * Array of nullable properties
+     *
+     * @return array
+     */
+    protected static function openAPINullables(): array
+    {
+        return self::$openAPINullables;
+    }
+
+    /**
+     * Array of nullable field names deliberately set to null
+     *
+     * @return boolean[]
+     */
+    private function getOpenAPINullablesSetToNull(): array
+    {
+        return $this->openAPINullablesSetToNull;
+    }
+
+    /**
+     * Setter - Array of nullable field names deliberately set to null
+     *
+     * @param boolean[] $openAPINullablesSetToNull
+     */
+    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
+    {
+        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
+    }
+
+    /**
+     * Checks if a property is nullable
+     *
+     * @param string $property
+     * @return bool
+     */
+    public static function isNullable(string $property): bool
+    {
+        return self::openAPINullables()[$property] ?? false;
+    }
+
+    /**
+     * Checks if a nullable property is set to null.
+     *
+     * @param string $property
+     * @return bool
+     */
+    public function isNullableSetToNull(string $property): bool
+    {
+        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
+    }
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @var string[]
+     */
+    protected static $attributeMap = [
+        'derived_from' => 'derived_from',
+        'wbw' => 'wbw',
+        'fallback' => 'fallback',
+        'term_source' => 'term_source'
+    ];
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @var string[]
+     */
+    protected static $setters = [
+        'derived_from' => 'setDerivedFrom',
+        'wbw' => 'setWbw',
+        'fallback' => 'setFallback',
+        'term_source' => 'setTermSource'
+    ];
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @var string[]
+     */
+    protected static $getters = [
+        'derived_from' => 'getDerivedFrom',
+        'wbw' => 'getWbw',
+        'fallback' => 'getFallback',
+        'term_source' => 'getTermSource'
+    ];
+
+    /**
+     * Array of attributes where the key is the local name,
+     * and the value is the original name
+     *
+     * @return array
+     */
+    public static function attributeMap()
+    {
+        return self::$attributeMap;
+    }
+
+    /**
+     * Array of attributes to setter functions (for deserialization of responses)
+     *
+     * @return array
+     */
+    public static function setters()
+    {
+        return self::$setters;
+    }
+
+    /**
+     * Array of attributes to getter functions (for serialization of requests)
+     *
+     * @return array
+     */
+    public static function getters()
+    {
+        return self::$getters;
+    }
+
+    /**
+     * The original name of the model.
+     *
+     * @return string
+     */
+    public function getModelName()
+    {
+        return self::$openAPIModelName;
+    }
+
+
+    /**
+     * Associative array for storing property values
+     *
+     * @var mixed[]
+     */
+    protected $container = [];
+
+    /**
+     * Constructor
+     *
+     * @param mixed[]|null $data Associated array of property values
+     *                      initializing the model
+     */
+    public function __construct(?array $data = null)
+    {
+        $this->setIfExists('derived_from', $data ?? [], null);
+        $this->setIfExists('wbw', $data ?? [], null);
+        $this->setIfExists('fallback', $data ?? [], null);
+        $this->setIfExists('term_source', $data ?? [], null);
+    }
+
+    /**
+     * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
+     * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
+     * $this->openAPINullablesSetToNull array
+     *
+     * @param string $variableName
+     * @param array  $fields
+     * @param mixed  $defaultValue
+     */
+    private function setIfExists(string $variableName, array $fields, $defaultValue): void
+    {
+        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
+            $this->openAPINullablesSetToNull[] = $variableName;
+        }
+
+        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
+    }
+
+    /**
+     * Show all the invalid properties with reasons.
+     *
+     * @return array invalid properties with reasons
+     */
+    public function listInvalidProperties()
+    {
+        $invalidProperties = [];
+
+        return $invalidProperties;
+    }
+
+    /**
+     * Validate all the properties in the model
+     * return true if all passed
+     *
+     * @return bool True if all properties are valid
+     */
+    public function valid()
+    {
+        return count($this->listInvalidProperties()) === 0;
+    }
+
+
+    /**
+     * Gets derived_from
+     *
+     * @return string|null
+     */
+    public function getDerivedFrom()
+    {
+        return $this->container['derived_from'];
+    }
+
+    /**
+     * Sets derived_from
+     *
+     * @param string|null $derived_from 继承自哪个 channel(如英文版译自中文版),只记录
+     *
+     * @return self
+     */
+    public function setDerivedFrom($derived_from)
+    {
+        if (is_null($derived_from)) {
+            array_push($this->openAPINullablesSetToNull, 'derived_from');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('derived_from', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['derived_from'] = $derived_from;
+
+        return $this;
+    }
+
+    /**
+     * Gets wbw
+     *
+     * @return string|null
+     */
+    public function getWbw()
+    {
+        return $this->container['wbw'];
+    }
+
+    /**
+     * Sets wbw
+     *
+     * @param string|null $wbw 捆绑的逐词 channel,必须是 wbw 类型;载入时当原文
+     *
+     * @return self
+     */
+    public function setWbw($wbw)
+    {
+        if (is_null($wbw)) {
+            array_push($this->openAPINullablesSetToNull, 'wbw');
+        } else {
+            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
+            $index = array_search('wbw', $nullablesSetToNull);
+            if ($index !== FALSE) {
+                unset($nullablesSetToNull[$index]);
+                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
+            }
+        }
+        $this->container['wbw'] = $wbw;
+
+        return $this;
+    }
+
+    /**
+     * Gets fallback
+     *
+     * @return string[]|null
+     */
+    public function getFallback()
+    {
+        return $this->container['fallback'];
+    }
+
+    /**
+     * Sets fallback
+     *
+     * @param string[]|null $fallback 降级 channel,有序,最多 3 个,须与本 channel 同类型;段落没有数据时由客户端改取
+     *
+     * @return self
+     */
+    public function setFallback($fallback)
+    {
+        if (is_null($fallback)) {
+            throw new \InvalidArgumentException('non-nullable fallback cannot be null');
+        }
+        $this->container['fallback'] = $fallback;
+
+        return $this;
+    }
+
+    /**
+     * Gets term_source
+     *
+     * @return string[]|null
+     */
+    public function getTermSource()
+    {
+        return $this->container['term_source'];
+    }
+
+    /**
+     * Sets term_source
+     *
+     * @param string[]|null $term_source 术语路径,有序,最多 10 个,只能是 translation;只有 translation channel 能设
+     *
+     * @return self
+     */
+    public function setTermSource($term_source)
+    {
+        if (is_null($term_source)) {
+            throw new \InvalidArgumentException('non-nullable term_source cannot be null');
+        }
+        $this->container['term_source'] = $term_source;
+
+        return $this;
+    }
+    /**
+     * Returns true if offset exists. False otherwise.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return boolean
+     */
+    public function offsetExists(mixed $offset): bool
+    {
+        return isset($this->container[$offset]);
+    }
+
+    /**
+     * Gets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return mixed|null
+     */
+    #[\ReturnTypeWillChange]
+    public function offsetGet(mixed $offset)
+    {
+        return $this->container[$offset] ?? null;
+    }
+
+    /**
+     * Sets value based on offset.
+     *
+     * @param int|null $offset Offset
+     * @param mixed    $value  Value to be set
+     *
+     * @return void
+     */
+    public function offsetSet($offset, $value): void
+    {
+        if (is_null($offset)) {
+            $this->container[] = $value;
+        } else {
+            $this->container[$offset] = $value;
+        }
+    }
+
+    /**
+     * Unsets offset.
+     *
+     * @param integer|string $offset Offset
+     *
+     * @return void
+     */
+    public function offsetUnset(mixed $offset): void
+    {
+        unset($this->container[$offset]);
+    }
+
+    /**
+     * Serializes the object to a value that can be serialized natively by json_encode().
+     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
+     *
+     * @return mixed Returns data which can be serialized by json_encode(), which is a value
+     * of any type other than a resource.
+     */
+    #[\ReturnTypeWillChange]
+    public function jsonSerialize()
+    {
+       return ObjectSerializer::sanitizeForSerialization($this);
+    }
+
+    /**
+     * Gets the string presentation of the object
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return json_encode(
+            ObjectSerializer::sanitizeForSerialization($this),
+            JSON_PRETTY_PRINT
+        );
+    }
+
+    /**
+     * Gets a header-safe presentation of the object
+     *
+     * @return string
+     */
+    public function toHeaderValue()
+    {
+        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
+    }
+}
+
+

+ 68 - 0
api-v13/app/Http/Controllers/V3/ChannelLinkController.php

@@ -0,0 +1,68 @@
+<?php
+
+namespace App\Http\Controllers\V3;
+
+use App\Http\Controllers\Concerns\ResolvesCurrentUser;
+use App\Http\Controllers\Controller;
+use App\Http\Requests\V3\UpdateChannelLinksRequest;
+use App\Http\Resources\V3\ChannelLinksResource;
+use App\Models\Channel;
+use App\Services\V3\ChannelLinkService;
+use Illuminate\Http\Request;
+
+/**
+ * channel 之间的关系设置:继承自、降级、捆绑的逐词、术语路径(单例资源,每个 channel 一份)。
+ *
+ * 新能力,没有对应的 v2 端点。服务端只记录,降级的拼接、术语的取用由客户端做。
+ */
+class ChannelLinkController extends Controller
+{
+    use ResolvesCurrentUser;
+
+    public function __construct(private readonly ChannelLinkService $links) {}
+
+    /**
+     * channel 的关系设置
+     *
+     * 能读这个 channel 的人都能看。指向的 channel 已删除、或查看者看不见的,不出现在结果里。
+     * `can_update` 表示查看者能不能改。
+     *
+     * @unauthenticated
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @responseStatus 403 私有 channel,且看不见
+     */
+    public function show(Request $request, Channel $channel)
+    {
+        return ChannelLinksResource::make($this->links->get($channel, $this->currentUserUid($request)));
+    }
+
+    /**
+     * 改 channel 的关系设置
+     *
+     * 传了哪个键就整体替换哪一种关系,没传的不动;单值传 null 清掉,列表传 [] 清空。
+     * 能改 channel 信息的人才能改(拥有者、团队 owner / manager / editor、共享权限 ≥30)。AI 模型不能改。
+     * 目标必须是你看得见的 channel,且不能是自己。降级版本必须与本 channel 同类型;
+     * 术语路径只有 translation channel 能设,目标也只能是 translation(传 [] 清空总是允许)。
+     *
+     * @urlParam channel string required channel uid
+     *
+     * @bodyParam derived_from string|null 继承自哪个 channel(如英文版译自中文版),只记录
+     * @bodyParam wbw string|null 捆绑的逐词 channel,必须是 wbw 类型;载入时当原文
+     * @bodyParam fallback string[] 降级 channel,有序,最多 3 个,须与本 channel 同类型;段落没有数据时由客户端改取
+     * @bodyParam fallback.* string channel uid
+     * @bodyParam term_source string[] 术语路径,有序,最多 10 个,只能是 translation;只有 translation channel 能设
+     * @bodyParam term_source.* string channel uid
+     *
+     * @responseStatus 403 不能修改
+     */
+    public function update(UpdateChannelLinksRequest $request, Channel $channel)
+    {
+        return ChannelLinksResource::make($this->links->update(
+            $channel,
+            $this->currentUser($request)['user_uid'],
+            $request->validated(),
+        ));
+    }
+}

+ 36 - 0
api-v13/app/Http/Requests/V3/UpdateChannelLinksRequest.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace App\Http\Requests\V3;
+
+use App\Models\ChannelLink;
+use App\Services\V3\ChannelLinkService;
+use Illuminate\Foundation\Http\FormRequest;
+
+/**
+ * `PATCH /v3/channels/{channel}/links` 的入参:传了哪个键就整体替换哪一种关系,没有必填项。
+ *
+ * 目标是否存在、看不看得见、是不是自己、逐词类型对不对,在 {@see ChannelLinkService} 里判。
+ */
+class UpdateChannelLinksRequest extends FormRequest
+{
+    /** 登录与权限在中间件 / Service 里判 */
+    public function authorize(): bool
+    {
+        return true;
+    }
+
+    /**
+     * @return array<string, array<int, mixed>>
+     */
+    public function rules(): array
+    {
+        return [
+            'derived_from' => ['sometimes', 'nullable', 'uuid'],
+            'wbw' => ['sometimes', 'nullable', 'uuid'],
+            'fallback' => ['sometimes', 'array', 'max:'.ChannelLink::LISTS[ChannelLink::FALLBACK]],
+            'fallback.*' => ['uuid', 'distinct'],
+            'term_source' => ['sometimes', 'array', 'max:'.ChannelLink::LISTS[ChannelLink::TERM_SOURCE]],
+            'term_source.*' => ['uuid', 'distinct'],
+        ];
+    }
+}

+ 49 - 0
api-v13/app/Http/Resources/V3/ChannelLinksResource.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace App\Http\Resources\V3;
+
+use App\Models\Channel;
+use App\Services\V3\ChannelLinkService;
+use Illuminate\Http\Request;
+
+/**
+ * 一个 channel 的关系设置(`channel_links` 表)。载荷来自 {@see ChannelLinkService::get()}。
+ */
+class ChannelLinksResource extends BaseResource
+{
+    /**
+     * @return array{
+     *     channel_id: string,
+     *     derived_from: array{id: string, name: string, type: string, lang: string, status: int}|null,
+     *     wbw: array{id: string, name: string, type: string, lang: string, status: int}|null,
+     *     fallback: list<array{id: string, name: string, type: string, lang: string, status: int}>,
+     *     term_source: list<array{id: string, name: string, type: string, lang: string, status: int}>,
+     *     can_update: bool
+     * }
+     */
+    public function toArray(Request $request): array
+    {
+        return [
+            'channel_id' => $this->resource['channel_id'],
+            'derived_from' => $this->ref($this->resource['derived_from']),
+            'wbw' => $this->ref($this->resource['wbw']),
+            'fallback' => array_map(fn (Channel $c) => $this->ref($c), $this->resource['fallback']),
+            'term_source' => array_map(fn (Channel $c) => $this->ref($c), $this->resource['term_source']),
+            'can_update' => $this->resource['can_update'],
+        ];
+    }
+
+    /**
+     * @return array{id: string, name: string, type: string, lang: string, status: int}|null
+     */
+    private function ref(?Channel $channel): ?array
+    {
+        return $channel === null ? null : [
+            'id' => (string) $channel->uid,
+            'name' => (string) $channel->name,
+            'type' => (string) $channel->type,
+            'lang' => (string) $channel->lang,
+            'status' => (int) $channel->status,
+        ];
+    }
+}

+ 45 - 0
api-v13/app/Models/ChannelLink.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Models;
+
+use App\Services\V3\ChannelLinkService;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+
+/**
+ * channel 之间的一条关系(`channel_links` 表):channel_uid 指向 target_uid,kind 说明是哪种关系。
+ *
+ * 只给 v3 用,读写经 {@see ChannelLinkService}。
+ */
+class ChannelLink extends Model
+{
+    /** 继承自(如英文版译自中文版)。单值,只记录 */
+    public const DERIVED_FROM = 'derived_from';
+
+    /** 降级:段落没有数据时改取的 channel。有序,由客户端拼接 */
+    public const FALLBACK = 'fallback';
+
+    /** 捆绑的逐词 channel,载入时当原文。单值 */
+    public const WBW = 'wbw';
+
+    /** 术语路径:从哪些 channel 取术语。有序 */
+    public const TERM_SOURCE = 'term_source';
+
+    /** 单值的 kind */
+    public const SINGLE = [self::DERIVED_FROM, self::WBW];
+
+    /** 有序列表的 kind → 条数上限 */
+    public const LISTS = [self::FALLBACK => 3, self::TERM_SOURCE => 10];
+
+    protected $fillable = ['channel_uid', 'kind', 'target_uid', 'position'];
+
+    protected function casts(): array
+    {
+        return ['position' => 'integer'];
+    }
+
+    public function target(): BelongsTo
+    {
+        return $this->belongsTo(Channel::class, 'target_uid', 'uid');
+    }
+}

+ 180 - 0
api-v13/app/Services/V3/ChannelLinkService.php

@@ -0,0 +1,180 @@
+<?php
+
+namespace App\Services\V3;
+
+use App\Models\Channel;
+use App\Models\ChannelLink;
+use Illuminate\Auth\Access\AuthorizationException;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Validation\ValidationException;
+
+/**
+ * channel 之间的关系设置(`channel_links` 表):继承自、降级、捆绑的逐词、术语路径。
+ *
+ * 服务端只记录,不在任何读取路径上使用它们——降级怎么拼接、术语按什么顺序取,由客户端决定。
+ * 新能力,没有对应的 v2 端点。
+ *
+ * - 读:能读这个 channel 的人都能看;指向的 channel 若已删除或查看者看不见,就不出现
+ * - 写:能改这个 channel 信息的人({@see ChannelAbilityService} 的 update);AI 模型不能写
+ */
+class ChannelLinkService
+{
+    private const TRANSLATION = 'translation';
+
+    private const TARGET_COLUMNS = ['uid', 'name', 'type', 'lang', 'status', 'is_system', 'owner_uid'];
+
+    public function __construct(
+        private readonly ChannelAbilityService $abilities,
+        private readonly AgentGrantService $agents,
+    ) {}
+
+    /**
+     * 一个 channel 的全部关系设置。
+     *
+     * @return array{channel_id: string, derived_from: Channel|null, wbw: Channel|null, fallback: list<Channel>, term_source: list<Channel>, can_update: bool}
+     *
+     * @throws AuthorizationException 看不见这个 channel
+     */
+    public function get(Channel $channel, ?string $viewerUid): array
+    {
+        $abilities = $this->abilities->abilities($channel, $viewerUid);
+        if (! $abilities['read']) {
+            throw new AuthorizationException(__('messages.channel_forbidden'));
+        }
+
+        $links = ChannelLink::where('channel_uid', $channel->uid)
+            ->with(['target' => fn ($q) => $q->select(self::TARGET_COLUMNS)])
+            ->orderBy('kind')
+            ->orderBy('position')
+            ->get()
+            ->filter(fn (ChannelLink $link) => $link->target !== null);   // 指向的 channel 已软删
+
+        $readable = $this->abilities->abilitiesMany($links->pluck('target')->unique('uid'), $viewerUid);
+        $visible = $links->filter(fn (ChannelLink $link) => $readable[$link->target_uid]['read'] ?? false);
+
+        return [
+            'channel_id' => $channel->uid,
+            'derived_from' => $this->targetsOf($visible, ChannelLink::DERIVED_FROM)->first(),
+            'wbw' => $this->targetsOf($visible, ChannelLink::WBW)->first(),
+            'fallback' => $this->targetsOf($visible, ChannelLink::FALLBACK)->all(),
+            'term_source' => $this->targetsOf($visible, ChannelLink::TERM_SOURCE)->all(),
+            'can_update' => $abilities['update'],
+        ];
+    }
+
+    /**
+     * 改关系设置:传了哪个键就整体替换哪一种(单值传 null = 清掉,列表传 [] = 清空),没传的不动。
+     *
+     * @param  array{derived_from?: string|null, wbw?: string|null, fallback?: list<string>, term_source?: list<string>}  $data
+     * @return array{channel_id: string, derived_from: Channel|null, wbw: Channel|null, fallback: list<Channel>, term_source: list<Channel>, can_update: bool}
+     *
+     * @throws AuthorizationException 不能改这个 channel,或是 AI 模型
+     * @throws ValidationException 指向自己、指向看不见 / 不存在的 channel、逐词目标类型不对
+     */
+    public function update(Channel $channel, string $actorUid, array $data): array
+    {
+        $this->agents->assertHuman($actorUid);
+        if (! $this->abilities->abilities($channel, $actorUid)['update']) {
+            throw new AuthorizationException(__('messages.channel_forbidden'));
+        }
+
+        $wanted = $this->normalize($data);
+        $this->guardTargets($channel, $actorUid, $wanted);
+
+        DB::transaction(function () use ($channel, $wanted) {
+            foreach ($wanted as $kind => $targets) {
+                ChannelLink::where('channel_uid', $channel->uid)->where('kind', $kind)->delete();
+                foreach ($targets as $position => $target) {
+                    ChannelLink::create([
+                        'channel_uid' => $channel->uid,
+                        'kind' => $kind,
+                        'target_uid' => $target,
+                        'position' => $position,
+                    ]);
+                }
+            }
+        });
+
+        return $this->get($channel, $actorUid);
+    }
+
+    /**
+     * 入参 → kind => 有序的目标 uid 列表(单值的 kind 最多一个)。
+     *
+     * @param  array<string, mixed>  $data
+     * @return array<string, list<string>>
+     */
+    private function normalize(array $data): array
+    {
+        $wanted = [];
+        foreach (ChannelLink::SINGLE as $kind) {
+            if (array_key_exists($kind, $data)) {
+                $wanted[$kind] = $data[$kind] === null ? [] : [(string) $data[$kind]];
+            }
+        }
+        foreach (array_keys(ChannelLink::LISTS) as $kind) {
+            if (array_key_exists($kind, $data)) {
+                $wanted[$kind] = array_values(array_map('strval', $data[$kind] ?? []));
+            }
+        }
+
+        return $wanted;
+    }
+
+    /**
+     * 目标必须存在(未删除)、设置人看得见、不是自己。按类型还有三条:
+     * - 捆绑的逐词必须是 wbw 类型
+     * - 降级版本必须与本 channel 同类型(缺段时拿来顶替,类型不同就接不上)
+     * - 术语路径只对 translation channel 有效,目标也只能是 translation(清空总是允许的)
+     *
+     * 错误挂在具体的字段上。
+     *
+     * @param  array<string, list<string>>  $wanted
+     *
+     * @throws ValidationException
+     */
+    private function guardTargets(Channel $channel, string $actorUid, array $wanted): void
+    {
+        $uids = array_values(array_unique(array_merge(...array_values($wanted ?: [[]]))));
+        $targets = $uids === []
+            ? collect()
+            : Channel::whereIn('uid', $uids)->get(self::TARGET_COLUMNS)->keyBy('uid');
+        $readable = $this->abilities->abilitiesMany($targets->values(), $actorUid);
+
+        $errors = [];
+        if (! empty($wanted[ChannelLink::TERM_SOURCE]) && $channel->type !== self::TRANSLATION) {
+            $errors[ChannelLink::TERM_SOURCE] = __('messages.channel_link_term_source_channel');
+            unset($wanted[ChannelLink::TERM_SOURCE]);
+        }
+        foreach ($wanted as $kind => $list) {
+            foreach ($list as $i => $uid) {
+                $field = in_array($kind, ChannelLink::SINGLE, true) ? $kind : "{$kind}.{$i}";
+                $target = $targets->get($uid);
+                if ($uid === $channel->uid) {
+                    $errors[$field] = __('messages.channel_link_self');
+                } elseif ($target === null || ! ($readable[$uid]['read'] ?? false)) {
+                    $errors[$field] = __('messages.channel_link_target_missing');
+                } elseif ($kind === ChannelLink::WBW && $target->type !== 'wbw') {
+                    $errors[$field] = __('messages.channel_link_wbw_type');
+                } elseif ($kind === ChannelLink::FALLBACK && $target->type !== $channel->type) {
+                    $errors[$field] = __('messages.channel_link_fallback_type');
+                } elseif ($kind === ChannelLink::TERM_SOURCE && $target->type !== self::TRANSLATION) {
+                    $errors[$field] = __('messages.channel_link_term_source_type');
+                }
+            }
+        }
+        if ($errors !== []) {
+            throw ValidationException::withMessages($errors);
+        }
+    }
+
+    /**
+     * @param  Collection<int, ChannelLink>  $links
+     * @return Collection<int, Channel>
+     */
+    private function targetsOf(Collection $links, string $kind): Collection
+    {
+        return $links->where('kind', $kind)->sortBy('position')->map(fn (ChannelLink $link) => $link->target)->values();
+    }
+}

+ 31 - 0
api-v13/database/migrations/2026_11_17_042509_create_channel_links_table.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * channel 之间的关系设置:继承自、降级、捆绑的逐词、术语路径。服务端只记录,怎么用由客户端决定。
+     */
+    public function up(): void
+    {
+        Schema::create('channel_links', function (Blueprint $table) {
+            $table->id();
+            $table->uuid('channel_uid')->comment('设置方 channel(channels.uid)');
+            $table->string('kind', 16)->comment('关系:derived_from 继承自(单值,只记录)/ fallback 降级(有序,段落缺数据时客户端改取它)/ wbw 捆绑的逐词 channel(单值,载入时当原文)/ term_source 术语路径(有序,从哪些 channel 取术语)');
+            $table->uuid('target_uid')->comment('被指向的 channel(channels.uid)');
+            $table->unsignedSmallInteger('position')->default(0)->comment('同一 kind 内的顺序,从 0 起;单值的 kind 恒为 0');
+            $table->timestamps();
+
+            $table->unique(['channel_uid', 'kind', 'target_uid']);
+            $table->index(['target_uid', 'kind'], 'channel_links_target_kind_index');
+        });
+    }
+
+    public function down(): void
+    {
+        Schema::dropIfExists('channel_links');
+    }
+};

+ 6 - 0
api-v13/resources/lang/en/messages.php

@@ -66,4 +66,10 @@ return [
     'channel_studio_forbidden' => 'You cannot view or manage the channels of this studio (team).',
     'channel_studio_forbidden' => 'You cannot view or manage the channels of this studio (team).',
     'channel_name_exists' => 'A channel with this name already exists in this studio (team).',
     'channel_name_exists' => 'A channel with this name already exists in this studio (team).',
     'channel_has_content' => 'The channel already has translations, terms or word-by-word data and cannot be deleted.',
     'channel_has_content' => 'The channel already has translations, terms or word-by-word data and cannot be deleted.',
+    'channel_link_self' => 'A channel cannot point to itself.',
+    'channel_link_target_missing' => 'This channel does not exist, or you are not allowed to see it.',
+    'channel_link_wbw_type' => 'The bound word-by-word channel must be of type wbw.',
+    'channel_link_fallback_type' => 'A fallback channel must be of the same type as this channel.',
+    'channel_link_term_source_channel' => 'Only translation channels can have term sources.',
+    'channel_link_term_source_type' => 'Term sources must be translation channels.',
 ];
 ];

+ 6 - 0
api-v13/resources/lang/zh-Hans/messages.php

@@ -66,4 +66,10 @@ return [
     'channel_studio_forbidden' => '你不能查看或管理这个工作室(团队)的版本。',
     'channel_studio_forbidden' => '你不能查看或管理这个工作室(团队)的版本。',
     'channel_name_exists' => '这个工作室(团队)里已经有同名的版本了。',
     'channel_name_exists' => '这个工作室(团队)里已经有同名的版本了。',
     'channel_has_content' => '版本里已经有译文、术语或逐词解析,不能删除。',
     'channel_has_content' => '版本里已经有译文、术语或逐词解析,不能删除。',
+    'channel_link_self' => '不能指向这个版本自己。',
+    'channel_link_target_missing' => '找不到这个版本,或者你没有权限查看它。',
+    'channel_link_wbw_type' => '捆绑的逐词版本必须是逐词(wbw)类型。',
+    'channel_link_fallback_type' => '降级版本必须与本版本类型相同。',
+    'channel_link_term_source_channel' => '只有译文(translation)版本才能设置术语路径。',
+    'channel_link_term_source_type' => '术语路径只能选译文(translation)版本。',
 ];
 ];

+ 10 - 0
api-v13/routes/v3/channel.php

@@ -13,6 +13,7 @@
 
 
 use App\Http\Controllers\V3\ChannelBatchProgressController;
 use App\Http\Controllers\V3\ChannelBatchProgressController;
 use App\Http\Controllers\V3\ChannelController;
 use App\Http\Controllers\V3\ChannelController;
+use App\Http\Controllers\V3\ChannelLinkController;
 use App\Http\Controllers\V3\EditableChannelController;
 use App\Http\Controllers\V3\EditableChannelController;
 use App\Http\Controllers\V3\ProgressController;
 use App\Http\Controllers\V3\ProgressController;
 use App\Http\Controllers\V3\StudioChannelController;
 use App\Http\Controllers\V3\StudioChannelController;
@@ -47,3 +48,12 @@ Route::post('studios/{studio}/channels', [StudioChannelController::class, 'store
     ->name('studios.channels.store')
     ->name('studios.channels.store')
     ->middleware('auth.v3')
     ->middleware('auth.v3')
     ->whereUuid('studio');
     ->whereUuid('studio');
+
+// channel 之间的关系设置(单例:每个 channel 一份)。读公开(可选登录),写要登录;只有 PATCH
+Route::get('channels/{channel}/links', [ChannelLinkController::class, 'show'])
+    ->name('channels.links.show')
+    ->whereUuid('channel');
+Route::patch('channels/{channel}/links', [ChannelLinkController::class, 'update'])
+    ->name('channels.links.update')
+    ->middleware('auth.v3')
+    ->whereUuid('channel');

+ 237 - 0
api-v13/tests/Feature/ChannelLinkV3Test.php

@@ -0,0 +1,237 @@
+<?php
+
+use App\Models\AiModel;
+use App\Models\Channel;
+use App\Models\ChannelLink;
+use App\Services\AuthService;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Str;
+
+uses(RefreshDatabase::class);
+
+/*
+ * GET / PATCH /v3/channels/{channel}/links:channel 之间的关系设置。
+ * 这里断言的是形状而非契约(spectator 未安装,见 v3-resource skill 第 3 步)。
+ */
+
+function linksUrl(string $channel): string
+{
+    return "/api/v3/channels/{$channel}/links";
+}
+
+function setChannel(string $uid, array $attrs): void
+{
+    Channel::where('uid', $uid)->update($attrs);
+}
+
+it('saves all four kinds and returns them in order', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner, 'en');
+    $zh = makeChannel($owner, 'zh');
+    $wbw = makeChannel($owner, 'wbw');
+    setChannel($wbw, ['type' => 'wbw']);
+    [$a, $b, $c] = [makeChannel($owner, 'a'), makeChannel($owner, 'b'), makeChannel($owner, 'c')];
+
+    $this->patchJson(linksUrl($channel), [
+        'derived_from' => $zh, 'wbw' => $wbw, 'fallback' => [$b, $a], 'term_source' => [$c, $zh],
+    ], authHeader($owner))
+        ->assertOk()
+        ->assertJsonPath('data.channel_id', $channel)
+        ->assertJsonPath('data.derived_from.id', $zh)
+        ->assertJsonPath('data.derived_from.name', 'zh')
+        ->assertJsonPath('data.wbw.type', 'wbw')
+        ->assertJsonPath('data.fallback.*.id', [$b, $a])
+        ->assertJsonPath('data.term_source.*.id', [$c, $zh])
+        ->assertJsonPath('data.can_update', true);
+
+    $this->getJson(linksUrl($channel))
+        ->assertOk()
+        ->assertJsonPath('data.fallback.*.id', [$b, $a])
+        ->assertJsonPath('data.can_update', false);
+});
+
+it('returns empty settings for a channel without links', function () {
+    $channel = makeChannel(makeStudio('owner'));
+
+    $this->getJson(linksUrl($channel))
+        ->assertOk()
+        ->assertJsonPath('data.derived_from', null)
+        ->assertJsonPath('data.wbw', null)
+        ->assertJsonPath('data.fallback', [])
+        ->assertJsonPath('data.term_source', []);
+});
+
+it('replaces only the kinds that were sent, and clears with null or []', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner);
+    [$a, $b] = [makeChannel($owner, 'a'), makeChannel($owner, 'b')];
+
+    $this->patchJson(linksUrl($channel), ['derived_from' => $a, 'fallback' => [$a, $b]], authHeader($owner))->assertOk();
+    $this->patchJson(linksUrl($channel), ['fallback' => [$b]], authHeader($owner))
+        ->assertJsonPath('data.derived_from.id', $a)
+        ->assertJsonPath('data.fallback.*.id', [$b]);
+    $this->patchJson(linksUrl($channel), ['derived_from' => null, 'fallback' => []], authHeader($owner))
+        ->assertJsonPath('data.derived_from', null)
+        ->assertJsonPath('data.fallback', []);
+
+    expect(ChannelLink::where('channel_uid', $channel)->count())->toBe(0);
+});
+
+it('hides targets that were deleted or that the viewer cannot see', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner);
+    [$private, $gone, $public] = [makeChannel($owner, 'private'), makeChannel($owner, 'gone'), makeChannel($owner, 'public')];
+    $this->patchJson(linksUrl($channel), ['term_source' => [$private, $gone, $public]], authHeader($owner))->assertOk();
+    setChannel($private, ['status' => Channel::STATUS_PRIVATE]);
+    Channel::where('uid', $gone)->first()->delete();
+
+    $this->getJson(linksUrl($channel))->assertJsonPath('data.term_source.*.id', [$public]);
+    $this->getJson(linksUrl($channel), authHeader($owner))->assertJsonPath('data.term_source.*.id', [$private, $public]);
+});
+
+it('lets only those who can update the channel change its links', function () {
+    [$team, $users] = makeTeam();
+    $channel = makeChannel($team);
+    $target = makeChannel($team, 'target');
+
+    $this->patchJson(linksUrl($channel), ['derived_from' => $target])->assertUnauthorized();
+    foreach (['owner', 'manager', 'editor'] as $role) {
+        $this->patchJson(linksUrl($channel), ['derived_from' => $target], authHeader($users[$role]))->assertOk();
+    }
+    foreach (['reader', 'outsider'] as $role) {
+        $this->patchJson(linksUrl($channel), ['derived_from' => $target], authHeader($users[$role]))->assertForbidden();
+    }
+
+    $model = AiModel::factory()->ownedBy($users['owner'])->create();
+    $this->patchJson(linksUrl($channel), ['derived_from' => $target], [
+        'Authorization' => 'Bearer '.AuthService::getUserToken($model->uid),
+    ])->assertForbidden();
+});
+
+it('hides the settings of a private channel from those who cannot see it', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner);
+    setChannel($channel, ['status' => Channel::STATUS_PRIVATE]);
+
+    $this->getJson(linksUrl($channel))->assertForbidden();
+    $this->getJson(linksUrl($channel), authHeader(makeStudio('stranger')))->assertForbidden();
+    $this->getJson(linksUrl($channel), authHeader($owner))->assertOk();
+    $this->getJson(linksUrl((string) Str::uuid()))->assertNotFound();
+});
+
+it('rejects invalid targets with field errors', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner);
+    $notWbw = makeChannel($owner, 'translation');
+    $hidden = makeChannel(makeStudio('other'), 'hidden');
+    setChannel($hidden, ['status' => Channel::STATUS_PRIVATE]);
+    $headers = authHeader($owner);
+
+    $this->patchJson(linksUrl($channel), ['derived_from' => $channel], $headers)
+        ->assertUnprocessable()->assertJsonValidationErrors('derived_from');
+    $this->patchJson(linksUrl($channel), ['fallback' => [$notWbw, $hidden]], $headers)
+        ->assertUnprocessable()->assertJsonValidationErrors('fallback.1');
+    $this->patchJson(linksUrl($channel), ['term_source' => [(string) Str::uuid()]], $headers)
+        ->assertUnprocessable()->assertJsonValidationErrors('term_source.0');
+    $this->patchJson(linksUrl($channel), ['wbw' => $notWbw], $headers)
+        ->assertUnprocessable()->assertJsonValidationErrors('wbw');
+
+    expect(ChannelLink::count())->toBe(0);
+});
+
+it('requires fallback channels of the same type as the channel', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner);                    // translation
+    $same = makeChannel($owner, 'same');
+    $nissaya = makeChannel($owner, 'nissaya');
+    setChannel($nissaya, ['type' => 'nissaya']);
+
+    $this->patchJson(linksUrl($channel), ['fallback' => [$same, $nissaya]], authHeader($owner))
+        ->assertUnprocessable()
+        ->assertJsonValidationErrors('fallback.1')
+        ->assertJsonMissingValidationErrors('fallback.0');
+
+    $other = makeChannel($owner, 'nissaya-2');
+    setChannel($other, ['type' => 'nissaya']);
+    $this->patchJson(linksUrl($nissaya), ['fallback' => [$other]], authHeader($owner))
+        ->assertOk()
+        ->assertJsonPath('data.fallback.*.id', [$other]);
+});
+
+it('allows term sources only on translation channels, and only translation targets', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner);                    // translation
+    $translation = makeChannel($owner, 'translation');
+    $nissaya = makeChannel($owner, 'nissaya');
+    setChannel($nissaya, ['type' => 'nissaya']);
+
+    $this->patchJson(linksUrl($channel), ['term_source' => [$translation, $nissaya]], authHeader($owner))
+        ->assertUnprocessable()
+        ->assertJsonValidationErrors('term_source.1')
+        ->assertJsonMissingValidationErrors('term_source.0');
+
+    // 非 translation 的 channel 不能设术语路径,但清空总是允许
+    $this->patchJson(linksUrl($nissaya), ['term_source' => [$translation]], authHeader($owner))
+        ->assertUnprocessable()
+        ->assertJsonValidationErrors('term_source');
+    $this->patchJson(linksUrl($nissaya), ['term_source' => []], authHeader($owner))->assertOk();
+
+    expect(ChannelLink::count())->toBe(0);
+});
+
+it('validates the shape of the input', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner);
+    $a = makeChannel($owner, 'a');
+    $many = array_map(fn ($i) => makeChannel($owner, "c{$i}"), range(1, 4));
+
+    $this->patchJson(linksUrl($channel), ['derived_from' => 'nope'], authHeader($owner))
+        ->assertUnprocessable()->assertJsonValidationErrors('derived_from');
+    $this->patchJson(linksUrl($channel), ['fallback' => $many], authHeader($owner))
+        ->assertUnprocessable()->assertJsonValidationErrors('fallback');
+    $this->patchJson(linksUrl($channel), ['term_source' => [$a, $a]], authHeader($owner))
+        ->assertUnprocessable()->assertJsonValidationErrors('term_source.0');
+});
+
+it('never exposes the auto-increment id of channel_links', function () {
+    $owner = makeStudio('owner');
+    $channel = makeChannel($owner);
+    [$a, $b] = [makeChannel($owner, 'a'), makeChannel($owner, 'b')];
+    $patched = $this->patchJson(linksUrl($channel), ['derived_from' => $a, 'fallback' => [$b], 'term_source' => [$a, $b]], authHeader($owner))
+        ->assertOk();
+    $shown = $this->getJson(linksUrl($channel), authHeader($owner))->assertOk();
+
+    $rowIds = ChannelLink::where('channel_uid', $channel)->pluck('id')->all();
+    expect($rowIds)->toHaveCount(4);
+    foreach ([$patched, $shown] as $res) {
+        $data = $res->json('data');
+        expect(array_keys($data))->toBe(['channel_id', 'derived_from', 'wbw', 'fallback', 'term_source', 'can_update']);
+        $ids = [$data['channel_id'], $data['derived_from']['id'], ...array_column($data['fallback'], 'id'), ...array_column($data['term_source'], 'id')];
+        foreach ($ids as $id) {
+            expect(Str::isUuid($id))->toBeTrue();
+        }
+        foreach ([$data['derived_from'], ...$data['fallback'], ...$data['term_source']] as $ref) {
+            expect(array_keys($ref))->toBe(['id', 'name', 'type', 'lang', 'status']);
+        }
+        expect(array_intersect($rowIds, $ids))->toBe([]);
+    }
+});
+
+it('reads the settings in a constant number of queries', function () {
+    $owner = makeStudio('owner');
+    $count = function (int $targets) use ($owner) {
+        $channel = makeChannel($owner);
+        $uids = array_map(fn ($i) => makeChannel($owner, "t{$targets}-{$i}"), range(1, $targets));
+        $this->patchJson(linksUrl($channel), ['term_source' => $uids], authHeader($owner))->assertOk();
+        DB::flushQueryLog();
+        DB::enableQueryLog();
+        $this->getJson(linksUrl($channel), authHeader($owner))->assertOk();
+        $n = count(DB::getQueryLog());
+        DB::disableQueryLog();
+
+        return $n;
+    };
+
+    expect($count(8))->toBe($count(2));
+});

+ 138 - 0
dashboard-test/src/tests/channel-links.spec.ts

@@ -0,0 +1,138 @@
+import { test, expect, type Page } from '@playwright/test';
+import { call } from '../lib/api.js';
+import { collect } from '../lib/collect.js';
+import { DESTRUCTIVE, shotDir } from '../lib/env.js';
+
+/**
+ * channel 设置页「关联」页签:继承自、捆绑的逐词、降级版本、术语路径(/v3/channels/{id}/links)。
+ * 服务端只记录;这里只测设置界面。用五个 e2e-tmp-* 临时 channel(三个 translation、两个 nissaya),测完软删。
+ */
+const SHOT = shotDir('channel-links');
+const shot = (page: Page, name: string) =>
+  page.screenshot({ path: `${SHOT}/${name}.png`, fullPage: true });
+
+const item = (page: Page, label: string) =>
+  page.locator('.ant-form-item').filter({ has: page.locator('label', { hasText: label }) });
+
+/** 在某个表单项里的下拉框中搜索并选中一个 channel */
+const pick = async (page: Page, label: string, name: string) => {
+  const select = item(page, label).locator('.ant-select').last();
+  await select.click();
+  await select.locator('input').fill(name);
+  const option = page.locator('.ant-select-dropdown:visible .ant-select-item-option').filter({ hasText: name });
+  await expect(option).toBeVisible({ timeout: 10_000 });
+  await option.click();
+};
+
+const save = async (page: Page, id: string) => {
+  const saved = page.waitForResponse(
+    (r) => r.url().endsWith(`/api/v3/channels/${id}/links`) && r.request().method() === 'PATCH',
+  );
+  await page.getByRole('button', { name: /保 *存/ }).click();
+  const res = await saved;
+  expect(res.status()).toBe(200);
+  return (await res.json()).data;
+};
+
+test('关联页签:设置继承自与术语路径,刷新后仍在,移除后清空;按类型过滤候选', async ({ page, request }) => {
+  test.skip(!DESTRUCTIVE, 'E2E_DESTRUCTIVE=0');
+  const log = collect(page);
+  const me = (await call(request, 'GET', '/v3/me')).body.data;
+  const stamp = Date.now();
+  const make = async (suffix: string, type = 'translation') => {
+    const res = await call(request, 'POST', `/v3/studios/${me.id}/channels`, {
+      name: `e2e-tmp-${stamp}-${suffix}`, type, lang: 'en',
+    });
+    expect(res.status).toBe(201);
+    return { id: res.body.data.id as string, name: res.body.data.name as string };
+  };
+  const a = await make('a');
+  const b = await make('b');
+  const c = await make('c');
+  const nissaya = await make('nissaya', 'nissaya');
+  const nissaya2 = await make('nissaya2', 'nissaya');
+
+  try {
+    await test.step('1. 打开关联页签,初始都未设置', async () => {
+      await page.goto(`workspace/channel/${a.id}/setting/links`, { waitUntil: 'networkidle' });
+      await expect(item(page, '继承自')).toBeVisible();
+      await expect(item(page, '降级版本')).toBeVisible();
+      await expect(item(page, '捆绑的逐词')).toBeVisible();
+      await expect(item(page, '术语路径')).toBeVisible();
+      await shot(page, '01-empty');
+      log.dump('1. 打开关联页签');
+    });
+
+    await test.step('1b. 术语路径的候选只有 translation 类型', async () => {
+      const select = item(page, '术语路径').locator('.ant-select').last();
+      const listed = page.waitForResponse((r) => /\/api\/v3\/channels\/editable\?/.test(r.url()) && r.url().includes(String(stamp)));
+      await select.click();
+      await select.locator('input').fill(String(stamp));
+      expect(new URL((await listed).url()).searchParams.get('type')).toBe('translation');
+      const options = page.locator('.ant-select-dropdown:visible .ant-select-item-option');
+      await expect(options.filter({ hasText: b.name })).toBeVisible({ timeout: 10_000 });
+      await expect(options.filter({ hasText: nissaya.name })).toHaveCount(0);
+      await page.keyboard.press('Escape');
+      // 等收起动画结束,否则下一步会点到这个正在消失的下拉框里的同名选项
+      await expect(page.locator('.ant-select-dropdown:visible')).toHaveCount(0);
+    });
+
+    await test.step('2. 选继承自 b、术语路径 c → b,保存', async () => {
+      await pick(page, '继承自', b.name);
+      await pick(page, '术语路径', c.name);
+      await pick(page, '术语路径', b.name);
+      const data = await save(page, a.id);
+      expect(data.derived_from.id).toBe(b.id);
+      expect(data.term_source.map((r: { id: string }) => r.id)).toEqual([c.id, b.id]);
+      await shot(page, '02-saved');
+      log.dump('2. 保存');
+    });
+
+    await test.step('3. 下移第一项,顺序变为 b → c', async () => {
+      await item(page, '术语路径').locator('.ant-list-item').first().getByRole('button').nth(1).click();
+      const data = await save(page, a.id);
+      expect(data.term_source.map((r: { id: string }) => r.id)).toEqual([b.id, c.id]);
+    });
+
+    await test.step('4. 刷新后仍在', async () => {
+      await page.reload({ waitUntil: 'networkidle' });
+      await expect(item(page, '继承自')).toContainText(b.name);
+      await expect(item(page, '术语路径').locator('.ant-list-item')).toHaveCount(2);
+      await expect(item(page, '术语路径').locator('.ant-list-item').first()).toContainText(b.name);
+      await shot(page, '04-reloaded');
+    });
+
+    await test.step('5. 清掉继承自、移除术语路径,保存后为空', async () => {
+      await item(page, '继承自').locator('.ant-select').hover();
+      await item(page, '继承自').locator('.ant-select-clear').click();
+      const list = item(page, '术语路径').locator('.ant-list-item');
+      await list.first().locator('button.ant-btn-dangerous').click();
+      await list.first().locator('button.ant-btn-dangerous').click();
+      const data = await save(page, a.id);
+      expect(data.derived_from).toBeNull();
+      expect(data.term_source).toEqual([]);
+      await shot(page, '05-cleared');
+      log.dump('5. 清空');
+    });
+
+    await test.step('6. 降级版本的候选只有与当前版本同类型的(nissaya)', async () => {
+      await page.goto(`workspace/channel/${nissaya.id}/setting/links`, { waitUntil: 'networkidle' });
+      const select = item(page, '降级版本').locator('.ant-select').last();
+      const listed = page.waitForResponse((r) => /\/api\/v3\/channels\/editable\?/.test(r.url()) && r.url().includes(String(stamp)));
+      await select.click();
+      await select.locator('input').fill(String(stamp));
+      expect(new URL((await listed).url()).searchParams.get('type')).toBe('nissaya');
+      const options = page.locator('.ant-select-dropdown:visible .ant-select-item-option');
+      await expect(options.filter({ hasText: nissaya2.name })).toBeVisible({ timeout: 10_000 });
+      await expect(options.filter({ hasText: b.name })).toHaveCount(0);
+      await shot(page, '06-fallback-same-type');
+      // 术语路径只对 translation channel 有效,nissaya 的设置页里没有这一项
+      await expect(item(page, '术语路径')).toHaveCount(0);
+      await page.keyboard.press('Escape');
+    });
+  } finally {
+    for (const ch of [a, b, c, nissaya, nissaya2]) {
+      await call(request, 'DELETE', `/v3/channels/${ch.id}`);
+    }
+  }
+});

+ 29 - 0
dashboard-v6/src/api/channel.ts

@@ -260,3 +260,32 @@ export const fetchChannelProgress = async (
       body: { sentences, studio },
       body: { sentences, studio },
     }),
     }),
   ).data ?? [];
   ).data ?? [];
+
+/* ─── channel 之间的关系设置(v3 新能力:继承自 / 捆绑逐词 / 降级 / 术语路径;服务端只记录)─── */
+
+type ChannelLinksSingle =
+  paths["/v3/channels/{channel}/links"]["get"]["responses"][200]["content"]["application/json"];
+export type ChannelLinks = NonNullable<ChannelLinksSingle["data"]>;
+export type ChannelRef = NonNullable<ChannelLinks["derived_from"]>;
+export type ChannelLinksInput = NonNullable<
+  paths["/v3/channels/{channel}/links"]["patch"]["requestBody"]
+>["content"]["application/json"];
+
+export const fetchChannelLinks = async (channel: string) =>
+  unwrap(
+    await api.GET("/v3/channels/{channel}/links", {
+      params: { path: { channel } },
+    }),
+  ).data;
+
+/** 传了哪个键就整体替换哪一种关系;单值传 null 清掉,列表传 [] 清空 */
+export const updateChannelLinks = async (
+  channel: string,
+  body: ChannelLinksInput,
+) =>
+  unwrap(
+    await api.PATCH("/v3/channels/{channel}/links", {
+      params: { path: { channel } },
+      body,
+    }),
+  ).data;

+ 178 - 0
dashboard-v6/src/api/schema.d.ts

@@ -8122,6 +8122,38 @@ export interface paths {
         patch: operations["patch_api_v3_channels_channel_"];
         patch: operations["patch_api_v3_channels_channel_"];
         trace?: never;
         trace?: never;
     };
     };
+    "/v3/channels/{channel}/links": {
+        parameters: {
+            query?: never;
+            header?: never;
+            path?: never;
+            cookie?: never;
+        };
+        /**
+         * channel 的关系设置
+         * @description 能读这个 channel 的人都能看。指向的 channel 已删除、或查看者看不见的,不出现在结果里。
+         *     `can_update` 表示查看者能不能改。
+         *
+         *     实现:`V3\ChannelLinkController@show`
+         */
+        get: operations["get_api_v3_channels_channel_links"];
+        put?: never;
+        post?: never;
+        delete?: never;
+        options?: never;
+        head?: never;
+        /**
+         * 改 channel 的关系设置
+         * @description 传了哪个键就整体替换哪一种关系,没传的不动;单值传 null 清掉,列表传 [] 清空。
+         *     能改 channel 信息的人才能改(拥有者、团队 owner / manager / editor、共享权限 ≥30)。AI 模型不能改。
+         *     目标必须是你看得见的 channel,且不能是自己。降级版本必须与本 channel 同类型;
+         *     术语路径只有 translation channel 能设,目标也只能是 translation(传 [] 清空总是允许)。
+         *
+         *     实现:`V3\ChannelLinkController@update`
+         */
+        patch: operations["patch_api_v3_channels_channel_links"];
+        trace?: never;
+    };
     "/v3/credit-policy": {
     "/v3/credit-policy": {
         parameters: {
         parameters: {
             query?: never;
             query?: never;
@@ -36668,6 +36700,152 @@ export interface operations {
             422: components["responses"]["ProblemValidation"];
             422: components["responses"]["ProblemValidation"];
         };
         };
     };
     };
+    get_api_v3_channels_channel_links: {
+        parameters: {
+            query?: never;
+            header?: never;
+            path: {
+                /** @description channel uid */
+                channel: string;
+            };
+            cookie?: never;
+        };
+        requestBody?: never;
+        responses: {
+            /** @description 成功 */
+            200: {
+                headers: {
+                    [name: string]: unknown;
+                };
+                content: {
+                    "application/json": {
+                        data?: {
+                            channel_id?: string;
+                            derived_from?: {
+                                id?: string;
+                                name?: string;
+                                type?: string;
+                                lang?: string;
+                                status?: number;
+                            } | null;
+                            wbw?: {
+                                id?: string;
+                                name?: string;
+                                type?: string;
+                                lang?: string;
+                                status?: number;
+                            } | null;
+                            fallback?: {
+                                id?: string;
+                                name?: string;
+                                type?: string;
+                                lang?: string;
+                                status?: number;
+                            }[];
+                            term_source?: {
+                                id?: string;
+                                name?: string;
+                                type?: string;
+                                lang?: string;
+                                status?: number;
+                            }[];
+                            can_update?: boolean;
+                        };
+                    };
+                };
+            };
+            /** @description 私有 channel,且看不见 */
+            403: {
+                headers: {
+                    [name: string]: unknown;
+                };
+                content: {
+                    "application/problem+json": components["schemas"]["ProblemDetails"];
+                };
+            };
+            422: components["responses"]["ProblemValidation"];
+        };
+    };
+    patch_api_v3_channels_channel_links: {
+        parameters: {
+            query?: never;
+            header?: never;
+            path: {
+                /** @description channel uid */
+                channel: string;
+            };
+            cookie?: never;
+        };
+        requestBody?: {
+            content: {
+                "application/json": {
+                    /** @description 继承自哪个 channel(如英文版译自中文版),只记录 */
+                    derived_from?: string | null;
+                    /** @description 捆绑的逐词 channel,必须是 wbw 类型;载入时当原文 */
+                    wbw?: string | null;
+                    /** @description 降级 channel,有序,最多 3 个,须与本 channel 同类型;段落没有数据时由客户端改取 */
+                    fallback?: string[];
+                    /** @description 术语路径,有序,最多 10 个,只能是 translation;只有 translation channel 能设 */
+                    term_source?: string[];
+                };
+            };
+        };
+        responses: {
+            /** @description 成功 */
+            200: {
+                headers: {
+                    [name: string]: unknown;
+                };
+                content: {
+                    "application/json": {
+                        data?: {
+                            channel_id?: string;
+                            derived_from?: {
+                                id?: string;
+                                name?: string;
+                                type?: string;
+                                lang?: string;
+                                status?: number;
+                            } | null;
+                            wbw?: {
+                                id?: string;
+                                name?: string;
+                                type?: string;
+                                lang?: string;
+                                status?: number;
+                            } | null;
+                            fallback?: {
+                                id?: string;
+                                name?: string;
+                                type?: string;
+                                lang?: string;
+                                status?: number;
+                            }[];
+                            term_source?: {
+                                id?: string;
+                                name?: string;
+                                type?: string;
+                                lang?: string;
+                                status?: number;
+                            }[];
+                            can_update?: boolean;
+                        };
+                    };
+                };
+            };
+            401: components["responses"]["ProblemUnauthorized"];
+            /** @description 不能修改 */
+            403: {
+                headers: {
+                    [name: string]: unknown;
+                };
+                content: {
+                    "application/problem+json": components["schemas"]["ProblemDetails"];
+                };
+            };
+            422: components["responses"]["ProblemValidation"];
+        };
+    };
     get_api_v3_credit_policy: {
     get_api_v3_credit_policy: {
         parameters: {
         parameters: {
             query?: never;
             query?: never;

+ 392 - 0
dashboard-v6/src/components/channel/ChannelLinks.tsx

@@ -0,0 +1,392 @@
+// channel 设置页「关联」页签:继承自、捆绑的逐词、降级版本、术语路径。
+// 服务端只记录,降级拼接、术语取用以后由客户端实现(现在只做设置)。
+import { useEffect, useRef, useState } from "react";
+import { useIntl } from "react-intl";
+import {
+  Alert,
+  Button,
+  Form,
+  List,
+  Select,
+  Skeleton,
+  Space,
+  Tag,
+  Typography,
+  message,
+} from "antd";
+import {
+  ArrowDownOutlined,
+  ArrowUpOutlined,
+  DeleteOutlined,
+} from "@ant-design/icons";
+
+import {
+  fetchChannel,
+  fetchChannelLinks,
+  fetchEditableChannels,
+  fetchPublicChannels,
+  updateChannelLinks,
+  type ChannelLinks as ChannelLinksData,
+  type ChannelRef,
+  type EditableChannelQuery,
+} from "../../api/channel";
+
+const MAX_FALLBACK = 3;
+const MAX_TERM_SOURCE = 10;
+
+/** 组件内部用的 channel 摘要:字段齐全(生成的响应类型里字段都是可选的) */
+interface Ref {
+  id: string;
+  name: string;
+  type: string;
+  lang: string;
+}
+
+interface LinksState {
+  derived_from: Ref | null;
+  wbw: Ref | null;
+  fallback: Ref[];
+  term_source: Ref[];
+  can_update: boolean;
+}
+
+const toRef = (r: ChannelRef): Ref => ({
+  id: r.id ?? "",
+  name: r.name ?? "",
+  type: r.type ?? "",
+  lang: r.lang ?? "",
+});
+
+const toState = (links: ChannelLinksData): LinksState => ({
+  derived_from: links.derived_from ? toRef(links.derived_from) : null,
+  wbw: links.wbw ? toRef(links.wbw) : null,
+  fallback: (links.fallback ?? []).map(toRef),
+  term_source: (links.term_source ?? []).map(toRef),
+  can_update: links.can_update ?? false,
+});
+
+/**
+ * 候选列表按 channel 类型过滤:捆绑的逐词只列 wbw,术语路径只列 translation,
+ * 降级版本只列与当前 channel 同类型的
+ */
+type PickType = NonNullable<EditableChannelQuery["type"]>;
+
+/** 候选:我能写的 + 公开的 + 系统 channel,按名字搜,去重 */
+const searchChannels = async (
+  search: string,
+  type?: PickType,
+): Promise<Ref[]> => {
+  const query = { search: search || undefined, type, per_page: 50 };
+  const [editable, publicRows, system] = await Promise.all([
+    fetchEditableChannels(query),
+    fetchPublicChannels(query),
+    fetchPublicChannels({ ...query, system: true }),
+  ]);
+  const seen = new Map<string, Ref>();
+  for (const row of [
+    ...(editable.data ?? []),
+    ...(publicRows.data ?? []),
+    ...(system.data ?? []),
+  ]) {
+    if (row.id && !seen.has(row.id)) {
+      seen.set(row.id, toRef(row));
+    }
+  }
+  return [...seen.values()];
+};
+
+const refLabel = (ref: Ref) => (
+  <Space size={4} style={{ whiteSpace: "nowrap" }}>
+    <span>{ref.name}</span>
+    <Tag variant="filled">{ref.lang}</Tag>
+    <Typography.Text type="secondary">{ref.type}</Typography.Text>
+  </Space>
+);
+
+interface IPickerProps {
+  value?: Ref | null;
+  exclude: string[];
+  type?: PickType;
+  disabled?: boolean;
+  allowClear?: boolean;
+  placeholder?: string;
+  onChange: (ref: Ref | null) => void;
+}
+
+/** 可搜索的 channel 下拉框(单选) */
+const ChannelRefPicker = ({
+  value,
+  exclude,
+  type,
+  disabled,
+  allowClear,
+  placeholder,
+  onChange,
+}: IPickerProps) => {
+  const [options, setOptions] = useState<Ref[]>([]);
+  const [loading, setLoading] = useState(false);
+  const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
+
+  const load = (search: string) => {
+    clearTimeout(timer.current);
+    timer.current = setTimeout(async () => {
+      setLoading(true);
+      try {
+        setOptions(await searchChannels(search, type));
+      } finally {
+        setLoading(false);
+      }
+    }, 300);
+  };
+
+  const candidates = options.filter((o) => !exclude.includes(o.id));
+  if (value && !candidates.some((o) => o.id === value.id)) {
+    candidates.unshift(value);
+  }
+
+  return (
+    <Select
+      showSearch
+      filterOption={false}
+      allowClear={allowClear}
+      disabled={disabled}
+      placeholder={placeholder}
+      loading={loading}
+      style={{ width: 360, maxWidth: "100%" }}
+      value={value?.id ?? null}
+      onSearch={load}
+      onOpenChange={(open) => open && options.length === 0 && load("")}
+      onChange={(id: string | undefined) =>
+        onChange(candidates.find((o) => o.id === id) ?? null)
+      }
+      options={candidates.map((o) => ({ value: o.id, label: refLabel(o) }))}
+    />
+  );
+};
+
+interface IListProps {
+  value: Ref[];
+  max: number;
+  exclude: string[];
+  type?: PickType;
+  disabled?: boolean;
+  onChange: (refs: Ref[]) => void;
+}
+
+/** 有序的 channel 列表:添加、上移、下移、移除 */
+const OrderedChannelList = ({
+  value,
+  max,
+  exclude,
+  type,
+  disabled,
+  onChange,
+}: IListProps) => {
+  const intl = useIntl();
+  const move = (from: number, to: number) => {
+    const next = [...value];
+    const [item] = next.splice(from, 1);
+    next.splice(to, 0, item);
+    onChange(next);
+  };
+
+  return (
+    <Space orientation="vertical" style={{ width: "100%" }}>
+      {value.length > 0 && (
+        <List
+          size="small"
+          bordered
+          style={{ maxWidth: 640 }}
+          dataSource={value}
+          renderItem={(ref, i) => (
+            <List.Item
+              actions={
+                disabled
+                  ? []
+                  : [
+                      <Button
+                        key="up"
+                        size="small"
+                        type="text"
+                        icon={<ArrowUpOutlined />}
+                        disabled={i === 0}
+                        onClick={() => move(i, i - 1)}
+                      />,
+                      <Button
+                        key="down"
+                        size="small"
+                        type="text"
+                        icon={<ArrowDownOutlined />}
+                        disabled={i === value.length - 1}
+                        onClick={() => move(i, i + 1)}
+                      />,
+                      <Button
+                        key="remove"
+                        size="small"
+                        type="text"
+                        danger
+                        icon={<DeleteOutlined />}
+                        onClick={() =>
+                          onChange(value.filter((_, j) => j !== i))
+                        }
+                      />,
+                    ]
+              }
+            >
+              <Space>
+                <Typography.Text
+                  type="secondary"
+                  style={{ whiteSpace: "nowrap" }}
+                >
+                  {i + 1}.
+                </Typography.Text>
+                {refLabel(ref)}
+              </Space>
+            </List.Item>
+          )}
+        />
+      )}
+      {!disabled && value.length < max && (
+        <ChannelRefPicker
+          value={null}
+          exclude={[...exclude, ...value.map((r) => r.id)]}
+          type={type}
+          placeholder={intl.formatMessage({ id: "channel.links.add" })}
+          onChange={(ref) => ref && onChange([...value, ref])}
+        />
+      )}
+      {disabled && value.length === 0 && (
+        <Typography.Text type="secondary">
+          {intl.formatMessage({ id: "channel.links.empty" })}
+        </Typography.Text>
+      )}
+    </Space>
+  );
+};
+
+interface IWidget {
+  channelId?: string;
+}
+
+const ChannelLinksWidget = ({ channelId }: IWidget) => {
+  const intl = useIntl();
+  const [links, setLinks] = useState<LinksState>();
+  const [channelType, setChannelType] = useState<PickType>();
+  const [saving, setSaving] = useState(false);
+
+  useEffect(() => {
+    if (!channelId) {
+      return;
+    }
+    Promise.all([fetchChannelLinks(channelId), fetchChannel(channelId)]).then(
+      ([data, channel]) => {
+        // channels.type 的取值与列表的 type 过滤参数是同一组(IndexChannelRequest::TYPES)
+        setChannelType(channel?.type as PickType | undefined);
+        if (data) {
+          setLinks(toState(data));
+        }
+      },
+    );
+  }, [channelId]);
+
+  if (!channelId || !links) {
+    return <Skeleton active />;
+  }
+
+  const readonly = !links.can_update;
+  const termSourceApplies = channelType === "translation";
+  const self = [channelId];
+  const set = (patch: Partial<LinksState>) => setLinks({ ...links, ...patch });
+  const label = (key: string) =>
+    intl.formatMessage({ id: `channel.links.${key}` });
+
+  const save = async () => {
+    setSaving(true);
+    try {
+      const saved = await updateChannelLinks(channelId, {
+        derived_from: links.derived_from?.id ?? null,
+        wbw: links.wbw?.id ?? null,
+        fallback: links.fallback.map((r) => r.id),
+        // 术语路径只对 translation channel 有效:别的类型不显示、也不提交,已有的数据不动
+        ...(termSourceApplies
+          ? { term_source: links.term_source.map((r) => r.id) }
+          : {}),
+      });
+      if (saved) {
+        setLinks(toState(saved));
+      }
+      message.success(label("saved"));
+    } finally {
+      setSaving(false);
+    }
+  };
+
+  return (
+    <Form layout="vertical" style={{ maxWidth: 640 }}>
+      {readonly && (
+        <Alert
+          type="info"
+          showIcon
+          message={label("readonly")}
+          style={{ marginBottom: 16 }}
+        />
+      )}
+      <Form.Item
+        label={label("derived_from")}
+        tooltip={label("derived_from.tip")}
+      >
+        <ChannelRefPicker
+          value={links.derived_from}
+          exclude={self}
+          allowClear
+          disabled={readonly}
+          placeholder={label("placeholder")}
+          onChange={(ref) => set({ derived_from: ref })}
+        />
+      </Form.Item>
+      <Form.Item label={label("wbw")} tooltip={label("wbw.tip")}>
+        <ChannelRefPicker
+          value={links.wbw}
+          exclude={self}
+          type="wbw"
+          allowClear
+          disabled={readonly}
+          placeholder={label("placeholder")}
+          onChange={(ref) => set({ wbw: ref })}
+        />
+      </Form.Item>
+      <Form.Item label={label("fallback")} tooltip={label("fallback.tip")}>
+        <OrderedChannelList
+          value={links.fallback}
+          max={MAX_FALLBACK}
+          exclude={self}
+          type={channelType}
+          disabled={readonly}
+          onChange={(refs) => set({ fallback: refs })}
+        />
+      </Form.Item>
+      {termSourceApplies && (
+        <Form.Item
+          label={label("term_source")}
+          tooltip={label("term_source.tip")}
+        >
+          <OrderedChannelList
+            value={links.term_source}
+            max={MAX_TERM_SOURCE}
+            exclude={self}
+            type="translation"
+            disabled={readonly}
+            onChange={(refs) => set({ term_source: refs })}
+          />
+        </Form.Item>
+      )}
+      {!readonly && (
+        <Button type="primary" loading={saving} onClick={save}>
+          {intl.formatMessage({ id: "buttons.save" })}
+        </Button>
+      )}
+    </Form>
+  );
+};
+
+export default ChannelLinksWidget;

+ 14 - 0
dashboard-v6/src/locales/en-US.ts

@@ -61,6 +61,20 @@ const items = {
   ...label,
   ...label,
   ...error,
   ...error,
   ...pages,
   ...pages,
+  "channel.links.tab": "Links",
+  "channel.links.derived_from": "Derived from",
+  "channel.links.derived_from.tip": "The channel this one was translated or adapted from. For the record only",
+  "channel.links.wbw": "Bound word-by-word",
+  "channel.links.wbw.tip": "Loaded as the source text by default. Must be a wbw channel",
+  "channel.links.fallback": "Fallback channels",
+  "channel.links.fallback.tip": "Used in this order when a paragraph has no data (up to 3). Same type as this channel only",
+  "channel.links.term_source": "Term sources",
+  "channel.links.term_source.tip": "Terms are looked up in these channels in this order (up to 10). Translation channels only",
+  "channel.links.placeholder": "Search channels by name",
+  "channel.links.add": "Add",
+  "channel.links.readonly": "You are not allowed to change these settings.",
+  "channel.links.saved": "Saved",
+  "channel.links.empty": "Not set",
   ...admin,
   ...admin,
   ...adminStats,
   ...adminStats,
 };
 };

+ 14 - 0
dashboard-v6/src/locales/zh-Hans.ts

@@ -61,6 +61,20 @@ const items = {
   ...label,
   ...label,
   ...error,
   ...error,
   ...pages,
   ...pages,
+  "channel.links.tab": "关联",
+  "channel.links.derived_from": "继承自",
+  "channel.links.derived_from.tip": "这个版本是从哪个版本翻译或改编来的,只做记录",
+  "channel.links.wbw": "捆绑的逐词",
+  "channel.links.wbw.tip": "载入时默认把这个逐词版本当作原文,只能选逐词(wbw)类型",
+  "channel.links.fallback": "降级版本",
+  "channel.links.fallback.tip": "某个段落没有数据时,按顺序改取这些版本(最多 3 个),只能选与本版本类型相同的",
+  "channel.links.term_source": "术语路径",
+  "channel.links.term_source.tip": "按顺序从这些版本取术语(最多 10 个),只能选译文(translation)类型",
+  "channel.links.placeholder": "搜索版本名称",
+  "channel.links.add": "添加",
+  "channel.links.readonly": "你没有权限修改这些设置。",
+  "channel.links.saved": "已保存",
+  "channel.links.empty": "未设置",
   ...admin,
   ...admin,
   ...adminStats,
   ...adminStats,
 };
 };

+ 14 - 0
dashboard-v6/src/locales/zh-Hant.ts

@@ -61,6 +61,20 @@ const items = {
   ...label,
   ...label,
   ...error,
   ...error,
   ...pages,
   ...pages,
+  "channel.links.tab": "關聯",
+  "channel.links.derived_from": "繼承自",
+  "channel.links.derived_from.tip": "這個版本是從哪個版本翻譯或改編來的,只做記錄",
+  "channel.links.wbw": "綁定的逐詞",
+  "channel.links.wbw.tip": "載入時預設把這個逐詞版本當作原文,只能選逐詞(wbw)類型",
+  "channel.links.fallback": "降級版本",
+  "channel.links.fallback.tip": "某個段落沒有資料時,按順序改取這些版本(最多 3 個),只能選與本版本類型相同的",
+  "channel.links.term_source": "術語路徑",
+  "channel.links.term_source.tip": "按順序從這些版本取術語(最多 10 個),只能選譯文(translation)類型",
+  "channel.links.placeholder": "搜尋版本名稱",
+  "channel.links.add": "新增",
+  "channel.links.readonly": "你沒有權限修改這些設定。",
+  "channel.links.saved": "已儲存",
+  "channel.links.empty": "未設定",
   ...admin,
   ...admin,
   ...adminStats,
   ...adminStats,
 };
 };

+ 6 - 0
dashboard-v6/src/pages/workspace/channel/setting.tsx

@@ -7,6 +7,7 @@ import { Button, Card, Tabs } from "antd";
 import ShareModal from "../../../components/share/ShareModal";
 import ShareModal from "../../../components/share/ShareModal";
 
 
 import Edit from "../../../components/channel/Edit";
 import Edit from "../../../components/channel/Edit";
+import ChannelLinks from "../../../components/channel/ChannelLinks";
 import WebhookList from "../../../components/webhook/WebhookList";
 import WebhookList from "../../../components/webhook/WebhookList";
 import WebhookEdit from "../../../components/webhook/WebhookEdit";
 import WebhookEdit from "../../../components/webhook/WebhookEdit";
 import { EResType } from "../../../components/share/utils";
 import { EResType } from "../../../components/share/utils";
@@ -61,6 +62,11 @@ const Widget = () => {
                 />
                 />
               ),
               ),
             },
             },
+            {
+              label: intl.formatMessage({ id: "channel.links.tab" }),
+              key: "links",
+              children: <ChannelLinks channelId={channelId} />,
+            },
             {
             {
               label: `Webhooks`,
               label: `Webhooks`,
               key: "webhooks",
               key: "webhooks",

+ 2 - 0
openapi/public/assets/protocol/main.yaml

@@ -715,6 +715,8 @@ paths:
     $ref: ./resources/auto/v3-channels-editable.yaml
     $ref: ./resources/auto/v3-channels-editable.yaml
   '/v3/channels/{channel}':
   '/v3/channels/{channel}':
     $ref: ./resources/auto/v3-channels-channel.yaml
     $ref: ./resources/auto/v3-channels-channel.yaml
+  '/v3/channels/{channel}/links':
+    $ref: ./resources/auto/v3-channels-channel-links.yaml
   /v3/credit-policy:
   /v3/credit-policy:
     $ref: ./resources/auto/v3-credit-policy.yaml
     $ref: ./resources/auto/v3-credit-policy.yaml
   /v3/discussions:
   /v3/discussions:

+ 177 - 0
openapi/public/assets/protocol/resources/auto/v3-channels-channel-links.yaml

@@ -0,0 +1,177 @@
+# 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-channels-channel-links.yaml
+get:
+  summary: 'channel 的关系设置'
+  tags:
+    - channels
+  operationId: get_api_v3_channels_channel_links
+  description: |-
+    能读这个 channel 的人都能看。指向的 channel 已删除、或查看者看不见的,不出现在结果里。
+    `can_update` 表示查看者能不能改。
+
+    实现:`V3\ChannelLinkController@show`
+  security:
+    - {  }
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: channel
+      in: path
+      required: true
+      schema:
+        type: string
+      description: 'channel uid'
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: object
+                properties:
+                  channel_id:
+                    type: string
+                  derived_from:
+                    type: object
+                    properties:
+                      id: { type: string }
+                      name: { type: string }
+                      type: { type: string }
+                      lang: { type: string }
+                      status: { type: integer }
+                    nullable: true
+                  wbw:
+                    type: object
+                    properties:
+                      id: { type: string }
+                      name: { type: string }
+                      type: { type: string }
+                      lang: { type: string }
+                      status: { type: integer }
+                    nullable: true
+                  fallback:
+                    type: array
+                    items:
+                      type: object
+                      properties: { id: { type: string }, name: { type: string }, type: { type: string }, lang: { type: string }, status: { type: integer } }
+                  term_source:
+                    type: array
+                    items:
+                      type: object
+                      properties: { id: { type: string }, name: { type: string }, type: { type: string }, lang: { type: string }, status: { type: integer } }
+                  can_update:
+                    type: boolean
+    403:
+      description: '私有 channel,且看不见'
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'
+patch:
+  summary: '改 channel 的关系设置'
+  tags:
+    - channels
+  operationId: patch_api_v3_channels_channel_links
+  description: |-
+    传了哪个键就整体替换哪一种关系,没传的不动;单值传 null 清掉,列表传 [] 清空。
+    能改 channel 信息的人才能改(拥有者、团队 owner / manager / editor、共享权限 ≥30)。AI 模型不能改。
+    目标必须是你看得见的 channel,且不能是自己。降级版本必须与本 channel 同类型;
+    术语路径只有 translation channel 能设,目标也只能是 translation(传 [] 清空总是允许)。
+
+    实现:`V3\ChannelLinkController@update`
+  security:
+    -
+      bearerAuth: []
+  parameters:
+    -
+      name: channel
+      in: path
+      required: true
+      schema:
+        type: string
+      description: 'channel uid'
+  requestBody:
+    required: false
+    content:
+      application/json:
+        schema:
+          type: object
+          properties:
+            derived_from:
+              type: string
+              nullable: true
+              description: '继承自哪个 channel(如英文版译自中文版),只记录'
+            wbw:
+              type: string
+              nullable: true
+              description: '捆绑的逐词 channel,必须是 wbw 类型;载入时当原文'
+            fallback:
+              type: array
+              description: '降级 channel,有序,最多 3 个,须与本 channel 同类型;段落没有数据时由客户端改取'
+              items:
+                type: string
+                description: 'channel uid'
+            term_source:
+              type: array
+              description: '术语路径,有序,最多 10 个,只能是 translation;只有 translation channel 能设'
+              items:
+                type: string
+                description: 'channel uid'
+  responses:
+    200:
+      description: 成功
+      content:
+        application/json:
+          schema:
+            type: object
+            properties:
+              data:
+                type: object
+                properties:
+                  channel_id:
+                    type: string
+                  derived_from:
+                    type: object
+                    properties:
+                      id: { type: string }
+                      name: { type: string }
+                      type: { type: string }
+                      lang: { type: string }
+                      status: { type: integer }
+                    nullable: true
+                  wbw:
+                    type: object
+                    properties:
+                      id: { type: string }
+                      name: { type: string }
+                      type: { type: string }
+                      lang: { type: string }
+                      status: { type: integer }
+                    nullable: true
+                  fallback:
+                    type: array
+                    items:
+                      type: object
+                      properties: { id: { type: string }, name: { type: string }, type: { type: string }, lang: { type: string }, status: { type: integer } }
+                  term_source:
+                    type: array
+                    items:
+                      type: object
+                      properties: { id: { type: string }, name: { type: string }, type: { type: string }, lang: { type: string }, status: { type: integer } }
+                  can_update:
+                    type: boolean
+    401:
+      $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
+    403:
+      description: 不能修改
+      content:
+        application/problem+json:
+          schema:
+            $ref: '../../main.yaml#/components/schemas/ProblemDetails'
+    422:
+      $ref: '../../main.yaml#/components/responses/ProblemValidation'

Vissa filer visades inte eftersom för många filer har ändrats