Recommended

oas3-api-servers


Formats: Severity:

When configuring Servers in OpenAPI, its important to ensure correctness, so tooling can inspect endpoints automatically.

Mis-configured server configurations will damage automation capabilities for the contract.

What is this rule checking for?

  • Server definitions exist
  • Contains URL
  • URL is valid
  • URL does not contain a trailing slash

Why did this violation appear?

The servers object is missing from the spec, or one of more entries contain an invalid URL.

Bad example

servers:
  - url: "I am not a URL"
  - url: "httpWRONG//i-am-not-valid"
  - url: "https://i-end-with-a-slash.com/"

How do I fix this violation?

Make sure there are servers definitions and that all the URLs are correct.

Spectral Equivalent

The rule is equivalent to oas3-api-servers