Parameters names are different from their usage names
See original GitHub issueWhat are the steps to reproduce this issue?
This might be related to using requestBodies
as an abstraction layer between paths and schemas.
Fastest way to repro this is generate a client from this schema: https://github.com/Southclaws/storyden/blob/main/api/openapi.yaml
What happens?
Paths that have POST payloads specified as requestBody
which $ref’s components/requestBodies
will generate slightly different names for the parameters of the function compared to the actual invocations within the function:
In text form:
/**
* @summary Register a new account with a username and password.
*/
export const authPasswordSignup = (authPasswordBody: AuthPasswordBody) => {
const formUrlEncoded = new URLSearchParams();
formUrlEncoded.append("identifier", authRequest.identifier);
formUrlEncoded.append("token", authRequest.token);
return customInstance<AuthSuccessResponse>({
url: `/v1/auth/password/signup`,
method: "post",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
data: formUrlEncoded,
});
};
In this code, the generated function parameter is called authPasswordBody
but the invocations for calls to formUrlEncoded.append
has generated authRequest
.
Some observations here:
- The requestBody ref is named
AuthPassword
- The actual schema referenced by the requestBody is named
AuthRequest
What versions are you using?
Operating System: mac Package Version: v6.9.6
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Is using parameter names that differ from type names only by ...
coding standards - Is using parameter names that differ from type names only by casing considered a bad practice in C#? - Software...
Read more >CA1719: Parameter names should not match member names
Rule description. A parameter name should communicate the meaning of a parameter and a member name should communicate the meaning of a member....
Read more >Parameter name differs in partial method declaration - JetBrains
When processing partial methods, C# compiler only checks the order and the types of the parameters, not their names.
Read more >The Importance of Parameter Names - LinkedIn
Client developers like descriptive parameter names such as firstName, totalDeductible, and ipAddress. At one glance they know what it does. Yet, ...
Read more >Argument label and parameter name | Apple Developer Forums
The general idea is that it's desirable to use a different name for a parameter in the place where it's called, vs. its...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
will be fixed in the next release
Working perfectly, thanks!