Skip to content

Supporting x-oas-draft-alternate-schema  #482

@philsturgeon

Description

@philsturgeon

So, the folks at OpenAPI are attempting to solve the OpenAPI Schema Object <> JSON Schema Object problem with alternate schemas.

This approach can allow vendors to chose which formats from a predefined list they chose to support:

openapi: 3.0.2
info:
  title: A sample using real JSON Schema and xsd
  version: 1.0.0
paths:
  /cat:
    get:
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                type: object
              x-oas-draft-alternateSchemas:
                - type: json-schema
                  externalValue: ./cat-schema-draft-08.json
                - type: json-schema
                  externalValue: ./cat-schema-draft-05.json
                - type: json-content-rules
                  externalValue: ./cat-JCRschema.json
            application/xml:
              x-oas-draft-alternateSchemas:
                - type: xml-schema
                  externalValue: ./cat-schema.xsd
                - type: relax-ng
                  externalValue: ./cat-schema.ng
                - type: schematron
                  externalValue: ./cat-schema.st

Folks would not need to support everything, but allow their tooling to be suplimented and extended. Of course supporting JSON Schema would be a default expectation for many, and XML Schema might be nice to chuck in their too.

Check out the OpenAPI issue for more information, but we should start supporting this like its a feature, and give them any feedback with stuff that goes wrong.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions