Skip to content
New issue

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

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

Already on GitHub? # to your account

[typescript-angular] Cannot compile when Swagger file has no definitions block #9934

Closed
yzhan94 opened this issue Dec 12, 2019 · 0 comments · Fixed by #9951
Closed

[typescript-angular] Cannot compile when Swagger file has no definitions block #9934

yzhan94 opened this issue Dec 12, 2019 · 0 comments · Fixed by #9951
Assignees

Comments

@yzhan94
Copy link

yzhan94 commented Dec 12, 2019

Description

Given a Swagger definition without any model definitions, generated typescript-angular module can't be compiled:
ERROR in [...]/index.ts(2,15): error TS2306: File '[...]/model/models.ts' is not a module.

Swagger-codegen version

2.4.11-SNAPSHOT (b22ed93)

Command line used

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
    -i hello-world.yaml \
    -l typescript-angular \
    -o src/hello-world-consumer

Swagger declaration file content or url

swagger: '2.0'
info:
  version: 1.0.0
  title: Hello World API
schemes:
  - https
host: localhost
basePath: /api
paths:
  /hello-world:
    get:
      summary: Hello World
      responses:
        '200':
          description: Successful invokation

Steps to reproduce

I created an example repository to reproduce the issue: https://github.com/yzhan94/swagger-codegen-angular-issue

  • Run npm install and npm start (node version: 10.17.0).

Suggest a fix

I believe this line should be wrapped in a conditional, so that it is omitted when no models are defined.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants