-
Notifications
You must be signed in to change notification settings - Fork 4
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
Render html from openapi spec generated by typespec #707
Merged
munishchouhan
merged 64 commits into
master
from
675-render-api-docs-from-typespec-model
Jan 29, 2025
+163
−9
Merged
Changes from 57 commits
Commits
Show all changes
64 commits
Select commit
Hold shift + click to select a range
770041d
move tsp to resources
munishchouhan a64fa69
minor change
munishchouhan 618b366
added Dockerfile and build_and_push.sh
munishchouhan c27a455
added version and typo
munishchouhan d185114
reverted typespec.yml
munishchouhan 8fcc72d
reverted build.gradle
munishchouhan 5213ec8
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan a79474b
added tag-and-push-docs.sh
munishchouhan 0d4658b
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan cb3620f
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan aa0c234
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan a237891
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan fc4dc50
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan 9600f41
change repo
munishchouhan 532303c
added swagger ui
munishchouhan c1dd3dc
added doc release job
munishchouhan ff8b60d
removed doc release job from build.yml [ci skip]
munishchouhan d23bf80
[release-docs] version 1.16.7
munishchouhan 879d24b
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan 927c4ad
[release] version 1.16.7
munishchouhan c014721
Revert "release version 1.16.7"
munishchouhan dcdb065
added open-api.yml
munishchouhan c338c3d
corrected repo details
munishchouhan 1aa35c2
corrected repo details
munishchouhan 7e61018
added push in typesepc.yml
munishchouhan a76ae63
fixed Dockerfile
munishchouhan 6546f05
fixed error
munishchouhan 4a70e0b
change port to 9080
munishchouhan 887c9a7
set typespec version
munishchouhan ee99ce4
refactored
munishchouhan ea138a7
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan a6256cb
added stage and dev URL
munishchouhan 1ef6102
openapi port changed to 9080
munishchouhan 84ad4f4
refactored
munishchouhan 32b6bb9
[release docs] bump docs 1.16.8-A0
munishchouhan ff460cd
[release docs] bump docs 1.16.8-A1
munishchouhan b9a719b
[release docs] bump docs 1.16.8
munishchouhan c5c7d85
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan 47a54c7
Update .github/workflows/typespec.yml
munishchouhan 7e9af94
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan 4eec2e6
added /openapi
munishchouhan 4a88852
[release] bump 1.16.9-A0
munishchouhan 4f054b0
[release] bump 1.16.9-A1
munishchouhan 29e2ce8
revert version [ci skip]
munishchouhan 39db05c
added test
munishchouhan 01cafe7
moved /openapi to ServiceInfoController
munishchouhan 93350c1
remove println [ci skip]
munishchouhan a77e1b8
fetch openapi version from VERSION file
munishchouhan b5e8ab2
[release] bump 1.16.9-A2
munishchouhan 6e39292
[release] bump 1.16.9-A3
munishchouhan e5bd5ae
[release] bump 1.16.9-A4
munishchouhan 8e26d55
revert version [ci skip]
munishchouhan 03ca474
fixed openapi version issue
munishchouhan a3753a6
[release] bump 1.16.9-A5
munishchouhan 0ba0723
[release] bump 1.16.9-A6
munishchouhan d8c9141
revert version [ci skip]
munishchouhan 9bbf911
renamed to tag-and-push-openapi.sh
munishchouhan c72497f
changed to nginxinc/nginx-unprivileged
munishchouhan 37cc09c
removed unused commands
munishchouhan 932a00e
[release] bump 1.16.9-A6
munishchouhan 5bfdfcd
[release] bump 1.16.9-A7
munishchouhan 8feeea5
[release] bump 1.16.9-A8
munishchouhan 7eeab53
revert version [ci skip]
munishchouhan eec1633
Merge branch 'master' into 675-render-api-docs-from-typespec-model
munishchouhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/test/groovy/io/seqera/wave/controller/ServiceInfoControllerTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Wave, containers provisioning service | ||
* Copyright (c) 2024, Seqera Labs | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.seqera.wave.controller | ||
|
||
import spock.lang.Specification | ||
|
||
import io.micronaut.http.HttpResponse | ||
import io.micronaut.http.HttpStatus | ||
|
||
/** | ||
* | ||
* @author Munish Chouhan <[email protected]> | ||
*/ | ||
class ServiceInfoControllerTest extends Specification { | ||
|
||
def 'should redirect to /openapi/'() { | ||
given: | ||
def controller = new ServiceInfoController() | ||
|
||
when: | ||
HttpResponse response = controller.getOpenAPI() | ||
|
||
then: | ||
response.status == HttpStatus.MOVED_PERMANENTLY | ||
response.header('Location') == '/openapi/' | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM nginx:alpine | ||
|
||
# Copy index.html and openapi.yaml to the Nginx html directory | ||
COPY index.html /usr/share/nginx/html/openapi/index.html | ||
COPY tsp-output/@typespec/openapi3/openapi.yaml /usr/share/nginx/html/openapi/openapi.yaml | ||
|
||
# Use sed to modify the default Nginx configuration to listen on port 9080 | ||
RUN sed -i 's/listen 80;/listen 9080;/' /etc/nginx/conf.d/default.conf | ||
|
||
# Expose port 9080 | ||
EXPOSE 9080 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Wave API Documentation</title> | ||
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist/swagger-ui.css"> | ||
</head> | ||
<body> | ||
<div id="swagger-ui"></div> | ||
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js"></script> | ||
<script src="https://unpkg.com/swagger-ui-dist/swagger-ui-standalone-preset.js"></script> | ||
<script> | ||
window.onload = function() { | ||
const ui = SwaggerUIBundle({ | ||
url: "openapi.yaml", | ||
dom_id: '#swagger-ui', | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIStandalonePreset | ||
], | ||
layout: "BaseLayout" | ||
}); | ||
window.ui = ui; | ||
}; | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import "@typespec/http"; | ||
import "@typespec/rest"; | ||
import "@typespec/openapi3"; | ||
import "@typespec/versioning"; | ||
import "./routes.tsp"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"name": "wave", | ||
"version": "1.8.2", | ||
"version": "1.16.7", | ||
"type": "module", | ||
"dependencies": { | ||
"@typespec/compiler": "latest", | ||
"@typespec/http": "latest", | ||
"@typespec/rest": "latest", | ||
"@typespec/openapi3": "latest" | ||
"@typespec/compiler": "0.64.0", | ||
"@typespec/http": "0.64.0", | ||
"@typespec/openapi3": "0.64.0", | ||
"@typespec/rest": "0.64.0" | ||
}, | ||
"private": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
# | ||
# Wave, containers provisioning service | ||
# Copyright (c) 2023-2024, Seqera Labs | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
# | ||
|
||
# Tag and and push the the GitHub repo and Docker images | ||
|
||
set -e | ||
set -x | ||
|
||
SED=sed | ||
[[ $(uname) == Darwin ]] && SED=gsed | ||
|
||
RELEASE=${RELEASE:-$(git show -s --format='%s' | $SED -rn 's/.*\[(release)\].*/\1/p')} | ||
|
||
if [[ $RELEASE ]]; then | ||
TAG=v$(cat VERSION) | ||
version=$(cat VERSION) | ||
|
||
cd typespec | ||
sed -i "s/version: 0.0.0/version: $version/" "tsp-output/@typespec/openapi3/openapi.yaml" | ||
|
||
docker build -t 195996028523.dkr.ecr.eu-west-1.amazonaws.com/wave/openapi:$TAG . | ||
docker push 195996028523.dkr.ecr.eu-west-1.amazonaws.com/wave/openapi:$TAG | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
emit: | ||
- "@typespec/openapi3" | ||
options: | ||
"@typespec/openapi3": | ||
output-file: openapi.yaml |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They provide an un unprivileged image that does not require this https://hub.docker.com/r/nginxinc/nginx-unprivileged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done