[codex] Harden public API contracts#256
Draft
ewlarson wants to merge 2 commits into
Draft
Conversation
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.
Summary
This PR finishes the v1 public API contract hardening pass for the current public surface.
It adds named Pydantic response models for the stable public response families, centralizes public error handling around the
{"errors": [...]}envelope, documents shared error schemas in OpenAPI, and updates public routes to declare success/error contracts without changing successful wire payloads.What Changed
app/api/schemas.pywith named response models for root, search, suggest, facets, resources, resource subroutes, home/blog posts, map/H3, OGC, OGM status, MCP metadata, citations, downloads, metadata, relationships, similar items, viewer payloads, and data dictionaries.Why
Before this change, the API had safe behavior in many paths but lacked an explicit, testable public contract across the v1 surface. Several public responses were still effectively documented as generic dictionaries, and error bodies were not uniformly represented in OpenAPI.
This PR makes the public API safer and more predictable ahead of a v1.0.0 release while intentionally keeping dynamic OGM/Aardvark/B1G metadata fields extensible.
Validation
python -m pytest tests/api/test_error_contracts.py198 passed, 9 skippedmake lint-checkCOMPOSE_PROJECT_NAME=data-api WALLCLOCK_TIMEOUT_SECONDS=300 make test1759 passed, 129 skipped, 1 xpassed61.42%Follow-Up Before v1.0.0
This PR closes the public HTTP API contract hardening work, but I would still address these before tagging v1.0.0:
str(exc).0.7.0to the final v1 version when ready.