Skip to content

Conversation

@b-long
Copy link
Contributor

@b-long b-long commented Jun 5, 2025

⚠️ This is a work-in-progress , it is not ready for review ⚠️

The goal of this PR is to enrich our docusaurus site, by adding docusaurus-openapi-docs and using it to embed OpenAPI/Swagger generated content.

Inspired by opentdf/platform#2366

Video ( rough / work-in-progress ♻️ )

Screen.Recording.2025-06-06.at.12.22.12.PM.mov

Context / background

  1. Currently, OpenTDF openapi YAML files do not process correctly using docusaurus-openapi-docs. Details about this are in Slack conversation with @cassandrabailey293 @strantalis , and @jrschumacher
    1. I've suggested making some changes to the inputs (namely, comments in .proto files, but am waiting to hear back about that work.
  2. In order to get this work done quickly, I've added a small preprocessing script we we can use to modify OpenTDF openapi YAML files before executing docusaurus-openapi-docs
    1. This has various benefits, including the following:
      1. We can improve documentation, even if upstream platform & SDK work is incomplete / not yet merged
      2. We can use the preprocessing step to ensure vendored YAML files match a particular release (e.g. https://github.com/opentdf/platform/releases/tag/service%2Fv0.6.0 )
      3. We can make changes to YAML files as inputs to docusaurus-openapi-docs, which may be irrelevant or innappropriate for the upstream https://github.com/opentdf/platform

Things that need to be done / un-done

  • Revert Disable false-positive machine / figure out the right way to tune Vale ➡️ recommend a new Jira ticket / PR
  • Use remote OpenAPI definition files
  • Determine if we need to run npm run gen-api-docs-all (explicitly) for CI builds. In other words, does this happen automatically?
  • Determine if we need to run npm run gen-api-docs-all (explicitly) for production builds. In other words, does this happen automatically?

@b-long b-long force-pushed the chore/add-docusaurus-theme-openapi-docs branch 4 times, most recently from b54d3e7 to 10f1cfa Compare June 6, 2025 18:39
@b-long
Copy link
Contributor Author

b-long commented Jun 9, 2025

@b-long b-long changed the title chore(docs): add docusaurus-theme-openapi-docs chore(docs): add docusaurus-plugin-openapi-docs and docusaurus-theme-openapi-docs Jun 9, 2025
@b-long b-long force-pushed the chore/add-docusaurus-theme-openapi-docs branch 2 times, most recently from 41cac66 to d49d6fc Compare June 10, 2025 16:00
@b-long b-long force-pushed the chore/add-docusaurus-theme-openapi-docs branch from d49d6fc to 01a268c Compare June 10, 2025 16:05
@b-long b-long force-pushed the chore/add-docusaurus-theme-openapi-docs branch from 01a268c to 5895cb1 Compare June 10, 2025 16:09
@b-long
Copy link
Contributor Author

b-long commented Jun 11, 2025

Replaced by #110

@b-long b-long closed this Jun 11, 2025
b-long added a commit that referenced this pull request Jun 13, 2025
This PR is a recreation of #109 .

## Description

The goal of this PR is to enrich our docusaurus site, by adding
[`docusaurus-openapi-docs`](https://github.com/PaloAltoNetworks/docusaurus-openapi-docs)
and using it to embed OpenAPI/Swagger generated content.

In this PR, we are vendoring the OpenAPI (YAML) files, which are found
in OpenTDF (
[here](https://github.com/opentdf/platform/tree/main/docs/openapi) ).

## Reviewing this PR

To generate the site for a typical deployment, build and start the site
as follows:

```
# Set env var, or simply skip it
export BUILD_OPENAPI_SAMPLES=0
rm -rf docs/SDK-OpenAPI/ docs/SDK-Samples/ specs-processed/
npm run gen-api-docs-clean && npm run gen-api-docs-all
npm run start
```


To generate the site including "art of the possible" (petstore &
bookstore examples), build and start the site as follows:

```
export BUILD_OPENAPI_SAMPLES=1 
rm -rf docs/SDK-OpenAPI/ docs/SDK-Samples/ specs-processed/
npm run gen-api-docs-clean && npm run gen-api-docs-all
npm run start
```

### Video 2 (loom)

https://www.loom.com/share/522b0eb6b2d34793ba555b1ca3a31722

### Video 1 

<details><summary>Click to show</summary>
<p>



https://github.com/user-attachments/assets/25f22aed-5ba5-4a4f-bd76-17acc5daf2df


</p>
</details> 
### To-do

- [ ] Determine if we need to run `npm run gen-api-docs-all`
(explicitly) for CI and/or production builds. In other words, does this
happen automatically?

### Defer / New Jira tickets

- [x] Revert [Disable false-positive
machine](d228655)
/ figure out the right way to tune Vale ➡️ recommend a new Jira ticket /
PR
- [ ] Use remote OpenAPI definition files? ➡️ recommend a new Jira
ticket / PR

### Vale

If I were king for a day, I'd just remove this tool.  

<details><summary>It's pretty unclear (to me) how to improve the
configuration quality</summary>
<p>




<img width="1495" alt="image"
src="https://github.com/user-attachments/assets/6e22dcc3-7b2e-4c47-bed7-040ee58137d9"
/>



</p>
</details> 


<details><summary>It's complaining about files that are untouched /
unmodified in this PR</summary>
<p>


<img width="1495" alt="image"
src="https://github.com/user-attachments/assets/c2908677-e306-4d74-8511-ac1bf1652715"
/>


</p>
</details> 

<details><summary>And some part of it's machinery / reviewdog thinks we
have too much content to process... which seems tricky, because clearly
we will have large diffs if we intend to version generated
content.</summary>
<p>




<img width="1495" alt="image"
src="https://github.com/user-attachments/assets/2ee4786d-24af-45ba-bbaa-2acecfafd97f"
/>



</p>
</details>
@b-long b-long deleted the chore/add-docusaurus-theme-openapi-docs branch July 3, 2025 14:41
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.

2 participants