openapi-contrib / openapi3-generator

Use your API OpenAPI 3 definition to generate code, documentation, and literally anything you need.
Apache License 2.0
90 stars 27 forks source link

Path replace has bug in window. #18

Open cxyxc opened 5 years ago

cxyxc commented 5 years ago

Thanks for this project!

This line has bug in windows. Please fix it.Thanks.

https://github.com/fmvilas/openapi3-generator/blob/37231cfc8fb3bfde3320bc4fcf832dc84f35ccfb/lib/generator.js#L70

Maybe can use this. const subdir = config.root.replace(config.templates_dir, '.');

fmvilas commented 5 years ago

Hi @cxyxc. I don't think there's a bug with this line but instead, the bug with Windows may be in many different places because we're using / instead of \ as directory separators.

I think the root cause may be here (and probably in more places): https://github.com/fmvilas/openapi3-generator/blob/37231cfc8fb3bfde3320bc4fcf832dc84f35ccfb/lib/generator.js#L303

Can you please fix it?