Diagnostics and quick fixes
How OpenAPI Guard reports contract drift in VS Code and the quick fixes that resolve it.
Documentation pages
Diagnostics
OpenAPI Guard analyzes the workspace in the background after every edit (saved or not), file change, and settings change, and reports three rules:
| Rule | Reported on | Meaning |
|---|---|---|
missing-implementation |
The contract operation | No controller serves the operation. |
undocumented-implementation |
The controller mapping | The contract does not describe the endpoint. |
http-method-mismatch |
Both sides, linked | The path matches but the HTTP method differs. |
Paths match regardless of path-variable names ({id} and {petId} are the same
route), after aligning the contract’s servers base path with Spring’s servlet
context path.
OpenAPI Guard never guesses. When a mapping’s path cannot be worked out (for example
it is computed at run time, or an AWS Lambda handler passes routeKey to a custom
router), the operations it could serve are not reported missing. An
analysis-limitation information diagnostic marks the place instead; set its
severity, or turn it off, with ruleSeverity.
Quick fixes
Put the cursor on a diagnostic and press Ctrl+. (Cmd+. on macOS).
- Add the endpoint to the contract (undocumented endpoint): adds the operation to
each YAML specification that covers the controller, with its path parameters, the
handler name as
operationId, and a200response to fill in. - Implement the operation (missing implementation): adds a handler stub to the controller whose base path matches the operation best. If that controller takes its mappings from an API interface or abstract base class, the mapped declaration goes there and the controller gets an override, following the project’s pattern.
- Change the operation’s method (mismatch, on the contract) or change the mapping’s method (mismatch, on the code). When the mapping is inherited, it is changed in the interface or base class, where Spring reads it.
Quick fixes never edit generated code (such as openapi-generator output under
build/ or target/), which the next build would overwrite. A controller whose
mappings come from a generated interface gets no Implement fix: regenerate the
interface from the contract instead.
Severity
All rules are warnings by default. Change them together with
stackblender.openApiGuard.severity, or one by one with
stackblender.openApiGuard.ruleSeverity (including off). See Settings.

