Skip to content

Is it possible to reference the servers object from another OpenAPI file? #1527

@iappa1

Description

@iappa1

I'm documenting a list of APIs using OpenAPI 3.0 and a separate YAML file for each API.

All APIs use the same target server, so currently I have the following in each API definition:
`

  servers:
      - url: www.abc.com   
        description: "Production Server" 

`
But I don't want to repeat the servers in all API definitions. Instead, I would like to reference the servers from a single file, like so:

`

    //sample.yaml
     ...
    servers:
    $ref: 'index.yaml#/servers'

`

But Swagger UI shows the "Could not render this component" error.

Is it possible to $ref the servers in OpenAPI 3.0 definitions?

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