Skip to content

fix(batch): a response enum value the SDK did not know yet failed the whole response, so response enums now accept unknown values - #25

Draft
AnderRV wants to merge 1 commit into
mainfrom
fix/open-response-enums
Draft

AnderRV wants to merge 1 commit into
mainfrom
fix/open-response-enums

Conversation

@AnderRV

@AnderRV AnderRV commented Sep 30, 2026

Copy link
Copy Markdown
Member

Why

Generated response enums were strict, so one value the server adds later (a new status or failure reason) made pydantic reject the whole response. Every released SDK version would break the day the API grows an enum.

What

  • Response enums accept unknown values: a _missing_ hook (_open_enum.py) is added by a post-generation step (scripts/open_extensible_enums.py) to enums marked x-extensible-enum: true in docs/openapi.yaml.
  • Only markers were added to the spec copy (10 lines, response enums). No values or fields changed.
  • Request-side enums stay strict, so typos like type="regulr" still fail locally.
  • CI: regenerating the models must produce no diff. PyYAML is now an explicit dev dependency.

No version bump.

Verification

  • make test: 166 passed. ruff, format and ty are clean. The drift check passes locally.
  • Resetting models.py to main makes 12 tests fail with pydantic enum errors.

🤖 Generated with Claude Code

… whole response, so response enums now accept unknown values

Response enums marked `x-extensible-enum: true` in docs/openapi.yaml get a
`_missing_` hook (src/zenrows/batch/_open_enum.py) added after codegen by
scripts/open_extensible_enums.py: an unknown value parses as an UNKNOWN
member that keeps the raw value. Request-side enums (JobType,
ScheduleState, ...) stay strict so a typo still fails locally.

PyYAML becomes an explicit dev dependency for the post-step, and CI now
fails if the generated models drift from the spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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