Starting from openapi-generator v4.3.1 and using the typescript-fetch, the following error occurs when compiling the generated typescript code:
> tsc
src/apis/DefaultApi.ts:18:5 - error TS2305: Module '"../models"' has no exported member 'AnyType'.
18 AnyType,
~~~~~~~
src/apis/DefaultApi.ts:19:5 - error TS2305: Module '"../models"' has no exported member 'AnyTypeFromJSON'.
19 AnyTypeFromJSON,
~~~~~~~~~~~~~~~
src/apis/DefaultApi.ts:20:5 - error TS2305: Module '"../models"' has no exported member 'AnyTypeToJSON'.
20 AnyTypeToJSON,
~~~~~~~~~~~~~
Found 3 errors.
Using openapi-generator v4.3.1 and typescript-fetch.
This is a regression as I was not able to reproduce it on v4.3.0
# openapi.yml
openapi: 3.0.2
info:
title: Example API
version: 1.0.0
paths:
/some-working-route/:
get:
operationId: listWorking
description: ''
parameters: []
responses:
'200':
content:
application/json:
schema:
type: object
properties:
id:
type: integer
name:
type: string
description: ''
/some-failing-route/:
get:
operationId: listFailing
description: ''
parameters: []
responses:
'200':
content:
application/json:
schema:
type: array
items: {}
description: ''
servers:
- url: http://localhost
# config.yml
typescriptThreePlus: true
npmName: some-example
npmVersion: '1.0.0'
docker run --rm \
-v ${PWD}:/local
--user "$(id -u):$(id -g)" \
openapitools/openapi-generator-cli:v4.3.1 generate \
-i /local/openapi.yml \
-g typescript-fetch \
-c /local/config.yml \
-o /local/dist
openapi.yml and config.yml pasted above.cd distnpm install to install typescript and run tsc (because tsc is called in the post-install script in the package.json file)Seems to be linked to this PR : https://github.com/OpenAPITools/openapi-generator/pull/6091
The previous version set the type of empty object as object.
It may be linked to @mwilby proposal on the PR:
typeMapping.put("AnyType", "object");
馃憤 Thanks for opening this issue!
馃彿 I have applied any labels matching special text in your issue.
The team will review the labels and make any necessary changes.
Same problem with the python-flask generator
Same thing happening with Kotlin generator.
Most helpful comment
Same thing happening with Kotlin generator.