-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
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
v6.6.0 generates what we and tsc expected, v7.0.0 doesn't.
openapi-generator version
v7.0.0
OpenAPI declaration file content or url
swagger spec file t.json
{
"swagger": "2.0",
"info": {
"title": "foo APIs",
"version": "0.0.1"
},
"host": "foo.com",
"paths": {
"/hello": {}
},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"@type": {
"type": "string"
}
},
"additionalProperties": {}
}
}
}
openapi tool configuration file foo.openapitools.json
{
"npmName": "foo",
"npmVersion": "0.0.1",
"snapshot": false,
"supportsES6": true,
"modelPropertyNaming": "original"
}Generation Details
Steps to reproduce
generate code from spec
openapi-generator-cli version-manager set 7.0.0
openapi-generator-cli generate -i t.json --generator-name typescript-axios -o src/gen/foo -c foo.openapitools.jsontsc build failed with v7.0.0
npm run --prefix src/gen/foo build
> foo@0.0.1 build
> tsc && tsc -p tsconfig.esm.json
api.ts:39:5 - error TS2411: Property ''@type'' of type 'string' is not assignable to 'string' index type 'object'.
39 '@type'?: string;
~~~~~~~
Found 1 error in api.ts:39Related issues/PRs
Suggest a fix
If we switch back to 6.6.0 everything works as expected:
openapi-generator-cli version-manager set 6.6.0
openapi-generator-cli generate -i t.json --generator-name typescript-axios -o src/gen/foo -c foo.openapitools.json
npm run --prefix src/gen/foo buildwe diff v6.6.0 and v7.0.0
diff -Nuar src/gen/foo/api.ts /tmp/app/src/gen/foo/api.ts
--- src/gen/foo/api.ts 2023-09-04 13:39:42
+++ /tmp/app/src/gen/foo/api.ts 2023-09-04 13:39:57
@@ -29,7 +29,7 @@
* @interface ProtobufAny
*/
export interface ProtobufAny {
- [key: string]: object | any;
+ [key: string]: object;
/**
* Reactions are currently unavailable