bootprint / bootprint-openapi

Bootprint-module to render OpenAPI specifications, this repository has moved to https://github.com/bootprint/bootprint-monorepo/tree/master/packages/bootprint-openapi
MIT License
357 stars 48 forks source link

Support for v3 #91

Open nknapp opened 7 years ago

nknapp commented 7 years ago

I would be great to get pull-request that add support for the OpenAPI-v3-spec. I would suggest to create helpers openapi-v2 and openapi-v3 so that the differing places can be handled smoothly:


{{#if (openapi-v2)}}
{{>swagger/definitions definitions=definitions}}
{{else if (openapi-v3)}}
{{>openapi/components components=components}}
{{/if}}

As an alternative, if there are converters, that support the fully-automatic conversion from openapi 2 to 3, we could also just use those as preprocessor.
MikeRalphson commented 7 years ago

If you do take a look at the preprocessor route, there is swagger2openapi https://github.com/mermade/swagger2openapi

nknapp commented 7 years ago

This is the other way around, isn't it? I'd need a v3 to v2 converter...

But I'm actually at it already. bootprint-json-schema@next fully supports JSON-schema draft-05 which is the basis for v3. And I hope, that the next version of bootprint-openapi supports v2 and v3.

I'm going to work on it soon in the next-branch, but I don't know how long it will take. I hope to be able to set a basic structure soon. After that, all PRs will be very welcome.

pdesjardins commented 6 years ago

Has there been any progress toward supporting OpenApi 3.0.0 YAML? Thanks for this excellent project!

nknapp commented 6 years ago

I'm sorry, but I have other priorities at the moment.

pdesjardins commented 6 years ago

Understood about priorities! We're lucky to have the work you were able to contribute.

I just forked so I can play around with the code myself. Do you know of an easy way to test local changes?

For example, would it be more practical to learn how to invoke Handlebars templates locally (http://handlebarsjs.com/installation.html)? Or can I build a local release of this project?

Any pointers will be much appreciated!

Peter

nknapp commented 6 years ago

Hi Peter,

if you are planning to help developing this project, I will gladly give you push access to the repositories.

I think, despite priorities, I will still be able to release new versions, if needed.

As for local development... There are multiple ways. If you want to try changes to the templates, you should probably checkout all three bootprint-modules bootprint-openapi, bootprint-json-schema and bootprint-base. And link them together using npm link. You can then install bootprint globally and use the dev-mode to re-render the openapi-spec on-the-fly, once a template or stylesheet has changed.

I have written down the steps on https://gist.github.com/nknapp/02420131c1693db581788db18d925784

On the other hand, there are the test-cases in the test-directory. Each test consists of a openapi-spec and a mocha-testcase that compiles it and then inspects the generated output using cheerio. The generated html will appear in the test-output directory, within the project-root.

Handlebars itself does not have a mechanism to invoke templates from the command line. That was one of the reasons for writing bootprint in the first place.

If you'd rather change templates and partials, without contributing them, you can also create your own bootprint-module. Have a look here. Put your replacement templates in your modules partial-directory. If they are named like the original ones, it will override them.

If you want to contribute, I will help you as good as I can. Its just that I'm hardly using this module anymore, and if I am going to develop code for other people, at least I don't want to do it on my own.

pdesjardins commented 6 years ago

Thanks for the information!

If I'm able to figure out how to work with the code, I'd be happy to help maintain the project. At the moment, I'm using it heavily and I'd love to add some customizations that would suit my workflow.

I think it would make most sense for me to follow your advice here and take the next steps after that.

Thanks again!

Peter

On Thu, May 31, 2018 at 5:07 PM, Nils Knappmeier notifications@github.com wrote:

Hi Peter,

if you are planning to help developing this project, I will gladly give you push access to the repositories.

I think, despite priorities, I will still be able to release new versions, if needed.

As for local development... There are multiple ways. If you want to try changes to the templates, you should probably checkout all three bootprint-modules bootprint-openapi, bootprint-json-schema and bootprint-base. And link them together using npm link. You can then install bootprint globally and use the dev-mode to re-render the openapi-spec on-the-fly, once a template or stylesheet has changed.

I have written down the steps on https://gist.github.com/nknapp/ 02420131c1693db581788db18d925784

On the other hand, there are the test-cases in the test-directory. Each test consists of a openapi-spec and a mocha-testcase that compiles it and then inspects the generated output using cheerio. The generated html will appear in the test-output directory, within the project-root.

Handlebars itself does not have a mechanism to invoke templates from the command line. That was one of the reasons for writing bootprint in the first place.

If you'd rather change templates and partials, without contributing them, you can also create your own bootprint-module. Have a look here https://github.com/bootprint/bootprint/blob/next/doc/modules.md. Put your replacement templates in your modules partial-directory. If they are named like the original ones, it will override them.

If you want to contribute, I will help you as good as I can. Its just that I'm hardly using this module anymore, and if I am going to develop code for other people, at least I don't want to do it on my own.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bootprint/bootprint-openapi/issues/91#issuecomment-393680786, or mute the thread https://github.com/notifications/unsubscribe-auth/AGNY9xmQ9wcgHJw6yCRcp4qrlDJjS3vPks5t4FuhgaJpZM4MadL3 .