Xemplo.ApiChecker
0.1.1
dotnet tool install --global Xemplo.ApiChecker --version 0.1.1
dotnet new tool-manifest
dotnet tool install --local Xemplo.ApiChecker --version 0.1.1
#tool dotnet:?package=Xemplo.ApiChecker&version=0.1.1
nuke :add-package Xemplo.ApiChecker --version 0.1.1
Xemplo API Checker
Xemplo.ApiChecker is a .NET command-line tool for validating and comparing OpenAPI specifications and reporting compatibility findings using configurable rule severities.
There is nothing more frustrating to the user of your API than to have breaking changes unexpectedly arise. This tool helps to try and combat as many of those as possible.
Currently supports:
- OpenAPI 3.0 and 3.1
- Local and http(s) hosted API spec files
- JSON request/response body comparisons
- Query-parameter comparisons
- Endpoint additions/removals, operationId updates, and new response-code detection
Install
Currently, the easiest way to use it is as a dotnet CLI tool:
dotnet tool install --global Xemplo.ApiChecker
api-checker compare --old <path-or-url> --new <path-or-url>
Or, more simply, using dnx on the published Xemplo.ApiChecker package ID:
dnx Xemplo.ApiChecker compare --old <path-or-url> --new <path-or-url>
Detailed Usage
api-checker compare --old <path-or-url> --new <path-or-url> [--config <path>] [--output text|json] [--rule <rule-id>=<severity> ...]
api-checker validate <path-or-url>
Examples
# Compare local specs using default compatibility rules
api-checker compare --old ./tests/fixtures/request-body-old.json --new ./tests/fixtures/request-body-new.json
# Compare online specs using default compatibility rules and JSON output
api-checker compare --old https://example.com/openapi-old.yaml --new https://example.com/openapi-new.yaml --output json
# Compare sources using a custom set of comparison rules
api-checker compare --old old.json --new new.json --config ci-rules.json --rule endpoint:new=off --rule response:new:status-code=error
# Validate a single spec file or URL without running compatibility checks
api-checker validate https://example.com/openapi.yaml
Rule Configuration
Rule precedence (from lowest to highest) is:
- Built-in defaults
api-rules.jsonin the current working directory- explicit
--config <path> - repeated
--rule <rule-id>=<severity>overrides
Supported severities:
errorwarningoff
Supported rule identifiers:
input:new:required- A new required field has been added to the request bodyinput:new:optional- A new optional field has been added to the request bodyinput:updated:required- An existing property has changed from optional to required in the request bodyinput:updated:optional- An existing property has changed from required to optional in the request bodyoutput:new:nullable- A new nullable field has been added to the response bodyoutput:new:non-nullable- A new non-nullable field has been added to the response bodyoutput:updated:nullable- An existing property has changed from non-nullable to nullable in the response bodyoutput:updated:non-nullable- An existing property has changed from nullable to non-nullable in the response bodyoutput:new:enum-value- An existing enum used in the response body has gained a new valuequery:new:required- A new required query parameter has been addedquery:new:optional- A new optional query parameter has been addedinput:removed- A property in the request body has been removedoutput:removed- A property in the response body has been removedresponse:new:status-code- An endpoint now returns a new HTTP status codeendpoint:new- A new endpoint has been addedendpoint:updated:id- An existing endpoint operationId has changedendpoint:removed- An endpoint has been removed
Example api-rules.json:
{
"rules": {
"input:new:required": "error",
"input:new:optional": "warning",
"input:updated:required": "error",
"input:updated:optional": "warning",
"output:new:nullable": "warning",
"output:new:non-nullable": "warning",
"output:updated:nullable": "warning",
"output:updated:non-nullable": "warning",
"output:new:enum-value": "warning",
"query:new:required": "error",
"query:new:optional": "warning",
"input:removed": "error",
"output:removed": "error",
"response:new:status-code": "warning",
"endpoint:new": "warning",
"endpoint:updated:id": "warning",
"endpoint:removed": "error"
}
}
Output And Exit Codes
compare uses text output by default. JSON output is available with --output json and includes stable fields for:
- Rule id
- Severity
- Message
- Operation identity
- Schema path when applicable
Exit codes:
0: compare completed without error-level findings, or validate completed successfully1: compare found one or more error-level findings2: invalid configuration, invalid input, fetch failures, parse failures, unsupported external references, or other runtime failures
Contributing
This is currently an early-stage, internal Xemplo tool. Issues may be submitted, but third-party pull requests are not currently being reviewed.
Builds and Versioning
GitHub Actions will:
- Build and test all PRs targeting
main - Build, test and publish every commit to
mainas analphapre-release version such as0.1.0-alpha.3 - Build, test and publish
v<major>.<minor>.<patch>tags as stable release of<major>.<minor>.<patch>
You can also control version increments via :
- Because this repo uses squash merges, put the
+semver:marker in the PR title so it flows into the squashed commit onmain - If you edit the squash commit message while merging, keep the
+semver:marker in the final commit subject or body - Use
+semver: patchfor fixes - Use
+semver: minorfor backwards-compatible features - Use
+semver: majoror+semver: breakingfor breaking changes - Use
+semver: noneor+semver: skipwhen a merged change should not advance the release line
Recommended Release Flow
- Merge new features to
main; each push tomainpublishes the nextalphapackage automatically - Set the intended release size on the PR you merge by putting the
+semver:marker in the PR's commit message - Branch
release/<target-version>frommainwhen you want anrcstabilization lane - Tag the release commit with
v<version>when you want the stable package published for that line
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.1 | 140 | 4/2/2026 |
| 0.1.1-alpha.1 | 73 | 4/2/2026 |
| 0.1.0 | 116 | 4/1/2026 |
| 0.0.1 | 112 | 4/1/2026 |
| 0.0.1-alpha.5 | 69 | 4/1/2026 |