# openapi

> A committed OpenAPI document that passes its lint rules and matches what its generator writes.

A committed OpenAPI document that passes its lint rules and matches what its generator writes.

## Checks

| Check                                                                 | Stage    | Level         | What it does                                                          |
| --------------------------------------------------------------------- | -------- | ------------- | --------------------------------------------------------------------- |
| [`openapi/spectral`](/reference/checks/openapi/spectral/)             | `commit` | `recommended` | Lints the file in `openapi.document` with the Spectral OpenAPI rules. |
| [`openapi/stale-document`](/reference/checks/openapi/stale-document/) | `push`   | `recommended` | Runs `openapi.generate_command` and fails when the document changes.  |

## Settings

| Setting                                                                       | What it sets                                                                                                                                       |
| ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`openapi.document`](/reference/gspot-toml/#openapi.document)                 | The committed OpenAPI document, relative to the repository root, which init fills in when it finds one; without it, the OpenAPI checks do not run. |
| [`openapi.generate_command`](/reference/gspot-toml/#openapi.generate_command) | The command that writes the OpenAPI document from the code, run in the project scope folder.                                                       |

## Selected when

gspot selects it in a scope with filenames `openapi.yaml`, `openapi.yml`, `openapi.json`, `swagger.json`, `swagger.yaml`.

## Rules for coding agents

| Rule file                                                       | Installed when |
| --------------------------------------------------------------- | -------------- |
| `.gspot/configurations/infrastructure/openapi/rules/OPENAPI.md` | Always         |

## Tools and versions

| Tool     | Version  |
| -------- | -------- |
| spectral | `6.15.0` |
| ajv      | `8.20.0` |

## Files gspot writes

gspot writes `.gspot/configurations/infrastructure/openapi/spectral.yml`.
