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

Restore support for yaml files #17

Open
MatthiasMargot opened this issue Jun 24, 2021 · 3 comments
Open

Restore support for yaml files #17

MatthiasMargot opened this issue Jun 24, 2021 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@MatthiasMargot
Copy link
Owner

MatthiasMargot commented Jun 24, 2021

There's a dependency specified for this project called "swagger-parser" that's currently not used.
It was introduced to support yaml as the input format for source-files that typegen should parse.
Currently typegen only supports json format.

Support for yaml should be added, some options for API implementation:

  1. add an optional "type" / "extension" flag to the CLI defaulting to json
  2. figure out the file-type based on its contents, for this case it should be fine to assume a limitation to only json/yaml
  3. figure out the file-type based on the extension provided in the input & output file-path arguments (this is un-desirable since it forces the user to specify file extensions in the argument, that shouldn't be necessary)
@MatthiasMargot MatthiasMargot added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 24, 2021
@boobo94
Copy link
Collaborator

boobo94 commented Jun 24, 2021

I vote for the 3rd option for the input part.

@boobo94
Copy link
Collaborator

boobo94 commented Jun 24, 2021

Is not clear what are you referring to about the output in the 3rd bullet point.

@MatthiasMargot
Copy link
Owner Author

So, for option 3 here, I mean that it would be possible to decide whether the input is yarn or json based on the file extension e.g.:

typegen input.json output.ts

vs

typegen input output

Here in the 2nd example command that would not be possible since the two path arguments are provided without extensions so the 2nd case here would result in an un-supported usage of the API. I think the 2nd case should work so I'm not too much in favor of option 3 but we'll have to see what's possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants