Compare Two Servers
The compare command fetches two CapabilityStatements and produces a diff report.
Basic usage
Section titled “Basic usage”fhir-capability-analyzer compare <sourceA> <sourceB>Each source can be a URL or a local JSON file path, independently:
# Two live serversfhir-capability-analyzer compare https://server-a.example.com https://server-b.example.com
# Local baseline vs live serverfhir-capability-analyzer compare ./fixtures/baseline.json https://staging.example.com
# Two local filesfhir-capability-analyzer compare ./capability-v1.json ./capability-v2.jsonOutput formats
Section titled “Output formats”Text (default)
Section titled “Text (default)”fhir-capability-analyzer compare ./examples/hapi-r4.json ./examples/us-core-server.jsonComparison: ./examples/hapi-r4.json → ./examples/us-core-server.jsonN difference(s) found
Added in B (N)...Removed in B (N)...Changed (N)...fhir-capability-analyzer compare a.json b.json --format jsonProduces a stable ComparisonReport JSON object with added, removed, and changed arrays.
Markdown
Section titled “Markdown”fhir-capability-analyzer compare a.json b.json --format markdownCI assertion: fail on any difference
Section titled “CI assertion: fail on any difference”fhir-capability-analyzer compare ./baseline.json https://staging.example.com --exit-on-diffExit code 1 when any difference is found. Exit code 0 when capabilities match exactly.
What is compared
Section titled “What is compared”| Category | What is checked |
|---|---|
fhir-version | Top-level fhirVersion field |
format | Declared content formats (json, xml, etc.) |
resource | Which resource types are declared |
interaction | Per-resource interactions (read, create, search-type, etc.) |
search-param | Per-resource search parameter names |
operation | Per-resource and system-level operations |
profile | Per-resource profile and supportedProfile URLs |
security | CORS and authentication services |
Exit codes
Section titled “Exit codes”See Exit codes.