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

Dashes (-) in component names will make prettier crash #39

Open
mediafreakch opened this issue Apr 16, 2019 · 1 comment
Open

Dashes (-) in component names will make prettier crash #39

mediafreakch opened this issue Apr 16, 2019 · 1 comment

Comments

@mediafreakch
Copy link
Contributor

components:
  schema:
    My-Awesome-Type:
      type: object
      properties:
        foo:
          type: string
{ SyntaxError: Unexpected token, expected "=" (2:20)
.../node_modules/swagger-to-flowtype/node_modules/prettier/parser-babylon.js:1:326

Even though prettier is the module crashing I think that this needs to be addressed in swagger-to-flowtype, because export type My-Awesome-Type = {} is invalid JS to begin with.

Dashes are supported in OpenAPI spec (3.0.2): https://swagger.io/docs/specification/components/

The component names can consist of the following characters only:
A..Z a..z 0..9 . _ -

@yayoc
Copy link
Owner

yayoc commented Apr 21, 2019

Thanks for reporting. Yes, swagger-to-flowtype needs to validate the component names.
Although we may have cases component names conflicts, Removing - and . characters are fine for general cases.

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

No branches or pull requests

2 participants