Skip to content
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

Injecting API Key in built document #203

Open
aroach opened this issue Dec 13, 2018 · 1 comment
Open

Injecting API Key in built document #203

aroach opened this issue Dec 13, 2018 · 1 comment

Comments

@aroach
Copy link

aroach commented Dec 13, 2018

I had opened an issue in the Shins project along these lines, but felt it might be better(?) considered here. Mermade/shins#53

To state the scenario from that issue:
Once a user is logged into our site, I'd like to be able to inject a user's API key dynamically into the API calls within the documentation. I'm using Widdershins to generate the base docs from OpenAPISpec, and wondering if I would need to add a div/id into the generated Markdown, and then have some custom JS in Shins to accomplish this.

I started experimenting with this approach, but I realized that because many of the places I'd like to inject the user's API Key value are code fenced, I don't see a way that JS within the shins site would have easy access to that element I was considering adding.

Didn't know if any JS wizards in this project might have a suggestion...

@MikeRalphson
Copy link
Contributor

I wonder if changes in both widdershins and shins might be needed to achieve this?

  • In widdershins to tag the api-keys with <span class="apikey"></span> or similar prior to the syntax-highlighting being applied.
  • In shins some Javascript to replace those values with the injected api-key

What do you think?

@MikeRalphson MikeRalphson pinned this issue Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants