[BUG] [typescript-axios] Interface parameters don't follow paramNaming
See original GitHub issueBug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What’s the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
If an API definition has a schema with another parameter format than camelCase, the parameter format in the model/interface should also follow the paramNaming
config and be camelCase.
openapi-generator version
5.3.0-SNAPSHOT
OpenAPI declaration file content or url
openapi: "3.0.1"
info:
title: Test API
version: "1"
paths:
/projects/{project_name}/test:
post:
operationId: create_test
summary: Create a test
parameters:
- $ref: "#/components/parameters/project_name"
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
201:
description: Test created
content:
application/json:
schema:
$ref: "#/components/schemas/TestStatus"
components:
parameters:
project_name:
description: Name of the project
name: project_name
in: path
required: true
schema:
type: string
example: test-project
schemas:
Test:
type: object
additionalProperties: false
properties:
start_time:
type: integer
title: start_time
description: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
minimum: 0
end_time:
type: integer
title: end_time
description: The number of milliseconds since 00:00:00 Thursday, 1 January 1970, Coordinated Universal Time (UTC), minus leap seconds.
minimum: 0
required:
- start_time
- end_time
TestStatus:
type: object
properties:
id:
description: An UUID v4 identifier for the test
type: string
format: uuid
example: 5a7b8f0c-e8c8-4b5b-b8e2-e8e9f8e9e9e9
status:
description: The status of the test
type: string
enum:
- Running
- Pending
- Success
- Failed
- Error
- Cancelled
- Unknown
example: Running
required:
- id
- status
Generation Details
config:
{
"projectName": "test",
"moduleName": "Sdk",
"supportsES6": true
}
Steps to reproduce
Generate the API with this config.
Then model interfaces will be generated without translating parameters to camelCase.
This behaviour is done in the javascript generator correctly.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Typescript error while calling axios - no overload matches this ...
So it seems like the error may be linked to the method property of the AxiosRequestConfig interface, but ultimately I'm not sure. Thank...
Read more >How to Prevent the TypeError: Cannot Read Property Map of ...
A guide on the root cause of 'cannot read map of undefined' as well as techniques and tools to prevent this error.
Read more >'X' is declared but its value is never read in TypeScript
To solve 'is declared but its value is never read' error in TypeScript, prefix any unused parameter name with an underscore, or disable...
Read more >Documentation - Declaration Merging - TypeScript
To merge the namespaces, type definitions from exported interfaces declared in each namespace are themselves merged, forming a single namespace with merged ...
Read more >React Query and TypeScript - TkDodo's blog
Generics · The four Generics · Type Inference · Partial Type Argument Inference · Infer all the things · What about error?
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
It was probably wrong to disable it. I only now noticed reading that point through that it is documented as “Only change it if you provide your own run-time code for (de-)serialization of models”. I probably assumed it transformed the properties in every case which was the problem overall (and was fixed with other changes and I assume works with the “original” setting).
I use axios to convert snake_case responses by Rails to camelCase.
modelPropertyName
is required.