swagger-api / swagger-api/swagger-codegen
[typescript-axios] additionalProperties generates null interface
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The usage of additionalProperties generates invalid code that tries to extend a null interface. The output looks like this:
export interface ExampleRequestBody extends null<String, any> {
}
The null reference needs to be manually changed to a Map<String, any> in order to compile
All of the following usages are not working:
additionalProperties: true
additionalProperties:
type: string
additionalProperties:
anyOf:
- type: string
- type: boolean
Swagger-codegen version
swagger-codegen-cli-v3:3.0.35
Swagger declaration file content or url
openapi: "3.0.3"
info:
title: "Custom Test Api"
version: "0.0.0"
components:
schemas:
ExampleRequestBody:
type: "object"
additionalProperties: true
paths:
/example/request:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/ExampleRequestBody"
responses:
204:
description: "Success"
Command line used for generation
docker run --rm -v ${PWD}:/local --user=`id -u`:`id -g` swaggerapi/swagger-codegen-cli-v3:3.0.35 generate -i /local/open-api-spec.yaml -l typescript-axios -o /local/out
Steps to reproduce
- Pull the correct docker image:
docker pull swaggerapi/swagger-codegen-cli-v3:3.0.35
- Copy the
.yamlfile above - Run the command above with the correct path to the .yaml file
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 by reproducing the generated TypeScript client with the supplied OpenAPI YAML and Docker command, then trace the typescript-axios generator output for additionalProperties. Done means the generated interface is valid TypeScript and all three additionalProperties forms produce compilable output without a null interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100