[pull] main from fern-api:main#731
Merged
Merged
Conversation
…ynamic-snippet path parameters in IR order (#15885) * fix(csharp, go, java, php, python, ruby, swift, typescript): render dynamic-snippet path parameters in IR order The shared associateByWireValue helper in @fern-api/browser-compatible-base-generator used to iterate over the input values object, which produced path parameters in insertion/alphabetical order. Generated SDK signatures order path parameters by URL position, so docs snippets could end up with arguments in the wrong order whenever the spec listed them differently. Iterate over the IR parameter list instead, mirroring associateByWireValueOrDefault, while preserving the existing 'parameter not recognized' error semantics for unknown keys. Also pass ignoreMissingParameters: true in java-v2 EndpointSnippetGenerator.getPathParameters so endpoint-level path-param keys aren't flagged as unrecognized when the top-level path-params pass runs (and vice versa). Adds a regression test under the path-parameters fixture supplying values in alphabetical order to verify they render in IR order. Linear: FER-10546 * fix(ruby, swift): include root-level path parameters in dynamic-snippet method calls Generated Ruby and Swift SDKs surface both root-level and endpoint-level path parameters as keyword/labelled arguments on the endpoint method, but the dynamic-snippet generators only emitted endpoint-level params, silently dropping root-level params (e.g. tenant_id) and producing snippets with malformed URLs. Mirror the existing body-request handling by merging context.ir.pathParameters with request.pathParameters in IR / URL order. Refs FER-10546. * fix(swift): coerce dynamic-snippet path parameter literals to String The generated Swift SDK declares every path parameter as String in the endpoint method signature (path values are interpolated into the URL string). The dynamic-snippet generator previously rendered each path parameter's literal using its IR-declared primitive type, so an integer path parameter (e.g. version: INTEGER, value 7) was emitted as version: 7 against a version: String signature, producing a snippet that fails to compile with 'cannot convert value of type Int to expected argument type String'. Render path-parameter values as Swift escaped String literals to match the SDK signature. Refs FER-10546. * fix(python): include root-level path parameters in dynamic snippet method call The python-v2 dynamic-snippet generator was passing root-level path parameters (e.g. tenant_id) as keyword arguments to the client constructor, but the generated Python SDK client only accepts base_url, headers, timeout, max_retries, follow_redirects, httpx_client and logging — so the snippet would raise TypeError: __init__() got an unexpected keyword argument 'tenant_id' and the endpoint method would also raise TypeError: get_user_specifics() missing 1 required positional argument: 'tenant_id' because root-level path parameters were dropped from the method call as well. Remove root-level path parameters from the constructor argument list and merge them with endpoint-level path parameters in getMethodArgsForInlinedRequest, mirroring the pattern already used by getMethodArgsForBodyRequest. This brings python-v2's inlined-request path in line with both its own body-request handling and the recent Ruby-v2 / Swift fix for the same family of bug. Refs FER-10546. * fix(swift): remove unused moduleSymbol in getEndpointMethodArgsForBodyRequest Dead code leftover from path-parameter String coercion refactor. The function delegates to getEndpointMethodPathParameters and getEndpointMethodBodyRequestArg, both of which re-fetch their own moduleSymbol when needed. Addresses Claude review finding on PR #15885. --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: dsinghvi <10870189+dsinghvi@users.noreply.github.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )