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

Schema object called default generates invalid TypeScript raising reserved keyword error #1186

Closed
mb21 opened this issue Aug 8, 2022 · 0 comments · Fixed by #1192
Closed
Assignees

Comments

@mb21
Copy link
Contributor

mb21 commented Aug 8, 2022

Sample schema which validates:

openapi: 3.0.0
info:
  version: 1.0.0
  title: Simple API


components:
  schemas:
    default:
      type: object
      properties:
        name:
          type: string

paths:
  /artists:
    get:
      description: Returns a list of artists 
      responses:
        '200':
          description: Successfully returned a list of artists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/default'

generates:

export type default = {
    name?: string;
};

which fails tsc with:

Identifier expected. 'default' is a reserved word that cannot be used here

Would that be easy to fix? In what file? Thanks!

mb21 added a commit to mb21/openapi-typescript-codegen that referenced this issue Aug 10, 2022
mb21 added a commit to mb21/openapi-typescript-codegen that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants