Repository navigation
Publish JSON Schema for discovery responses - #49
Merged
Merged
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change publishing the existing discovery response contract as a JSON Schema.
No open issues 🎉
What changed in this PR
Publishes the existing GET /discovery contract as a Draft 2020-12 JSON Schema, addressing #22 without changing production response behavior.
Changes:
- Defines metadata and orchestrator entries, allows runner extensions, and documents exact numeric-token preservation for prices.
- Links the schema from the HTTP reference and validates its documented example.
- Expands HTTP response tests for populated and empty inventories, replacing the older price-presence test.
| File | Description |
|---|---|
orchestrator/pricing_test.go |
Removes the superseded price-presence test. |
orchestrator/discovery_test.go |
Validates empty, off-chain, and on-chain HTTP inventories against the schema. |
go.sum |
Records validator dependency checksums. |
go.mod |
Adds the JSON Schema validator used by tests. |
docs/http-api.md |
Links the discovery schema. |
docs/discovery.schema.json |
Defines the extensible discovery response contract and numeric precision requirements. |
discovery/server_test.go |
Validates standalone HTTP responses and exact numeric-token forwarding. |
discovery/schema_test.go |
Tests schema acceptance, rejection, and the documented example. |
Review effort: Balanced
3 tasks
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Publish the existing
GET /discoverycontract as a Draft 2020-12 JSON Schema linked from the HTTP reference. The schema describes metadata and orchestrator entries, allows runner extensions, and documents exact numeric-token handling for prices.Add Go tests that validate real HTTP responses from the orchestrator and standalone discovery handlers for populated and empty inventories, check raw numeric preservation, and validate the documented example. Keep validator imports in test files and remove the superseded price-presence test.
Validation:
go test -race ./...,go vet ./..., andgo mod tidy -diff. Confirmed the validator is absent from production command dependencies.Closes #22.