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 swagger-initializer.js #2543

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

metasyn
Copy link

@metasyn metasyn commented Nov 14, 2024

Why are these changes needed?

If the service is behind an HTTPS endpoint, you cannot load the swagger-ui

Related issue number

Closes #2542

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

Comment on lines -102 to -128
```javascript
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">

// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
spec: location.host,
urls: [{"url":"http://"+location.host+"/swagger/serve.swagger.json","name":"RayServe Service"},
{"url":"http://"+location.host+"/swagger/error.swagger.json","name":"Errors API"},
{"url":"http://"+location.host+"/swagger/job.swagger.json","name":"RayJob Service"},
{"url":"http://"+location.host+"/swagger/config.swagger.json","name":"ComputeTemplate Service"},
{"url":"http://"+location.host+"/swagger/cluster.swagger.json","name":"Cluster Service"}],
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});

//</editor-fold>
};
```
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be inlined, since the actual file is already hyperlinked. It just means one more thing to update.

Comment on lines +7 to +11
urls: [{"url":window.location.protocol+"//"+location.host+"/swagger/serve.swagger.json","name":"RayServe Service"},
{"url":window.location.protocol+"//"+location.host+"/swagger/error.swagger.json","name":"Errors API"},
{"url":window.location.protocol+"//"+location.host+"/swagger/job.swagger.json","name":"RayJob Service"},
{"url":window.location.protocol+"//"+location.host+"/swagger/config.swagger.json","name":"ComputeTemplate Service"},
{"url":window.location.protocol+"//"+location.host+"/swagger/cluster.swagger.json","name":"Cluster Service"}],
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns http: or https: depending on which protocol you're using.

@metasyn metasyn marked this pull request as ready for review November 14, 2024 21:03
@kevin85421
Copy link
Member

cc @YQ-Wang would you mind reviewing this PR? Thanks!

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 this pull request may close these issues.

[Bug] kuberay/apiserver deployment via helm doesn't respect https serving for swagger-ui
2 participants