feat: add OpenAPI post-processing and improve index generation#194
feat: add OpenAPI post-processing and improve index generation#194jp-ayyappan merged 6 commits intomainfrom
Conversation
- Add post-processing script (scripts/update-openapi-index.ts) that runs after docusaurus gen-api-docs to rename .info.mdx files to index.mdx and regenerate the OpenAPI clients index with correct links - Update gen-api-docs-all script to chain post-processing automatically - Refactor preprocessing.ts: extract shared SERVICE_DESCRIPTIONS and CATEGORY_MAPPING constants, add catch-all category for uncategorized APIs - Add footer license info distinguishing Docs (CC BY 4.0) from Code (BSD 3-Clause) - Add gray-matter dependency for frontmatter parsing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary of ChangesHello @jp-ayyappan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the OpenAPI documentation generation workflow by introducing automated post-processing steps. These changes ensure that the generated API documentation is well-structured, correctly linked, and clearly categorized, providing a more user-friendly experience for exploring the platform's services. The update also clarifies licensing information in the site footer. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a post-processing step for OpenAPI documentation generation, which is a great improvement for automating the build process. The refactoring of preprocessing.ts to separate concerns and use constants enhances maintainability. My review includes suggestions to improve code robustness by handling errors more gracefully, enhancing maintainability by adhering to best practices like avoiding inline styles, addressing a potential dependency issue, and a minor performance optimization.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move footer license inline styles to CSS class (footer__license-info) - Log unexpected errors in getDocIdFromInfoFile catch block instead of swallowing them silently - Use Map for O(1) spec lookups instead of Array.find() inside loop Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable post-processing step for OpenAPI documentation generation, which greatly improves the automation of the docs build. The refactoring of shared constants and the addition of robust handling for uncategorized APIs are excellent enhancements. My review includes a few suggestions for src/openapi/preprocessing.ts to further improve error handling and logging, aiming to make the script more robust and easier to maintain.
- Add try/catch + process.exit(1) to update-openapi-index.ts script - Use path.join for OPENAPI_INDEX_PAGE construction - Annotate samplesConfiguration with explicit Record<string, OpenApiPlugin.Options> type - Hoist getDocIdFromInfoFile to module level (was nested inside updateOpenApiIndex) - Remove redundant fs.existsSync guards (TOCTOU pattern) — rely on try/catch ENOENT - Replace delete spec.specPathModified mutation with clean destructuring to rebuild entry Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Guard fs.renameSync with existsSync check to avoid cross-OS inconsistency when destination index.mdx already exists - Log warning when ENOENT in getDocIdFromInfoFile (post-processing context means missing file likely indicates a doc generation failure) - Warn when SERVICE_DESCRIPTIONS entry is missing instead of silently falling back to generic "API documentation" string Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extend check-vendored-yaml to also walk docs/openapi/ in the platform repo via the GitHub Contents API and flag any .yaml files that are not registered in openApiSpecsArray. Specs with no paths (shared schema files like common and entity) are skipped automatically. If a new API spec is added to the platform repo without a corresponding entry in preprocessing.ts, the build will now fail with a clear message pointing to the missing registration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add \`scripts/update-openapi-index.ts\` post-processing script that runs after \`docusaurus gen-api-docs\` to: - Rename \`.info.mdx\` files to \`index.mdx\` (prevents duplicate sidebar entries) - Regenerate \`docs/OpenAPI-clients/index.md\` with correct directory-based links - Chain post-processing automatically via \`gen-api-docs-all\` npm script - Refactor \`preprocessing.ts\`: extract shared \`SERVICE_DESCRIPTIONS\` and \`CATEGORY_MAPPING\` constants, add catch-all category for uncategorized APIs - Extend \`check-vendored-yaml\` to detect unregistered spec files in the platform repo — walks \`docs/openapi/\` via the GitHub Contents API and fails the build if a new API spec exists upstream without a corresponding entry in \`openApiSpecsArray\` - Add footer license info distinguishing Docs (CC BY 4.0) from Code (BSD 3-Clause) - Add \`gray-matter\` dependency for frontmatter parsing 🔗 **https://opentdf-docs-preview-openapi-processing.surge.sh** | | Before (Production) | After (Preview) | |---|---|---| | OpenAPI Clients Index | [/OpenAPI-clients](https://opentdf.io/OpenAPI-clients) | [/OpenAPI-clients](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients) | These root pages previously did not resolve. This PR fixes them. | Service | Preview Link | |---|---| | Well-Known Configuration | [/OpenAPI-clients/wellknownconfiguration](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/wellknownconfiguration) | | KAS | [/OpenAPI-clients/kas](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/kas) | | V1 Authorization | [/OpenAPI-clients/authorization/v1](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/authorization/v1) | | V2 Authorization | [/OpenAPI-clients/authorization/v2](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/authorization/v2) | | V1 Entity Resolution | [/OpenAPI-clients/entityresolution/v1](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/entityresolution/v1) | | V2 Entity Resolution | [/OpenAPI-clients/entityresolution/v2](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/entityresolution/v2) | | Policy Objects | [/OpenAPI-clients/policy](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy) | | Policy Attributes | [/OpenAPI-clients/policy/attributes](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/attributes) | | Policy Namespaces | [/OpenAPI-clients/policy/namespaces](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/namespaces) | | Policy Actions | [/OpenAPI-clients/policy/actions](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/actions) | | Policy Subject Mapping | [/OpenAPI-clients/policy/subjectmapping](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/subjectmapping) | | Policy Resource Mapping | [/OpenAPI-clients/policy/resourcemapping](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/resourcemapping) | | Policy Obligations | [/OpenAPI-clients/policy/obligations](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/obligations) | | Policy Registered Resources | [/OpenAPI-clients/policy/registeredresources](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/registeredresources) | | Policy KAS Registry | [/OpenAPI-clients/policy/kasregistry](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/kasregistry) | | Key Management | [/OpenAPI-clients/policy/keymanagement](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/keymanagement) | | Policy Unsafe Service | [/OpenAPI-clients/policy/unsafe](https://opentdf-docs-preview-openapi-processing.surge.sh/OpenAPI-clients/policy/unsafe) | - Homepage redesign: #191 - License update: #187 (merged) - [ ] Run \`npm run gen-api-docs-all\` and verify no build warnings about missing \`.info.mdx\` files - [ ] Verify \`docs/OpenAPI-clients/index.md\` links resolve correctly - [ ] Run \`npm run build\` and confirm no broken link errors on \`/OpenAPI-clients\` - [ ] Verify \`check-vendored-yaml\` fails if a new spec with API paths exists in the platform repo but is not registered in \`openApiSpecsArray\` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Mike Morper <mike.morper@virtru.com>
Summary
Preview
🔗 https://opentdf-docs-preview-openapi-processing.surge.sh
Before vs After
Preview — API Endpoint Root Pages
These root pages previously did not resolve. This PR fixes them.
Related
Test plan
🤖 Generated with Claude Code