fix: use constrained property names in generated OpenAPI parameter models#381
Merged
Merged
Conversation
…dels The OpenAPI parameters preset interpolated the raw parameter name into this.<name> accesses of generated serialization/deserialization methods, while Modelina constrains the actual class property to camelCase. Any non-camelCase parameter (e.g. 'Skip', 'Cvr') produced code that fails to compile with TS2551. The generated static fromUrl method also unconditionally called instance.deserializeUrl(url), but deserializeUrl is only generated when the operation has query parameters, so path-parameter-only operations produced code that fails to compile. Generated methods now use the Modelina-constrained property name for property accesses while keeping the raw name for the wire format (URL templates and query string keys), and fromUrl only calls deserializeUrl when it exists. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for the-codegen-project canceled.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
jonaslagoni
approved these changes
Jul 6, 2026
Contributor
|
🎉 This PR is included in version 0.72.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fixes two compilation errors in TypeScript models generated by the OpenAPI
parameterspreset:Raw vs constrained property names — generated
serialize*/deserialize*methods interpolated the raw OpenAPI parameter name intothis.<name>accesses, while Modelina constrains the actual class property to camelCase. Any non-camelCase parameter produced code that fails to compile:fromUrlcalling a method that may not exist — the staticfromUrlmethod unconditionally calledinstance.deserializeUrl(url), butdeserializeUrlis only generated when the operation has query parameters. Every path-parameter-only operation produced:How
name) and the Modelina-constrained property name (propertyName, resolved viaConstrainedObjectPropertyModel.unconstrainedPropertyName). Generated methods usepropertyNameforthis.accesses and keepnamefor the wire format (URL templates, query string keys), so serialized URLs are unchanged.fromUrlonly emits theinstance.deserializeUrl(url)call when the operation has query parameters. Constructor arguments andextractPathParametersresult keys also use the constrained property name.Verification
deserializeUrl;Skip/Cvrquery parameters must accessthis.skip/this.cvrwhile still reading/writingSkip/Cvron the query string.npm run prepare:pr— passes; snapshots updated (27 updated, 2 added). Every updated snapshot that callsdeserializeUrlalso defines it. Runtime design surface (test/runtime/typescript) unchanged.Release
This
fix:commit will cut a patch release via semantic-release on merge tomain.🤖 Generated with Claude Code