servers-defined

Since 0.0.1 · In the rulesets: Recommended at warning, Strict at error, All at error

This rule checks that the document has at least one server.

Rule details

The servers are where the API is: without them, documentation cannot offer a “try it” call, a generated client has no default base URL, and apigenie-server cannot take the base path from the document.

The rule reports No servers defined on the document.

Examples

Good.

servers:
  - url: https://api.dev.example.com/v1
    description: Development server

Bad. A document without servers.

openapi: 3.1.0
info:
  title: Example API
  version: 1.0.0
paths: {}

Turn it off or change its severity

In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.rules has the details.

commands:
  lint:
    rules:
      servers-defined: off
Was this helpful?