[BUG] [typescript-axios] Duplicate identifier 'options' when URL parameter 'options' exists
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- openapi, typescript
Research direction
Start in modules/openapi-generator/src/main/resources/typescript-axios/apiInner.mustache at the hardcoded override parameter referenced in the issue, then reproduce generation with the supplied OpenAPI specification and typescript-axios settings. Done means the generated client no longer declares duplicate options parameters while retaining the HTTP options override behavior.
Written by the indexing model from the issue text.
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- 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
In the spec we are using there's a parameter called options:
{
"name": "options",
"in": "query",
"description": "FOO",
"schema": {
"type": "string",
"default": "bar"
}
},
When generating the client from this spec, duplicate identified options appears:
(
options?: string,
options?: any,
):
This is due to Override http request option parameter being hardcoded as "options" here:
There's no way to rename this parameter, or disable it as far as I know. Options like "useSingleRequestParameter": true or "ensureUniqueParams": true do not help with this case: the query parameter cannot be renamed and useSingleRequestParameter still uses options in the inner calls even if the public API uses an single object.
openapi-generator version
openapi-generator-cli@2.31.0 / openapi-generator@7.21.0
OpenAPI declaration file content or url
{
"openapi": "3.0.1",
"info": {
"title": "FOO API",
"description": "FOO API",
"contact": {
"name": "FOO",
"url": "https://foo.com",
"email": "foo@foo.com"
},
"license": {
"name": "foo",
"url": "https://foo.com"
},
"version": "1.0"
},
"servers": [
{
"url": "https://foo.com"
}
],
"paths": {
"/search": {
"get": {
"summary": "foo",
"externalDocs": {
"description": "Search",
"url": "https://foo.com/search.md"
},
"operationId": "search",
"parameters": [
{
"name": "options",
"in": "query",
"description": "FOO",
"schema": {
"type": "string",
"default": "FOO"
}
}
],
"responses": {
"default": {
"description": "Response",
"content": {
"application/json;charset=UTF-8": {
"schema": {
}
}
}
},
"503": {
"description": "Request Rejected"
},
"504": {
"description": "Backend Timeout "
}
}
}
}
}
}
Generation Details
Open API generator spec:
{
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "5.1.1",
"storageDir": "../../.openapi-generator/",
"generators": {
"foo": {
"generatorName": "typescript-axios",
"output": "#{cwd}/foo-api-client/",
"glob": "./foo-api.json",
"additionalProperties": {
"withSeparateModelsAndApi": "true",
"apiPackage": "api",
"modelPackage": "model",
"useSingleRequestParameter": true,
"ensureUniqueParams": true
}
}
}
}
}
Steps to reproduce
- Save the spec to
./foo-api.json - Run
openapi-generator-cli generate - Check the generated client, confirm that there's duplicate identifier options
Related issues/PRs
Suggest a fix
Rename the override parameter to something that's unlikely to be used as a query parameter like __AxiosHTTPOptionsOverride
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 103
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenAPITools/openapi-generator
-
Issue: Bug
Difficulty 1/5 Under an hour Newbie friendliness 91/100
OpenAPITools/openapi-generator#24978 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
OpenAPITools/openapi-generator#24975 ·
-
Issue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
OpenAPITools/openapi-generator#24859 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
OpenAPITools/openapi-generator#24852 · 1 comment ·
-
[BUG][KOTLIN] Fails to compile after updating to 7.25.0 with useJackson3=false useSpringBoot4=true OpenIssue: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
OpenAPITools/openapi-generator#24842 · 1 comment ·
All issues in OpenAPITools/openapi-generator
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100