To introduce API Genie formatter, to show how it helps to maintain consistent schemas.
API specs are contracts between multiple parties, and therefore it is natural that many people work on them. But this makes the problem of inconsistent more pronounced.
Imagine a large organization that develops APIs. The more people, the larger is the probabiluty that they want to write OpenAPI specs differently. This will lead to debates and discussions. Are they helpful ? Mostly, no.
YAML allows 3 ways of quoting strings, and 3 ways of formatting multi-line strings. In no practical case we need more than one of each in your organization.
Hence, API Genie tries to eliminate the (false) problem of choosing the “right” quoting mechanism.
For most situations API Genie formatter uses reasonable settings. For those situations where different settings are equally sensible, it exposes an option.
The easiest way to run the formatter:
apigenie format openapi.yaml
this will use the recommended settings, and will write the modified schema to.
apigenie lint openapi.yaml
apigenie lint --config apigenie-config.yaml openapi.yaml
apigenie lint --config apigenie-config.yaml --fix openapi.yaml
Why do we need another linter ?