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

Render html from openapi spec generated by typespec #707

Merged
merged 64 commits into from
Jan 29, 2025

Conversation

munishchouhan
Copy link
Member

@munishchouhan munishchouhan commented Oct 21, 2024

This PR will do the followings:

  1. Move typespec to resources
  2. create gradle task to install and compile typespec to generate openapi.yaml
  3. create html to render openapi using swagger ui

Signed-off-by: munishchouhan <[email protected]>
@munishchouhan munishchouhan linked an issue Oct 21, 2024 that may be closed by this pull request
Signed-off-by: munishchouhan <[email protected]>
@munishchouhan munishchouhan self-assigned this Oct 21, 2024
@pditommaso
Copy link
Collaborator

Not sure we should include this stuff within wave backend

@munishchouhan
Copy link
Member Author

Not sure we should include this stuff within wave backend

so we want to host them separately?

@pditommaso
Copy link
Collaborator

Think would make more sense, either in the main docs or a mini dedicated app. Tagging @ewels

@ewels
Copy link
Member

ewels commented Oct 21, 2024

Yup, I'd expect to keep just the typespec in the repo and have everything else compiled and hosted separately. Where that happens I don't have a strong opinion on - either the Wave service itself? Or the docs website? (NB: Not the docs repo).

Tagging @llewellyn-sl @andrew-dawson-seqera

@ewels
Copy link
Member

ewels commented Oct 21, 2024

Looks like the Platform API docs are hosted at https://cloud.seqera.io/openapi/index.html

So Wave docs could live at https://wave.seqera.io/openapi/index.html for example?

@pditommaso
Copy link
Collaborator

That's fine. Then we need to create a mini nginx service to render the docs.

@munishchouhan
Copy link
Member Author

Screenshot 2024-10-23 at 13 07 15

Copy link
Collaborator

@pditommaso pditommaso left a comment

Choose a reason for hiding this comment

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

Nice, then we need to including this container build in the same process for the wave app container.

@munishchouhan
Copy link
Member Author

Nice, then we need to including this container build in the same process for the wave app container.

ok sure

@ewels
Copy link
Member

ewels commented Nov 18, 2024

Not sure what the web UI is there - any chance that we can use Swagger so that it has the same look + feel as https://cloud.seqera.io/openapi/index.html please?

@munishchouhan
Copy link
Member Author

Not sure what the web UI is there - any chance that we can use Swagger so that it has the same look + feel as https://cloud.seqera.io/openapi/index.html please?

ok I will look into it

@munishchouhan
Copy link
Member Author

now using swagger ui
Screenshot 2025-01-15 at 15 17 33

@pditommaso
Copy link
Collaborator

Nice

Signed-off-by: munishchouhan <[email protected]>
Copy link
Collaborator

Choose a reason for hiding this comment

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

typespec/tag-and-push-openapi.sh

Copy link
Member Author

Choose a reason for hiding this comment

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

it is to build and push openapi container

namespace wave {
enum Versions {
v1: "1.16.8",
Copy link
Collaborator

Choose a reason for hiding this comment

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

should this be updated manually?

Copy link
Member Author

@munishchouhan munishchouhan Jan 24, 2025

Choose a reason for hiding this comment

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

yes for now, typespec.yml only runs when there is a change in typespec folder and to make a doc release, we need a change there in the commit to make typespec ci run

Copy link
Collaborator

Choose a reason for hiding this comment

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

Would not be simpler just using a placeholder value e.g. 0.0.0 and use sed command or something similar to update it using the version in VERSION ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, that can be an option, i will move doc release to build.yml too
to not rely on typespec chnages

Copy link
Member Author

@munishchouhan munishchouhan Jan 24, 2025

Choose a reason for hiding this comment

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

ok better adding VERSION path in typespec.yml, so that it runs when we change VERSION

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
@munishchouhan
Copy link
Member Author

Tested successfully in dev
Screenshot 2025-01-26 at 21 45 45
Screenshot 2025-01-26 at 21 45 21

Copy link
Collaborator

Choose a reason for hiding this comment

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

tag-and-push-openapi.sh

Copy link
Member Author

Choose a reason for hiding this comment

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

done

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
Copy link
Collaborator

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

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
Signed-off-by: munishchouhan <[email protected]>
@munishchouhan
Copy link
Member Author

tested in dev:
Screenshot 2025-01-28 at 12 45 11
Screenshot 2025-01-28 at 12 45 04

@munishchouhan munishchouhan merged commit d3dfee9 into master Jan 29, 2025
5 checks passed
@munishchouhan munishchouhan deleted the 675-render-api-docs-from-typespec-model branch January 29, 2025 11:34
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.

Render API docs from TypeSpec model
4 participants