Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [typescript-fetch] v4.3.1 introduced "Module has no exported member 'AnyType" #6273

Closed
5 of 6 tasks
gnuletik opened this issue May 12, 2020 · 4 comments
Closed
5 of 6 tasks

Comments

@gnuletik
Copy link

gnuletik commented May 12, 2020

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

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.
openapi-generator version

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 declaration file content or url
# 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
Command line used for generation
# 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
Steps to reproduce
  • Download openapi.yml and config.yml pasted above.
  • Run the docker command pasted above
  • cd dist
  • npm install to install typescript and run tsc (because tsc is called in the post-install script in the package.json file)
Related issues/PRs

Seems to be linked to this PR : #6091

Suggest a fix

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");
@auto-labeler
Copy link

auto-labeler bot commented May 12, 2020

👍 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.

gnuletik added a commit to Ircam-WAM/timeside-sdk-js that referenced this issue May 12, 2020
@mboutet
Copy link

mboutet commented May 13, 2020

Same problem with the python-flask generator

@sergiofigueras
Copy link

Same thing happening with Kotlin generator.

@macjohnny
Copy link
Member

duplicate of #6332

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants