OpenAPITools / OpenAPITools/openapi-generator
[BUG] typescript-axios not handling response headers
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
tool either throws an error about response parameters (5.4.0), or silently ignores them (6.0.0)
openapi-generator version
5.4.0 emits an error
6.0.0 does not show an error, but there is no code to handle the Retry-After response header or constrain its type (to string)
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: Header Ref
description: Demonstrate defect with a $ref to a response header
version: 0.0.1
servers:
- url: /issues
paths:
/status:
get:
operationId: getStatus
description: Get status
responses:
'202':
description: Accepted.
content:
text/plain:
schema:
type: string
headers:
Retry-After:
$ref: '#/components/headers/Retry-After'
components:
headers:
Retry-After:
description: >-
See [RFC7231: Retry-After](https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.3)
schema:
type: string
Generation Details
openapi-generator-cli generate -g typescript-axios -i openapi.yaml -o sdk
Steps to reproduce
above command
for 5.4.0 I get
[main] ERROR o.o.codegen.DefaultCodegen - Not handling class Parameter {
name: Retry-After
in: header
description: null
required: null
deprecated: null
allowEmptyValue: null
style: null
explode: null
allowReserved: null
schema: null
examples: null
example: null
content: null
$ref: null
} as Body Parameter at the moment
for 6.0.0 the tool does not emit this ERROR but the emitted code does not support that response header.
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 with the openapi.yaml declaration and run the shown openapi-generator-cli command using the typescript-axios generator, comparing behavior between versions 5.4.0 and 6.0.0. Trace response-header handling in the generated SDK and generator implementation; done means the Retry-After header is emitted and constrained to string without the earlier parameter error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100