Commit 4ba16b4
feat(rust): preserve parameter order in dynamic snippets and fix wire tests (#10829)
* fix(rust): use getStructNameByDeclaration for request struct naming in dynamic snippets
The dynamic snippets generator was using getStructName() which doesn't account for
name deduplication in the registry. This caused incorrect struct names to be generated
for request types, particularly for query-only requests. Now using getStructNameByDeclaration()
to ensure the generated snippet uses the same deduplicated struct names as the SDK generator.
Co-Authored-By: [email protected] <[email protected]>
* fix(rust): use getStructNameByDeclaration for request struct naming in dynamic snippets
The dynamic snippets generator was using getStructName() which doesn't account for
name deduplication in the registry. This caused incorrect struct names to be generated
for request types, particularly for query-only requests. Now using getStructNameByDeclaration()
to ensure the generated snippet uses the same deduplicated struct names as the SDK generator.
Co-Authored-By: [email protected] <[email protected]>
* chore(rust): enhance Rust snippet generator for default struct values
Improves the Rust dynamic snippet generator to handle struct construction with ..Default::default() only when all fields are optional, matching the model generator's logic. Adds logic to fill in missing required fields with sensible defaults when Default cannot be used, and ensures query request struct names are deduplicated and consistent with the SDK generator. Also updates query parameter datetime formatting for consistency.
* chore: seed update
* chore(rust): bump version
* chore(rust): bump version to 0.13.6 for dynamic snippets fix
Co-Authored-By: [email protected] <[email protected]>
* chore: dynamic snippets fix
* fix(rust): avoid Default::default() in wire tests for non-Default types
- Always explicitly provide all fields in generated wire tests instead of using ..Default::default()
- Fix generateDefaultValueForType() to construct named types properly instead of using Default::default()
- Use HashMap::new() and HashSet::new() instead of Default::default() for collections
- This ensures wire tests compile correctly when request structs don't derive Default
Co-Authored-By: [email protected] <[email protected]>
* fix(rust): use getTypeNameById for named types in generateDefaultValueForType
Co-Authored-By: [email protected] <[email protected]>
* fix(rust): handle integer-based named types in generateDefaultValueForType
- Look up named types from IR to determine underlying type
- For alias types, recursively generate inner value and wrap with constructor
- Fixes issue where Orgtype(pub i64) was incorrectly generated as Orgtype("value".to_string())
- Now correctly generates Orgtype(0) for integer newtypes, Orgname("value".to_string()) for string newtypes
- Also handles enum types by using first variant
Co-Authored-By: [email protected] <[email protected]>
* fix(rust): use IR declaration names for request types in dynamic snippets
Fix wire test request type naming to use IR declaration names instead of
synthetic endpoint-based names. For inlined requests with properties body,
use the actual type name from the IR (e.g., ResponseChargeBack) instead of
generating synthetic names (e.g., AddResponseRequest).
This ensures generated wire tests reference types that actually exist in
the SDK, fixing E0422 compilation errors.
Co-Authored-By: [email protected] <[email protected]>
* chore: revert IR-sdk and ir-generator changes to focus on Rust-only fixes
Co-Authored-By: [email protected] <[email protected]>
* feat: preserve parameter order in dynamic snippets generation
- Modified AbstractDynamicSnippetsGeneratorContext to iterate over parameters in schema order instead of Object.entries(values)
- This ensures generated snippets maintain the parameter order defined in the API schema
- Updated TypeScript and Python dynamic snippets test snapshots to reflect new behavior
- Validation now skips parameters not provided in values instead of throwing errors for unrecognized keys
Co-Authored-By: [email protected] <[email protected]>
* chore: update dynamic snippets test snapshots for all generators
- Updated C# dynamic snippets snapshots (10 snapshots)
- Updated Go dynamic snippets snapshots (27 snapshots)
- Updated Java dynamic snippets snapshots (8 snapshots)
- Updated PHP dynamic snippets snapshots (10 snapshots)
- Updated Ruby dynamic snippets snapshots (4 snapshots)
These snapshot updates are required due to the parameter iteration order change in AbstractDynamicSnippetsGeneratorContext.ts which affects all dynamic snippets generators.
Co-Authored-By: [email protected] <[email protected]>
* update sdk ete
* update sdk ete
* chore(rust): update wiretests mechanism and fixes
* fix: update snippets-core test snapshot for extends field
Co-Authored-By: [email protected] <[email protected]>
* chore: update snapshot
* fix: preserve order
* chore: snapshot update
* revert: undo parameter order changes to AbstractDynamicSnippetsGeneratorContext
Reverts changes that broke Java and other generators by adding
stricter parameter validation. The Rust generator handles parameter
order independently through its own DynamicTypeLiteralMapper.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* feat(rust): preserve parameter order in dynamic snippets
Override associateByWireValue in Rust DynamicSnippetsGeneratorContext
to iterate over schema parameters instead of Object.entries(values).
This ensures generated Rust code has struct fields in the same order
as defined in the API schema.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* chore: update ETE test snapshots for dynamic IR extends field
The dynamic IR now includes an 'extends' field on ObjectType for
handling inheritance patterns. This updates the ETE test snapshots
to include this new field in IR and dynamic snippet outputs.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* chore: bump CLI to 3.31.3 and Rust SDK to 0.13.9
- CLI 3.31.3: Add `extends` field to dynamic IR ObjectType for inheritance patterns
- Rust SDK 0.13.9: Preserve parameter order in dynamic snippets
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
* fix(cli): bump version to 3.32.0 for feature addition (semantic versioning)
Co-Authored-By: [email protected] <[email protected]>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: [email protected] <[email protected]>
Co-authored-by: Claude Opus 4.5 <[email protected]>1 parent 358e187 commit 4ba16b4
File tree
193 files changed
+2128
-568
lines changed- generators/rust
- base/src
- asIs
- project
- dynamic-snippets/src
- context
- sdk
- src
- wire-tests
- packages
- cli
- cli
- ete-tests/src/tests
- dependencies/__snapshots__
- dynamic
- __snapshots__
- fixtures/simple
- ir/__snapshots__
- generation
- ir-generator/src/dynamic-snippets
- ir-migrations/src/migrations/v61-to-v60/__test__/__snapshots__
- commons/test-utils/src/__test__/createSampleIr/snapshots
- ir-sdk
- fern/apis/ir-types-latest/definition/dynamic
- src/sdk
- api/resources/dynamic/resources/types/types
- serialization/resources/dynamic/resources/types/types
- snippets/core/src/__test__/__snapshots__
- seed/rust-sdk
- accept-header/src/core
- alias-extends/src/core
- alias/src/core
- any-auth/src/core
- api-wide-base-path/src/core
- audiences/src/core
- basic-auth-environment-variables/src/core
- basic-auth/src/core
- bearer-token-environment-variable/src/core
- bytes-download/src/core
- bytes-upload/src/core
- client-side-params
- dynamic-snippets
- src/core
- content-type
- dynamic-snippets
- src
- core
- cross-package-type-names/src/core
- empty-clients/src/core
- endpoint-security-auth/src/core
- enum
- dynamic-snippets
- src/core
- error-property/src/core
- errors/src/core
- examples
- no-custom-config/src/core
- readme-config/src/core
- exhaustive/src/core
- extends
- dynamic-snippets
- src/core
- extra-properties/src/core
- file-download/src/core
- file-upload-openapi/src/core
- file-upload/src/core
- folders/src/core
- header-auth-environment-variable/src/core
- header-auth/src/core
- http-head/src/core
- idempotency-headers/src/core
- imdb
- imdb-custom-config
- .github/workflows
- dynamic-snippets
- src
- core
- tests
- wiremock
- imdb-custom-features
- dynamic-snippets
- src
- core
- imdb
- dynamic-snippets
- src
- core
- inferred-auth-explicit/src/core
- inferred-auth-implicit-no-expiry/src/core
- inferred-auth-implicit/src/core
- license/src/core
- literals-unions/src/core
- literal/src/core
- mixed-case/src/core
- mixed-file-directory
- dynamic-snippets
- src/core
- multi-line-docs/src/core
- multi-url-environment-no-default/src/core
- multi-url-environment/src/core
- multiple-request-bodies
- dynamic-snippets
- src
- core
- no-environment/src/core
- no-retries/src/core
- nullable-optional
- dynamic-snippets
- src/core
- nullable-request-body
- dynamic-snippets
- src
- core
- nullable
- dynamic-snippets
- src/core
- oauth-client-credentials-custom/src/core
- oauth-client-credentials-default/src/core
- oauth-client-credentials-environment-variables/src/core
- oauth-client-credentials-mandatory-auth/src/core
- oauth-client-credentials-nested-root/src/core
- oauth-client-credentials-with-variables/src/core
- oauth-client-credentials/src/core
- object/src/core
- optional/src/core
- package-yml/src/core
- pagination-custom
- dynamic-snippets
- src
- core
- path-parameters
- dynamic-snippets
- src/core
- plain-text/src/core
- property-access/src/core
- public-object/src/core
- query-parameters-openapi-as-objects/src/core
- query-parameters-openapi/src/core
- query-parameters/src/core
- request-parameters/src/core
- required-nullable
- dynamic-snippets
- src
- core
- reserved-keywords/src/core
- response-property/src/core
- simple-api/src/core
- simple-fhir/src/core
- single-url-environment-default
- basic/src/core
- custom-environment/src/core
- full-custom/src/core
- single-url-environment-no-default/src/core
- streaming-parameter/src/core
- streaming/src/core
- undiscriminated-union-with-response-property/src/core
- undiscriminated-unions/src/core
- unions-with-local-date/src/core
- unions/src/core
- unknown/src/core
- url-form-encoded/src/core
- validation/src/core
- variables/src/core
- version-no-default/src/core
- version/src/core
- websocket-bearer-auth/src/core
- websocket-inferred-auth/src/core
- websocket/src/core
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
193 files changed
+2128
-568
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | | - | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
| |||
179 | 184 | | |
180 | 185 | | |
181 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
182 | 236 | | |
183 | 237 | | |
184 | 238 | | |
| |||
0 commit comments