Skip to content

Yaml Anchor Support #746

@alteredtech

Description

@alteredtech

Question

Currently working on a project to refine and improve our api doc. Part of this is reducing repeated segments. Mostly error responses.
I have a test project that use for toy problems to make it more simple in experimenting changes and workflows.
For the pet store, I am converting the returned errors to use yaml anchors. An OpenAPI linter, and the swagger editor does not throw errors with the yaml anchors.

        '400': &400Error
          description: Bad Request Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404': &404Error
          description: Not found Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422': &422Error
          description: Validation exception
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500': &500Error
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502': &502Error
          description: Bad Gateway Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'

to allow

        '400': *400Error
        '404': *404Error
        '422': *422Error
        '500': *500Error
        '502': *502Error

Rather, I get the following in the console when trying to build the project.

Response could not be decoded because:
Inconsistency encountered when parsing `Vendor Extension`: Found at least one vendor extension property that does not begin with the required 'x-' prefix. Invalid properties: [ yamlAnchor ]..

I do not see any mention on the docs about yaml anchors being support or not or in any capacity. Is there any plan to allow yaml anchors that are not vendor extensions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/supportAdopter support requests.status/triageCollecting information required to triage the issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions