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

Update host name in Swagger file automatically #1360

Closed
2 of 3 tasks
philippeluickx opened this issue Aug 5, 2016 · 7 comments · Fixed by #1600
Closed
2 of 3 tasks

Update host name in Swagger file automatically #1360

philippeluickx opened this issue Aug 5, 2016 · 7 comments · Fixed by #1600
Assignees
Milestone

Comments

@philippeluickx
Copy link
Contributor

philippeluickx commented Aug 5, 2016

A swagger file will include a host name. This should be replaced with the URL used at apinf.io
e.g. api.mycompany.com/list (original swagger file) > apinf.io/mycompany/list?key=abc (swagger-ui)

Also the key should be included if required. If user is not logged in, then show a message that in order to use the API, you need a key (and thus an account).

Definition of done

  • Before displaying the file to the user, the viewer checks whether the API is connected to a proxy. If the API is connected to a proxy, the viewer updates the following, if necessary
    • Host name in the Swagger file: original base URL replaced with apinf base URL:
      e.g. api.mycompany.com/list (original swagger file) > apinf.io/mycompany/list?key=abc (swagger-ui)
    • Add API key authorization and use the end user's API key.
      Open issue: What if the user does not have an API key? Either the user could be an anonymous (unregistered) user or a registered user who has not pressed the Get API key button?
@bajiat
Copy link
Contributor

bajiat commented Aug 9, 2016

The user uploading the document should also be notified about replacing the host URL

@bajiat bajiat changed the title Update swagger documentation automatically Update host name in Swagger file automatically Aug 10, 2016
@bajiat
Copy link
Contributor

bajiat commented Aug 10, 2016

Option: Write an instruction how to change the host for Swagger file, if they want calls from Swagger UI to go through proxy. (Construct the URL for the instruction programmatically)

@philippeluickx
Copy link
Contributor Author

Might be good to have by default make it go through apinf. IMO doing requests straight to backend should be blocked, except if it comes from apinf.

@bajiat
Copy link
Contributor

bajiat commented Sep 9, 2016

This might also close #1430.

@bajiat
Copy link
Contributor

bajiat commented Sep 12, 2016

@marla-singer Hi, can you let us know what is your status with tasks #1360 and #1490?

@bajiat bajiat added this to the Sprint 31 milestone Sep 12, 2016
@marla-singer
Copy link
Contributor

@bajiat Task #1490 is ready and expected review. I have some questions about this task and want to discuss in chat

@bajiat
Copy link
Contributor

bajiat commented Sep 14, 2016

Here is my suggestion for replacing the host

  1. Check if there is a host
  2. Check if it the same as API host in API collection/schema
    If not, do nothing (this is the case that they might be connecting to staging or equivalent)
    If yes, check whether the API is connected to a proxy
  3. If connected to a proxy, replace the host and the basePath
    with Proxy host and proxy base path from API backend collection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants