Skip to content

Conversation

@bdelanghe
Copy link

Why

I was working on updating the fulfillment-inbound-api to allow for both the newest version and the v0 endpoint.

  # Amazon Seller Central still uses Fulfillment Inbound API v0.
  # The models repo contains both v0 and v1; keep them distinct.
  if [[ "$API_NAME" == "fulfillment-inbound-api-model" && "$FILE" == *V0.json ]]; then
    API_NAME="${API_NAME}-V0"
  fi

This ensures that it isn't clobbered by the following swagger-codegen run on the fulfillmentInbound_2024-03-20.json. The clobbering is do to the version getting stripped out when naming the modules. V0 is still required for some operations even though most endpoints are deprecated.

The Drift

I wanted to ensure all of this was working correctly. To do so I wrote some extra bash scripts to do the following:

  • pull_models.sh snapshots the upstream models/ directory at a specific commit.
  • codegen.sh runs Swagger Codegen against that snapshot and writes generated output to lib/.
  • hoist.sh normalizes shared runtime files and injects provenance headers.
  • release.sh commits the generated artifacts and tags the release as
    amzn/selling-partner-api-models/<short_sha>, linking back to the exact upstream models commit.

I found these very helpful and I feel they simplify updating versions going forward. They are designed to be idempotent so they don't do anything if we are already on the update.

Copilot AI review requested due to automatic review settings December 16, 2025 20:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a streamlined code generation workflow for the Selling Partner API Ruby client by implementing automated scripts for model synchronization and code regeneration. The changes enable support for both the latest fulfillment-inbound API and the legacy V0 endpoint that's still required by Amazon Seller Central, while establishing a single entry point for managing future API updates.

Key Changes:

  • New automation scripts (pull_models.sh, codegen.sh, hoist.sh, release.sh) for managing API model updates
  • Regenerated code from upstream models at commit df0f6a4d using Swagger Codegen 3.0.71 (upgraded from 3.0.24)
  • Added provenance headers to all generated files with regeneration instructions
  • Special handling for fulfillment-inbound-api-model V0 to prevent clobbering by newer versions

Reviewed changes

Copilot reviewed 292 out of 6259 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/aplus-content-api-model/**/* Updated generated code with new Swagger Codegen version, added provenance headers, and minor documentation improvements
lib/api_error.rb Added provenance header indicating hoisted file source
lib/api_client.rb Added provenance header and patch note for cross-module type resolution
lib/amazon-warehousing-and-distribution-model/**/* New API model files generated from upstream
lib/.codegen_models_sha Tracks the upstream models commit hash for reproducibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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