Skip to content

Conversation

@oericdacosta
Copy link

refactor: deduplicate parameters and standardize error responses

Description

This PR refactors the Shopping Service OpenAPI specification source/services/shopping/openapi.json to improve maintainability and strictly follow the DRY principle.

Key Changes:

  1. Deduplicated Header Parameters: Moved 9 common header parameters (e.g., Authorization, X-API-Key, Request-Id) from individual operations to the path level. This significantly reduces redundancy across endpoints like /checkout-sessions and /carts.
  2. Standardized Error Responses: Introduced a reusable error_response schema and added standard HTTP error responses (400, 401, 404, 500) to all operations, referencing shared definitions in components/responses.
  3. Synced with Upstream: Aligned with the latest project structure by removing legacy spec/ artifacts, ensuring a clean merge with main

These changes make the OpenAPI spec more concise, easier to read, and ensure consistent error handling documentation across the API.

Type of change

Please delete options that are not relevant.

  • Refactor (non-breaking change which improves code quality)

Is this a Breaking Change or Removal?

If you checked "Breaking change" above, or if you are removing any schema
files or fields:

  • I have added ! to my PR title (e.g., feat!: remove field).
  • I have added justification below.
## Breaking Changes / Removal Justification
N/A - This is a purely structural refactor of the source OpenAPI file.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@oericdacosta oericdacosta requested a review from a team January 28, 2026 21:24
- Resolved conflicts in source/services/shopping/openapi.json
- Added UCP-Agent header from upstream PR Universal-Commerce-Protocol#120 to path-level parameters
- Maintained refactored structure with deduplicated headers at path level
@oericdacosta oericdacosta force-pushed the refactor/openapi-dedupe-errors branch from f6454a6 to c47f76b Compare January 29, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant