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 API docs from TypeSpec model #675

Open
pditommaso opened this issue Oct 9, 2024 · 4 comments · May be fixed by #707
Open

Render API docs from TypeSpec model #675

pditommaso opened this issue Oct 9, 2024 · 4 comments · May be fixed by #707

Comments

@pditommaso
Copy link
Collaborator

The goal of this issue is to render the API docs to a HTML content by using the TypeSpec model.

This could be done by converting TypeSpec to OpenAPI/Swagger and then converting to HTML by using https://rapidocweb.com/

@pditommaso
Copy link
Collaborator Author

tagging @andrew-dawson-seqera and @ewels for visibility

@munishchouhan
Copy link
Member

we can use something like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>API Documentation</title>
</head>
<body>
<rapi-doc
        spec-url="./openapi.yaml"
        theme="light"
        render-style="read"
        show-header="true"
        show-info="true"
        show-methods-in-nav="true"
></rapi-doc>

<!-- Include RapiDoc script -->
<script src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
</body>
</html>

and we tsp compile . generates openapi.yml

@pditommaso
Copy link
Collaborator Author

Likely, if I remember correctly Platform is doing something similar

@munishchouhan
Copy link
Member

in their case they are using swagger annotation in code and html file is present in resources, so its become easier to host, in our case its in another directory

@munishchouhan munishchouhan linked a pull request Oct 21, 2024 that will close this issue
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.

2 participants