Last updated

OpenAPI extension: x-servers

Compatibility warning

These specification extensions are supported only in OpenAPI 2.0. For OpenAPI 3.0 and later, use the servers section.

Use x-servers in your OpenAPI 2.0 documents to define one or more target hosts for the API.

This specification extension provides compatibility via backporting from the OpenAPI 3.0 servers object. It doesn't support templates.

Location

Use the x-servers extension in the root OpenAPI object.

Options

OptionTypeDescription
x-servers[ Server Object ]A list of server objects used to add one or more target hosts for the API.

Examples

The following example show how to adds development and staging hosts to OpenAPi description.

swagger: '2.0'
x-servers:
  - url: https://development.example.com/v1
    description: Development server
  - url: https://staging.example.com/v1
    description: Staging server

Resources