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
Option | Type | Description |
---|---|---|
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
- Configure the mock server.
- Control which extensions are included in your API reference documentation with the showExtensions configuration setting.
- See all openapi configuration settings.
- See a full list of supported OpenAPI extensions.