Skip to content

fix: prepare API presentation at build time and preserve initial styles - #315

Merged
javorosas merged 3 commits into
mainfrom
fix/api-reference-static-presentation
Oct 23, 2026
Merged

javorosas merged 3 commits into
mainfrom
fix/api-reference-static-presentation

Conversation

@javorosas

@javorosas javorosas commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

The API reference briefly loses its layout in dark mode while JavaScript loads: icons become oversized, columns collapse, and parts of the content lose their styles. The page also clones and transforms the entire specification in each browser even though those presentation changes depend only on the specification and locale.

Presentation labels and property ordering are prepared while Docusaurus loads build content. The page passes the prepared specification directly to ReDoc. The original bundle remains the download source, so the Spanish and English OpenAPI contracts and SDK types do not change. ReDoc still hydrates for interactive schemas and samples.

Nested objects with local required lists display required fields first. The three composed customer creation alternatives also group their inherited required fields before optional contact fields. Invoice and retention creation roots retain the agreed stable field order across modes, so draft status does not move above customer. The required lists themselves are unchanged. Browser checks cover Mexican, foreign, and general-public customer variants.

The generated CSS needs two corrections before hydration. Redocusaurus emits an invalid dark-mode selector, and its dark stylesheet uses generated class names that differ from the light-theme HTML rendered on the server. The post-build correction fixes the selector and adds matching server-class alternatives to the dark selectors with :is(), preserving their specificity and their original hydrated classes. The correspondence comes from styled-components' per-component SSR metadata. Missing components, differing variant counts, or ambiguous mappings fail the build rather than silently publishing an incompatible stylesheet. This is a temporary dependency on that output format and must be reviewed during renderer upgrades; related upstream issue: rohit-gohri/redocusaurus#215. No DOM edits, dependency-source patches, or additional ReDoc render passes are introduced. PostCSS is declared as a build dependency and is not added to the browser bundle.

Validation: the complete Spanish/English production build passes without a heap override. Existing contract checks verify 127 operations in each language; downloaded schemas remain structurally identical to the source specifications. Ad hoc checks verify exact presentation parity with the previous implementation, both generated stylesheets, and rejection of incompatible SSR metadata. Browser checks use temporary script-free HTML copies to inspect light/dark Spanish and dark English before hydration; normal-page checks cover invoice draft tabs, customer alternatives, required markers, retention ordering, and switching both color modes. No new test cases were added to the suite.

@javorosas javorosas changed the title perf: prepare API reference presentation during build fix: prepare API presentation at build time and preserve initial styles Oct 21, 2026
@javorosas
javorosas marked this pull request as ready for review October 21, 2026 15:42
@javorosas

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T17:24:53.071068Z c514ba1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: c514ba1373

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@javorosas javorosas self-assigned this Oct 21, 2026
@javorosas javorosas added the bug label Oct 21, 2026
@javorosas
javorosas merged commit 062f258 into main Oct 23, 2026
1 check passed
@javorosas
javorosas deleted the fix/api-reference-static-presentation branch October 23, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant