Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

37.6 KB
Raw Blame
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.

---

paths:
  # Domain visibility and member access follow the current caller permissions.
  /metalakes/{metalake}/domains:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
    get:
      tags: [domain]
      summary: List domains
      operationId: listDomains
      description: >-
        List all visible top-level domains and subdomains in this metalake. Names are unique across both levels and are literal strings, not hierarchy paths. Published domains require USE_DOMAIN; drafts require MANAGE_DOMAIN or inherited ownership. Hidden drafts return 404 and are omitted from lists.
      parameters:
        - name: details
          in: query
          description: Return domain snapshots instead of names.
          schema:
            type: boolean
            default: false
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/DomainNameListResponse"
                  - $ref: "#/components/schemas/DomainListResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake does not exist.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is not in use.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"
    post:
      tags: [domain]
      summary: Create a domain
      operationId: createDomain
      description: >-
        Creates a DRAFT domain, its optional parent edge and an optional new backing tag atomically. A failure leaves no new domain or tag behind. Requires MANAGE_DOMAIN on the metalake and, when specified, the parent. The backing tag must be explicit: create=true creates a new valueless tag and never adopts an existing tag; create=false binds an existing tag whatever values it allows. Bindings use tag identity, so tag rename preserves a binding while delete/recreate does not. A tag backs at most one domain. Membership depends only on the presence of the tag; any value on an assignment is ignored. A new tag additionally requires CREATE_TAG on the metalake; an existing tag requires ownership of that tag or the metalake. Hidden drafts return 404; other permission failures return 403.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DomainCreateRequest"
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake, requested parent domain, or existing backing tag to bind does not exist, or the requested parent is a hidden draft.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is disabled, the domain or new tag name already exists, or the backing-tag binding conflicts.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "415":
          $ref: "#/components/responses/UnsupportedMediaTypeResponse"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"

  /metalakes/{metalake}/domains/{domain}:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - $ref: "#/components/parameters/domain"
    get:
      tags: [domain]
      summary: Get a domain
      operationId: getDomain
      description: >-
        Get a domain. MANAGE_DOMAIN includes USE_DOMAIN. Owners of the domain, its current parent or the metalake bypass privilege denies. Published domains require USE_DOMAIN; drafts require MANAGE_DOMAIN or inherited ownership. Hidden drafts return 404 and are omitted from lists.
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake or domain does not exist, or the requested domain is a hidden draft.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is not in use.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"
    put:
      tags: [domain]
      summary: Alter a domain
      operationId: alterDomain
      description: >-
        Alter name, comment or properties and return a fresh snapshot. A rename preserves the backing tag and hierarchy. Old SDK snapshots remain unchanged and address future operations by their old name. Requires MANAGE_DOMAIN or ownership of the domain, its current parent, or the metalake.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DomainUpdatesRequest"
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake or domain does not exist, or the requested domain is a hidden draft.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is disabled, the new domain name already exists, or the alteration conflicts with a concurrent update.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "415":
          $ref: "#/components/responses/UnsupportedMediaTypeResponse"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"
    patch:
      tags: [domain]
      summary: Publish or unpublish a domain
      operationId: setDomainStatus
      description: >-
        Sets the domain status and returns its snapshot. Publishing requires a published parent; unpublishing requires no published subdomains. Setting the current status is a no-op. Requires MANAGE_DOMAIN on the domain, inherited from its current parent or the metalake. Hidden drafts return 404; other permission failures return 403.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DomainSetRequest"
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake or domain does not exist, or the requested domain is a hidden draft.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is disabled.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "415":
          $ref: "#/components/responses/UnsupportedMediaTypeResponse"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"
    delete:
      tags: [domain]
      summary: Delete a domain
      operationId: deleteDomain
      description: >-
        Deletes only the domain and its parent edge. Only a draft domain can be deleted: deleting a
        published domain fails with HTTP 400 and IllegalArgumentException; unpublish it first. The
        backing tag, its assignments and member metadata objects remain unchanged; member objects
        do not prevent deletion. Deletion does not cascade to subdomains: a draft domain with
        subdomains fails with HTTP 409, NonEmptyDomainException and error code 1005. The status is checked
        before the subdomains, so a published domain with subdomains fails with HTTP 400. Returns dropped=false if the domain is absent
        or is a draft hidden from the caller; a hidden draft is not deleted.
        Requires MANAGE_DOMAIN on the domain, inherited from its current parent or the metalake.
        Other permission failures return 403.
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainDropResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake does not exist. An absent domain or hidden draft returns HTTP 200 with dropped=false.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is disabled, the domain is a draft with subdomains, or the deletion conflicts with a concurrent update.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"

  /metalakes/{metalake}/domains/{domain}/parent:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - $ref: "#/components/parameters/domain"
    put:
      tags: [domain]
      summary: Attach or move a domain
      operationId: setDomainParent
      description: >-
        Attaches the child addressed by this path under a top-level parent, replacing its current parent. The backing tag and member assignments are unchanged; inherited permissions and membership roll-ups follow the new parent. The destination must be top-level, not this domain, and published if the child is published. A domain with children cannot be attached. Requires MANAGE_DOMAIN on both the domain and the new parent, inherited from their current scopes. Hidden drafts return 404; other permission failures return 403.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DomainParentSetRequest"
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake, domain, or requested parent domain does not exist, or the domain or requested parent is a hidden draft.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is disabled.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "415":
          $ref: "#/components/responses/UnsupportedMediaTypeResponse"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"
    delete:
      tags: [domain]
      summary: Detach a domain
      operationId: removeDomainParent
      description: >-
        Removes the current parent edge and returns the child snapshot. A top-level domain is unchanged. The backing tag is unchanged. Requires MANAGE_DOMAIN on the domain, inherited from its current parent or the metalake. Hidden drafts return 404; other permission failures return 403.
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake or domain does not exist, or the requested domain is a hidden draft.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is disabled.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"

  /metalakes/{metalake}/domains/{domain}/backingTag:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - $ref: "#/components/parameters/domain"
    put:
      tags: [domain]
      summary: Set or remove the backing tag
      operationId: setDomainBackingTag
      description: >-
        Binds an existing tag by name, whatever values it allows, or removes the binding when backingTag is null. A tag backs at most one domain. Members are not migrated; previous tag assignments remain unchanged. Requires MANAGE_DOMAIN on the domain, inherited from its current parent or the metalake. Binding a tag additionally requires ownership of that tag or the metalake; removing a binding needs no tag privilege. Hidden drafts return 404; other permission failures return 403.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DomainBackingTagSetRequest"
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake, domain, or supplied backing tag does not exist, or the requested domain is a hidden draft.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is disabled or the backing-tag binding conflicts.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "415":
          $ref: "#/components/responses/UnsupportedMediaTypeResponse"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"

  /metalakes/{metalake}/domains/{domain}/subdomains:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - $ref: "#/components/parameters/domain"
    get:
      tags: [domain]
      summary: List subdomains
      operationId: listSubdomains
      description: >-
        List subdomains. Published domains require USE_DOMAIN; drafts require MANAGE_DOMAIN or inherited ownership. Hidden drafts return 404 and are omitted from lists.
      parameters:
        - name: details
          in: query
          description: Return domain snapshots instead of names.
          schema:
            type: boolean
            default: false
      responses:
        "200":
          description: Successful domain operation.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/DomainNameListResponse"
                  - $ref: "#/components/schemas/DomainListResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake or domain does not exist, or the requested domain is a hidden draft.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is not in use.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"

  /metalakes/{metalake}/domains/{domain}/objects:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - $ref: "#/components/parameters/domain"
    get:
      tags: [domain]
      summary: List domain members
      operationId: listDomainMembers
      description: >-
        Lists members in the domain's scope, including subdomains, once each with all applicable
        relations. By default, lists the objects that directly carry the backing tag of the domain
        or a visible subdomain, including catalogs and schemas. Directly tagged descendants appear
        even when their container matches. Relations are DIRECT or VIA_SUBDOMAIN. With
        expand=true, tagged catalogs and schemas expand to the recorded leaves that inherit the tag,
        with INHERITED relations where they apply; an empty result does not imply that unrecorded
        external objects are not members. Filters intersect.
        No paging or counts are provided. Only visible domains and objects accessible to the caller are returned. Hidden drafts return 404, and hidden subdomain relations are omitted. No tag privilege is required.
      parameters:
        - name: domains
          in: query
          description: >-
            Repeated domain names selecting the union of their scopes. Omit to select the whole
            scope. Selecting the listed domain also selects its subdomains. Well-formed names outside the visible scope are
            ignored. If none match, the result is empty. Invalid domain names return 400.
            Relations are reported relative to the domain in the path.
          style: form
          explode: true
          schema:
            type: array
            items:
              $ref: "#/components/schemas/DomainName"
        - name: types
          in: query
          description: Comma-separated member types, case-insensitive, with whitespace around each token trimmed. Omit to include all types. Blank tokens, unsupported types, and CATALOG or SCHEMA with expand=true return 400.
          style: form
          explode: false
          schema:
            type: array
            items:
              $ref: "#/components/schemas/ListedMemberType"
        - name: nameContains
          in: query
          description: Nonblank substring of the member's complete full name, matched case-insensitively; no wildcard or regex interpretation. Omit for any name. Blank text returns 400.
          schema:
            type: string
            minLength: 1
        - name: expand
          in: query
          description: Whether to expand tagged catalogs and schemas into the recorded leaves under them that inherit the backing tag. Defaults to false, which lists the objects that carry the backing tag themselves.
          schema:
            type: boolean
            default: false
      responses:
        "200":
          description: The matching members.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                $ref: "#/components/schemas/DomainMemberListResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake or domain does not exist.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is not in use.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"

  /metalakes/{metalake}/objects/{type}/{fullName}/domains:
    parameters:
      - $ref: "./openapi.yaml#/components/parameters/metalake"
      - name: type
        in: path
        required: true
        description: Leaf metadata object type, case-insensitive. Catalogs and schemas are not supported for object-to-domain lookup.
        schema:
          $ref: "#/components/schemas/MemberType"
      - name: fullName
        in: path
        required: true
        description: Full name of the leaf metadata object, encoded as one path segment.
        schema:
          type: string
    get:
      tags: [domain]
      summary: List domains containing a metadata object
      operationId: listDomainsForMetadataObject
      description: >-
        Lists domains whose scopes contain the leaf object, including parents of directly matched
        subdomains. Detailed responses carry every applicable relation without precedence.
        The leaf must exist and be accessible; an inaccessible leaf returns 403. Only visible domains are returned; hidden subdomains contribute no roll-up relations. No tag privilege is required. No paging or counts are provided.
      parameters:
        - name: details
          in: query
          description: Return domain snapshots with relations instead of names.
          schema:
            type: boolean
            default: false
      responses:
        "200":
          description: Domain names, or snapshots when details is true.
          content:
            application/vnd.gravitino.v1+json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/DomainNameListResponse"
                  - $ref: "#/components/schemas/DomainListResponse"
        "400":
          $ref: "#/components/responses/BadRequestResponse"
        "403":
          description: The caller lacks the required domain, object or backing-tag permission.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "404":
          description: The metalake or metadata object does not exist.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "409":
          description: The metalake is not in use.
          content:
            application/json:
              schema:
                $ref: "./openapi.yaml#/components/schemas/ErrorModel"
        "5XX":
          $ref: "#/components/responses/ServerErrorResponse"

components:
  responses:
    UnsupportedMediaTypeResponse:
      description: The request Content-Type is not supported by this operation.
      content:
        application/json:
          schema:
            $ref: "./openapi.yaml#/components/schemas/ErrorModel"
          example:
            code: 1000
            type: RESTException
            message: HTTP 415 Unsupported Media Type
    BadRequestResponse:
      description: Invalid JSON or domain request parameters.
      content:
        application/json:
          schema:
            $ref: "./openapi.yaml#/components/schemas/ErrorModel"
    ServerErrorResponse:
      description: The server could not complete the domain operation.
      content:
        application/json:
          schema:
            $ref: "./openapi.yaml#/components/schemas/ErrorModel"
  parameters:
    domain:
      name: domain
      in: path
      required: true
      schema:
        $ref: "#/components/schemas/DomainName"
  schemas:
    DomainNameListResponse:
      allOf:
        - $ref: "./openapi.yaml#/components/schemas/NameListResponse"
        - type: object
          required: [names]
          properties:
            names:
              type: array
              items:
                $ref: "#/components/schemas/DomainName"

    MemberType:
      type: string
      description: A supported leaf domain member type.
      enum: [TABLE, VIEW, FILESET, TOPIC, MODEL, SEMANTIC_MODEL]

    ListedMemberType:
      type: string
      description: A type of listed domain member. CATALOG and SCHEMA are listed only without expand.
      enum: [CATALOG, SCHEMA, TABLE, VIEW, FILESET, TOPIC, MODEL, SEMANTIC_MODEL]

    DomainRelation:
      type: object
      description: One applicable membership relation relative to the queried domain, with no precedence over other relations. All applicable relations are returned; a direct assignment masks inheritance of the same tag.
      required: [relation]
      properties:
        relation:
          type: string
          enum: [direct, inherited, via_subdomain]
        source:
          description: >-
            Omitted for DIRECT; the nearest tagged catalog or schema for INHERITED;
            the subdomain metadata object for VIA_SUBDOMAIN. Sources carry the complete fullName and type. A hidden subdomain contributes no relation; an inherited source is retained for an accessible leaf without a separate source access check.
          allOf:
            - $ref: "#/components/schemas/RelationSource"

    RelationSource:
      type: object
      required: [fullName, type]
      properties:
        fullName:
          type: string
        type:
          type: string
          enum: [catalog, schema, domain]

    MemberObject:
      type: object
      description: A member metadata object serialized by the server. Direct listings can include a catalog or schema alongside its directly tagged descendants.
      required: [fullName, type]
      properties:
        fullName:
          type: string
        type:
          type: string
          enum: [catalog, schema, table, view, fileset, topic, model, semantic_model]

    DomainMember:
      type: object
      required: [object, relations]
      properties:
        object:
          $ref: "#/components/schemas/MemberObject"
        relations:
          type: array
          minItems: 1
          items:
            $ref: "#/components/schemas/DomainRelation"

    Domain:
      description: A snapshot of a domain in one metalake. A domain is top-level or a child of one top-level domain.
      type: object
      required: [name, properties, status, audit]
      properties:
        name:
          $ref: "#/components/schemas/DomainName"
        comment:
          type: string
          nullable: true
        properties:
          type: object
          additionalProperties:
            type: string
        status:
          type: string
          enum: [draft, published]
        parent:
          oneOf:
            - $ref: "#/components/schemas/DomainName"
            - type: string
              nullable: true
              enum: [null]
          description: Parent domain name, or null for a top-level domain. A child can name a parent hidden from the caller.
        backingTag:
          type: object
          nullable: true
          required: [name]
          description: Null or omitted when unbound or when the backing tag has been deleted. A renamed tag is returned with its current name; recreating a deleted tag name does not restore the binding.
          properties:
            name:
              type: string
              description: The name of the backing tag. Objects that carry the tag are members whatever values the assignment has.
        audit:
          $ref: "./openapi.yaml#/components/schemas/Audit"
        relations:
          description: Present only on detailed object-to-domain lookup; omitted from ordinary domain snapshots.
          type: array
          minItems: 1
          items:
            $ref: "#/components/schemas/DomainRelation"

    DomainMemberListResponse:
      description: >-
        The example is a default (direct) listing. With expand=true, the schema is replaced by its
        leaves, which report inherited relations.
      example:
        code: 0
        members:
          - object:
              fullName: cat.schema
              type: schema
            relations:
              - relation: direct
          - object:
              fullName: cat.schema.table
              type: table
            relations:
              - relation: via_subdomain
                source:
                  fullName: Finance_US
                  type: domain
      type: object
      required: [code, members]
      properties:
        code:
          type: integer
          enum: [0]
        members:
          type: array
          items:
            $ref: "#/components/schemas/DomainMember"

    DomainListResponse:
      example:
        code: 0
        domains:
          - name: Finance
            properties: {}
            status: published
            audit:
              creator: user
              createTime: "2026-10-01T00:00:00Z"
            relations:
              - relation: direct
      type: object
      required: [code, domains]
      properties:
        code:
          type: integer
          enum: [0]
        domains:
          type: array
          items:
            $ref: "#/components/schemas/Domain"

    DomainResponse:
      example:
        code: 0
        domain:
          name: Finance
          properties: {}
          status: draft
          audit:
            creator: user
            createTime: "2026-10-01T00:00:00Z"
      type: object
      required: [code, domain]
      properties:
        code:
          type: integer
          enum: [0]
        domain:
          $ref: "#/components/schemas/Domain"

    DomainDropResponse:
      type: object
      required: [code, dropped]
      properties:
        code:
          type: integer
          enum: [0]
        dropped:
          type: boolean

    BackingTag:
      type: object
      required: [name]
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
          description: The name of the backing tag.
        create:
          type: boolean
          default: false
          description: True creates a new valueless tag. False binds an existing tag, whatever values it allows.

    DomainName:
      type: string
      minLength: 1
      maxLength: 64
      pattern: '^(?![sS][yY][sS][tT][eE][mM]$)[A-Za-z0-9_][A-Za-z0-9_-]*$'
      description: >-
        Domain names follow catalog naming rules. Use ASCII letters, digits, underscores,
        or hyphens. A hyphen may only appear after the first character. The names "*" and
        "system" (in any letter case) are reserved.

    DomainCreateRequest:
      type: object
      required: [name, backingTag]
      properties:
        name:
          $ref: "#/components/schemas/DomainName"
        comment:
          type: string
          nullable: true
        properties:
          type: object
          nullable: true
          additionalProperties:
            type: string
        parent:
          oneOf:
            - $ref: "#/components/schemas/DomainName"
            - type: string
              nullable: true
              enum: [null]
          description: Optional top-level parent. A subdomain is created atomically under it.
        backingTag:
          $ref: "#/components/schemas/BackingTag"
      example:
        name: Finance
        backingTag:
          name: finance
          create: false

    DomainSetRequest:
      example:
        status: published
      type: object
      required: [status]
      properties:
        status:
          type: string
          pattern: "^([dD][rR][aA][fF][tT]|[pP][uU][bB][lL][iI][sS][hH][eE][dD])$"
          description: Accepts draft or published, case-insensitively; responses use lowercase.
          example: published

    DomainParentSetRequest:
      type: object
      required: [parent]
      properties:
        parent:
          $ref: "#/components/schemas/DomainName"

    DomainBackingTagSetRequest:
      type: object
      required: [backingTag]
      description: The backingTag field must be present. An explicit null removes the current binding; an omitted field is invalid.
      properties:
        backingTag:
          type: object
          nullable: true
          required: [name]
          additionalProperties: false
          properties:
            name:
              type: string
              minLength: 1
              description: The name of the existing tag to bind.

    DomainUpdatesRequest:
      type: object
      required: [updates]
      properties:
        updates:
          type: array
          items:
            $ref: "#/components/schemas/DomainUpdateRequest"

    DomainUpdateRequest:
      oneOf:
        - $ref: "#/components/schemas/RenameDomainRequest"
        - $ref: "#/components/schemas/UpdateDomainCommentRequest"
        - $ref: "#/components/schemas/SetDomainPropertyRequest"
        - $ref: "#/components/schemas/RemoveDomainPropertyRequest"
      discriminator:
        propertyName: "@type"
        mapping:
          rename: "#/components/schemas/RenameDomainRequest"
          updateComment: "#/components/schemas/UpdateDomainCommentRequest"
          setProperty: "#/components/schemas/SetDomainPropertyRequest"
          removeProperty: "#/components/schemas/RemoveDomainPropertyRequest"

    RenameDomainRequest:
      type: object
      required: ["@type", newName]
      properties:
        "@type":
          type: string
          enum: [rename]
        newName:
          $ref: "#/components/schemas/DomainName"

    UpdateDomainCommentRequest:
      type: object
      required: ["@type"]
      properties:
        "@type":
          type: string
          enum: [updateComment]
        newComment:
          type: string
          nullable: true

    SetDomainPropertyRequest:
      type: object
      required: ["@type", property, value]
      properties:
        "@type":
          type: string
          enum: [setProperty]
        property:
          type: string
          minLength: 1
        value:
          type: string

    RemoveDomainPropertyRequest:
      type: object
      required: ["@type", property]
      properties:
        "@type":
          type: string
          enum: [removeProperty]
        property:
          type: string
          minLength: 1