Skip to content

fix: extend zip rename overlay to component schemas#40

Merged
azrosen92 merged 1 commit into
mainfrom
fix/zip-rename-overlay-cover-components
May 19, 2026
Merged

fix: extend zip rename overlay to component schemas#40
azrosen92 merged 1 commit into
mainfrom
fix/zip-rename-overlay-cover-components

Conversation

@azrosen92
Copy link
Copy Markdown
Collaborator

Summary

The existing zip→zip_code rename overlay only matches zip properties that appear in inline schemas under paths. Many address schemas (e.g., Location, Contractor-Address) live under components.schemas and are referenced via \$ref from path operations — those zip occurrences never get renamed.

Newly generated method signatures that go through \$ref'd component schemas end up with bare `zip` parameters, which shadow Python's `zip()` builtin. Pylint W0622 then fails the Compile SDK step:

```
src/gusto_embedded/locations.py:251:8: W0622: Redefining built-in 'zip' (redefined-builtin)
src/gusto_embedded/locations.py:402:8: W0622: Redefining built-in 'zip' (redefined-builtin)
src/gusto_embedded/contractors.py:2181:8: W0622: Redefining built-in 'zip' (redefined-builtin)
src/gusto_embedded/contractors.py:2323:8: W0622: Redefining built-in 'zip' (redefined-builtin)
```

(Most recent failure: run #26044020966.)

Change

Adds a second overlay rule targeting `$.components.schemas..properties.zip` so the rename covers every `zip` postal-code property the spec exposes, regardless of whether it's inlined or $ref'd. Applied to both the `gusto_embedded` and `gusto_app_int` overlays since they share the same gap.

Test plan

  • Trigger the Generate workflow on this branch and confirm the Compile SDK step passes (no `redefined-builtin 'zip'` warnings)
  • Spot-check that generated method signatures using ref'd address schemas (e.g., `contractors.update_address`, `locations.create`) use `zip_code` instead of `zip`
  • Confirm no other Speakeasy lint regressions

🤖 Generated with Claude Code

The existing $.paths..schema..zip rule only matches `zip` properties in
inline schemas under paths. Many address schemas live under
components.schemas and are referenced via $ref from path operations —
those zip occurrences never get renamed, so the generated Python
ends up with parameters named `zip`, which shadows the `zip()` builtin
and fails pylint W0622 during the Compile SDK step (most recent
failure: gusto/gusto-python-client run 26044020966, contractors.py
:2181 and locations.py:251).

Add a second rule targeting $.components.schemas..properties.zip so
the rename covers every `zip` postal-code property the spec exposes,
regardless of whether it's inlined or $ref'd. Applied to both the
embedded and app_int overlays.
Copy link
Copy Markdown

@rqsilva rqsilva left a comment

Choose a reason for hiding this comment

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

AFAIK no one is consuming the python client, so this change should be fine, right?

@azrosen92
Copy link
Copy Markdown
Collaborator Author

@rqsilva yes, also because of this issue, we've never actually generated a client that contains this zip attribute, it fails to generate. This wouldn't actually be a breaking change for any existing version of the client.

@azrosen92 azrosen92 merged commit 872f671 into main May 19, 2026
18 of 20 checks passed
@azrosen92 azrosen92 deleted the fix/zip-rename-overlay-cover-components branch May 19, 2026 19:09
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.

2 participants