Skip to content

Commit

Permalink
Update swagger-initializer.js (#2543)
Browse files Browse the repository at this point in the history
* Update swagger-initializer.js

* update docs
  • Loading branch information
metasyn authored Dec 11, 2024
1 parent 3fe9605 commit e4a9645
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 35 deletions.
31 changes: 1 addition & 30 deletions apiserver/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,36 +97,7 @@ To update the swagger ui files deployed with the Kuberay API server, you'll need
* Manually run the [hack/update-swagger-ui.bash](hack/update-swagger-ui.bash) script. The script downloads the swagger ui release and copies the downloaded files
to the [../third_party/swagger-ui](../third_party/swagger-ui/) directory. It copies the [swagger-initializer.js](../third_party/swagger-ui/swagger-initializer.js)
to [swagger-initializer.js.backup](../third_party/swagger-ui/swagger-initializer.js.backup).
* Update the contents of the [swagger-initializer.js](../third_party/swagger-ui/swagger-initializer.js) to set the URLs for for the individual swagger docs. The content of the file is show below:

```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>
};
```

* Update the contents of the [swagger-initializer.js](../third_party/swagger-ui/swagger-initializer.js) to set the URLs for for the individual swagger docs.
* Execute `make build-swagger` target to update the contents of the [datafile.go](pkg/swagger/datafile.go) file. This will package the content of the [swagger-ui](../third_party/swagger-ui/) directory for serving by the api server (see [func serveSwaggerUI(mux *http.ServeMux)](https://github.com/ray-project/kuberay/blob/f1067378bc99987f3eba1e5b12b4cc797465336d/apiserver/cmd/main.go#L149) in [main.go](cmd/main.go))

The swagger ui is available at the following URLs:
Expand Down
10 changes: 5 additions & 5 deletions third_party/swagger-ui/swagger-initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ window.onload = function() {
// 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"}],
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"}],
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
Expand Down

0 comments on commit e4a9645

Please sign in to comment.