Datasets:
CROSS1: API Contract Reconciliation
Goal
The Python client library must correctly communicate with the Go HTTP server. Discrepancies exist between the API spec, the server implementation, and the client.
Requirements
- The Go server is the source of truth — fix the Python client to match server behavior
- Update
api_spec.yamlto document the actual contract (matching the server) - All integration tests must pass:
pytest tests/ - The Go server must still compile:
go build ./...(do not change Go source)
Supporting Documents
service/main.go,service/handlers.go— Go server (source of truth)client/api.py,client/models.py— Python client (has 3 bugs)api_spec.yaml— API spec (wrong in 3 places)
The 3 Discrepancies (find them yourself)
The spec documents one version of the contract; the server implements another. Read both and reconcile in favor of the server's actual behavior.
Important
Do NOT modify any Go source files. Only fix:
client/api.py— client request/response handlingclient/models.py— client data modelsclient/exceptions.py— client exception handlingapi_spec.yaml— update to match actual server behavior
Real-World Context
API contract mismatches between polyglot services are a leading cause of production incidents. These three discrepancy patterns appear repeatedly in real migrations:
- Field naming (camelCase vs snake_case): The Twitter v1 → v2 migration renamed
hundreds of fields (e.g.,
user.followers_count→public_metrics.followers_count), silently breaking every consumer that referenced old names. - Pagination key rename (
data/next→results/cursor): Stripe's 2022 changelog removedinvoicefromChargeobjects and renamed pagination fields, breaking dashboard tools and analytics pipelines overnight. - Error format change (HTTP 422 +
errors[]→ HTTP 400 +errorstring): The GitHub REST API v3 → v4 transition changed error envelopes, causing silent failures in CI/CD integrations that checkedresponse.errors[0].