-
-
Notifications
You must be signed in to change notification settings - Fork 131
Add option to use swagger documentation as resource type #76
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
Conversation
src/index.js
Outdated
@@ -14,6 +15,7 @@ program | |||
.option('-p, --hydra-prefix [hydraPrefix]', 'The hydra prefix used by the API', 'hydra:') | |||
.option('-g, --generator [generator]', 'The generator to use, one of "react", "react-native", "vue", "admin-on-rest"', 'react') | |||
.option('-t, --template-directory [templateDirectory]', 'The templates directory base to use. Final directory will be ${templateDirectory}/${generator}', `${__dirname}/../templates/`) | |||
.option('-s, --resource-type [resourceType]', 'Hydra or Swagger', 'hydra') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I suggest -f --format
instead?
Should be .option('-f, --format [hydra|swagger]', '"hydra" or "swagger', 'hydra')
src/index.js
Outdated
@@ -29,7 +31,14 @@ const generator = generators(program.generator)({ | |||
}); | |||
const resourceToGenerate = program.resource ? program.resource.toLowerCase() : null; | |||
|
|||
parseHydraDocumentation(entrypoint).then(ret => { | |||
const parser = entrypoint => { | |||
if (program.resourceType && program.resourceType === 'swagger') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const parseDocumentation = 'swagger' === program.format ? parseSwaggerDocumentation : parseHydraDocumentation;
@dunglas It's done. Can you review again? Thanks. |
Can I do something else to get this PR accepted? |
Hi @arojunior, thank you very much for working on this, we definitely want to merge this PR but we can't do it if the tests are red. For the CS problems, you can just run |
@dunglas ok, thanks. I made the fixes with |
Hey @dunglas, thanks a lot for your help. Now everything is OK and tests are green. Can you merge the PR? |
The code looks good to me! Thank you very much for working on this. |
@dunglas is it ok now? |
@dunglas should I do something else? |
Is this going to be merged soon? I'd like to try to use this package with my swagger API definitions... Alternatively, anyone have tips on how to yarn/npm install from @arojunior's branch? The namespacing seems to keep it from building after it's downloaded.. |
Thanks @arojunior |
The work still in progress, but I'm open this Pull Request just to let you guys know how it is going.
I'm open a PR to api-doc-parser as well, including this feature.