conjure-typescript
conjure-typescript copied to clipboard
Generated typescript incorrect if endpoint path args ordering doesn't match the order they appear in the path
What happened?
Generated code assumes the ordering of path params in the endpoint args block matches the ordering of those params in the path.
i.e. if you have
http: POST /{one}/{two}/{three}
args:
two: string
three: string
one: string
the generated code will incorrectly substitute to create the path {two}/{three}/{one}
What did you want to happen?
The substitution should be based on the names of the params, not the ordering.
https://github.com/palantir/conjure-typescript/blob/b39e8f4f4a4546d5583e36ae1d6d1466bc765436/src/commands/generate/serviceGenerator.ts#L156-L166 is where the path params are pulled out
then in https://github.com/palantir/conjure-typescript/blob/b39e8f4f4a4546d5583e36ae1d6d1466bc765436/src/commands/generate/serviceGenerator.ts#L203 they're passed only by position
they're then used in https://github.com/palantir/conjure-typescript-runtime/blob/develop/packages/conjure-client/src/fetchBridge/fetchBridge.ts#L165