OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.36k stars 6.46k forks source link

[BUG][TYPESCRIPT] typescript-axios: all attributes are optional and parameter names are enquoted #13246

Open cihadaydemir opened 2 years ago

cihadaydemir commented 2 years ago
Description

When i use the 'typescript-axios' generator, every attribute of all my models are enquoted and optional. I tried it out with the 'typescript-rxjs' generator, with this the quotes disappeared but all of my attributes still were optional.

openapi-generator version

Version: 6.0.1

Generation Details

My config file looks like this:

{ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { "version": "6.0.1", "generators": { "axios": { "generatorName": "typescript-axios", "output": "src/proxy", "inputSpec": "http://localhost:8080/v3/api-docs.yaml", "additionalProperties": { "supportsES6": true, "withSeparateModelsAndApi": true, "apiPackage": "api", "modelPackage": "model", "useSingleRequestParameter": true, "enumPropertyNaming": "original" } } } } }

The OpenApi specification:

image

My generated result:

image

Expected result:

image
cihadaydemir commented 2 years ago

UPDATE: I fixed the optional attributes part of my problem. The problem was that i forgot to include the springdoc-openapi-kotlin depedancy in my spring boot backend, so it couldn't really recognize which of my DTO's attributes are required and not. But i still have the problem, that all of my attributes are enquoted.

stropho commented 1 year ago

FYI, it was added to support special characters in property names. https://github.com/OpenAPITools/openapi-generator/pull/10447

What's the problem with extra quotes ? It is a regular javascript/typescript code.