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

YAML-Support #65

Open
DenisSabo opened this issue Mar 10, 2019 · 5 comments
Open

YAML-Support #65

DenisSabo opened this issue Mar 10, 2019 · 5 comments

Comments

@DenisSabo
Copy link

Hey there,
for libraries like https://www.npmjs.com/package/swagger-typescript-codegen it would be nice, if your tool could generate a Typescript file, out of a YAML file.

@mtennoe
Copy link
Owner

mtennoe commented Mar 11, 2019

Hey @DenisSabo!

Do you mean using YAML files for specifying the Swagger spec (similar to the current Swagger JSON file)?

Thanks for the input!

@DenisSabo
Copy link
Author

Hey @mtennoe,

yes that's what I meant. The reason for the suggestion is that for me it would mean one less step in my toolchain.

Thank you for the fast response! 👍

@mtennoe
Copy link
Owner

mtennoe commented Mar 12, 2019

It would add some complexity to the whole pipeline, but if we do it correctly we can hide a lot of the complexity. I guess there are some nice tools out there for parsing and reading the YAML and convert it to the internal format in the codegen tool as well. Don't really have the time to look into that in the nearest future myself though. But you are free to give it a go if you want to :)

@sbusch
Copy link

sbusch commented Mar 26, 2019

Out of scope IMHO.

@DenisSabo you could convert from YAML to JSON as a preprocessing step, e.g. https://stackoverflow.com/questions/34733253/converting-a-swagger-yaml-file-to-json-from-the-command-line

@Kosta-Github
Copy link

with npm install --save js-yaml you can change the line in the example usage:

var swagger = JSON.parse(fs.readFileSync(file, "UTF-8"));

by

var yaml = require('js-yaml');
var swagger = yaml.safeLoad(fs.readFileSync(file, 'utf8'));

IMHO, there is no need for adding the yaml dependency... mh, maybe for the CLI tool...

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