contiamo / restful-react

A consistent, declarative way of interacting with RESTful backends, featuring code-generation from Swagger and OpenAPI specs 🔥
MIT License
1.87k stars 109 forks source link

[Question] Auth for Codegeneration #206

Open Canopix opened 4 years ago

Canopix commented 4 years ago

Describe the question I'm trying to generate code with this library, but the api needs credentials to access the JSON spec.

Is there a way to add credentials in the header of the request with the library (using the terminal) or maybe a sessionId, something like that?

fabien0102 commented 4 years ago

Hi @Canopix, Sadly the answer it's that it's actually not possible, we only support local files specs or host in github.

You can as workaround do a little script that fetch the specs and after exec the generator on the local file, or open a little PR to add this new feature (if you are interested of course 😃).

I guess you can add a "url" mode or something like this, with some headers options.

https://github.com/contiamo/restful-react/blob/master/src/bin/restful-react-import.ts everything is over there, please don't hesitate if you have any questions.

Since you have the needs, I let you propose a nice API that fill your requirements 😉