Skip to content

Support external $refs in openapi schema #11

@markfejes

Description

@markfejes

In larger projects the openapi schema file is usually divided to more parts, but currently it's not handled in this package, which casues an ajv compilation error if there is any external $ref.

main.yml

components:
  schemas:
    UserList:
      type: array
      items:
        $ref: './user.yaml#/definitions/User'

user.yml

definitions:
  User:
    type: object
    properties:
      id:
        type: string
      name:
        type: string
    required: ['id']

Currently the external refs are not handled in @openapi-contrib/openapi-schema-to-json-schema https://github.com/openapi-contrib/openapi-schema-to-json-schema#features

NOTE: $refs are not handled in any way, so please use a resolver such as json-ref-resolver prior to using this package.

I've created a pull request which uses @apidevtools/json-schema-ref-parser to process external $refs.

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