OpenAPITools / OpenAPITools/openapi-generator
[BUG] [Typescript] [angular]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug 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
After upgrading to open-api generator version 6.2.0 and also present in 6.2.1 typescript angular code generator does not match path parameter when name is prefixed with '*', and therefore the parameter is not added to url request
openapi-generator version
6.2.0, 6.2.1
I presume this is a regression, since e.g. Java Spring generator still supports it
OpenAPI declaration file content or url
openapi: 3.0.0
info:
version: 1.0.0
title: Sample
paths:
/file/fileContent/{*filePathName}:
get:
tags:
- file
summary: Returns the content of a file
parameters:
- name: filePathName
in: path
required: true
description: path to file with file name
schema:
type: string
responses:
'200':
description: Successful Operation
content:
'*': #The server should return whatever the mimetype of the file is.
schema:
type: string
format: binary
Generation Details
let localVarPath = `/file/fileContent/`;
return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, // <-- missing `filePathName`
{
context: localVarHttpContext,
responseType: "blob",
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
reportProgress: reportProgress
}
);
Steps to reproduce
using npm openapi-generator-cli generate
no specific config in openapitools.json
"additionalProperties": {
"ngVersion": "12",
"supportsES6": "true",
"npmVersion": "6.9.0",
"fileNaming": "kebab-case",
"modelFileSuffix": ".model",
"stringEnums": true,
"taggedUnions": true
}
Suggest a fix
I think the issue is here in AbstractTypeScriptClientCodegen.findPathParameterByName
i suppose somewhere here it is handles in Java AbstractJavaCodegen.toParamName
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.
Research direction
Start in modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java at findPathParameterByName, using the supplied OpenAPI path with the {*} parameter to reproduce the missing URL parameter. Compare its handling with AbstractJavaCodegen.toParamName and verify generated TypeScript Angular output includes filePathName in the request path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, java, openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100