KorbinianKuhn / raml2html-material-theme

MIT License
2 stars 4 forks source link

Optionally add cURL commands ? #4

Open bog-dan-ro opened 5 years ago

bog-dan-ro commented 5 years ago

I really like your theme, IMHO the biggest missing feature is the cURL commands.

KorbinianKuhn commented 5 years ago

Thanks bog-dan-ro.

Can you specify your wish? Do you want to call the API through the theme with HTTP requests? Like a prefilled mini postman?

bog-dan-ro commented 5 years ago

I was thinking to something simpler, like this https://www.npmjs.com/package/raml2html-slate-theme theme. An optional call of the api trough the generated HTML will be a bonus ;)

KorbinianKuhn commented 5 years ago

Ok this would definitly be a nice feature and improve API work. I will take a look into that. I think the main complexity is the URI and Body generation. If we have that, it should be straight forward to have the curl command and also to send requests from within the template.

bog-dan-ro commented 5 years ago

Thanks a lot!

bog-dan-ro commented 5 years ago

The URI is quite easy, each RAML document should start like:

#%RAML 1.0
---
title: e-BookMobile API
baseUri: http://api.e-bookmobile.com/{version}
version: v1

So, you have the URI prefix (http://api.e-bookmobile.com/v1/), then you just need to append every (sub)resource.

Body, you al ready generate it to show the examples, so, IMHO should not be a problem.

KorbinianKuhn commented 5 years ago

I'm currently working on a complete rewrite of the theme, switching from the nunjucks and materialize approach to an angular build. So the new theme will be written in angular, compiled to a single index.nunjucks file, that will be published on npm. This will bring a lot of improvements: