Quickstart
In this guide, you’ll learn how to run your first SpecGate check using a sample OpenAPI specification (OAS) file.
Before you begin
Make sure you have completed the installation steps.
Step 1: Download the sample OAS file
The SpecGate GitHub repository includes a sample OAS file with documentation gaps you can use to explore the CLI.
Step 2: Generate a config file
SpecGate’s behavior is controlled by a .specgate.yaml file. To learn more about .specgate.yaml, see Configuration.
To generate a config file, run specgate init. This creates the config file in the project root.
Step 3: Run your first check
Run the check command against the sample spec:
specgate check example/oas.jsonYou should see output like this:
Loaded config from .specgate.yaml ✅
example/oas.json - 9 errors, 3 warningsErrors must be resolved before the spec is considered production-ready. Warnings indicate documentation gaps that reduce spec quality but do not block the check.
.specgate.log file. See specgate check for more information.Step 4: Try strict mode
Run the check again with the --strict flag to treat warnings as errors:
specgate check example/oas.json --strictYou should see all issues reported as errors:
Loaded config from .specgate.yaml ✅
example/oas.json - 12 errorsStep 5: See a detailed SpecGate report
If you’d like to see which errors and warnings SpecGate found, you can run the check with the --verbose flag:
specgate check example/oas.json --verbose
Loaded config from .specgate.yaml ✅
example/oas.json - 9 errors, 3 warnings
error Missing operation summary GET /menu/{itemId}
error Missing error responses (4xx/5xx/default) POST /orders
error Missing error responses (4xx/5xx/default) GET /loyalty/{customerId}
error Missing error responses (4xx/5xx/default) POST /loyalty/{customerId}
error Missing error responses (4xx/5xx/default) GET /menu
error Missing parameter description GET /menu/{itemId}
error Missing parameter description GET /orders/{orderId}
error Missing parameter description GET /loyalty/{customerId}
error Missing parameter description POST /loyalty/{customerId}
warning Missing operation description GET /menu/{itemId}
warning Missing operation description GET /loyalty/{customerId}
warning Missing operation description POST /loyalty/{customerId}
Run with --strict to treat warnings as errors.Step 6: Get LLM-powered suggestions
Run the advise command to generate suggested summaries and descriptions for operations that are missing them.
advise command requires an OpenAI API key. Set the OPENAI_API_KEY environment variable before running this command. See specgate advise for more information.specgate advise example/oas.jsonNext steps
- Review the CLI reference for full command documentation
- Run
specgate rulesto see the full list of rules SpecGate enforces