Repository navigation
Add spec caching, light presets, Swashbuckle preset and theme browser tests - #7
Merged
Merged
Conversation
… tests - SpecCacheDuration (host): reuse a served spec for a period, sent with an ETag and private, no-cache. Never for a gated document, including one gated through ForDocument, detected per request. - LightThemePreset (host): Nord and GitHubLight, the palettes that publish a light variant. Sets the page color as well as the ramp, since ReDoc 3's light mode paints the page from --color-white. - ReDocDocumentsOptions.SwashbuckleSpecUrlTemplate (core), asserted against Swashbuckle's real UseSwagger route on both adapters. - tests/Hlibz.Redoc.Extensions.BrowserTests: the adapters' dark theme as both hosts render it, by computed color, with the two hosts compared. Found the oneOf switch's white unselected button, recorded in IDEAS.md. - Scalar beside ReDoc recipe in every package README, and CLAUDE.md fixes (DarkThemePreset name, the brotli bundle). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five items from the backlog: two features on our own host, a preset in core, a Scalar recipe, and browser tests for the adapters' dark theme.
What changed
Hlibz.Redoc.AspNetCore(our host)SpecCacheDuration(opt-in, off by default).Cache-Control: private, no-cache, so a returning browser gets a304.ForDocument(...).RequireAuthorization(), which the site can't see at startup, soWriteSpecalso checks the endpoint'sIAuthorizeDataon each request.LightThemePreset:NordandGitHubLight, the light counterparts of the dark presets.--color-white, not a slot in the grey scale. So a light preset sets a page colour, eleven greys and an accent, under:root:root:not(.dark).PrimaryColorturns off a light preset's accent.Midnight: that palette is this repo's own, and a light version would be invented.Hlibz.Redoc.Extensions.CoreReDocDocumentsOptions.SwashbuckleSpecUrlTemplate(/swagger/{documentName}/swagger.json), available in all three packages.Tests
tests/Hlibz.Redoc.Extensions.BrowserTestsfor the adapters' dark theme, added to CI.ReDocDarkThemeDefaultsexists for: page, sidebar, scrollbars, section captions, nested-schema wrappers, the selected sample tab, inline code and the control tokens. Computed colours rather than screenshots, because pixel comparisons fail on another OS's font rendering.UseSwagger()route, on both adapters.Docs
CLAUDE.mdfixes:ThemePresetnow readsDarkThemePreset, and the bundle note covers both the brotli and gzip copies.For reviewers
oneOfswitch's unselected button is hard-coded white on both redoc 2.0.0 and 2.5.4. The selected button differs only by a generated class name, so CSS can't target one without the other. The probe records the colour (identical on both hosts) without asserting it, and the fix is logged inIDEAS.md. It needs a small script, or giving up the selected button's highlight.CS0433ambiguity. Each host's wiring is its own file that imports only its alias; core stays global.WithOpenApiRoutePattern, soMapOpenApi()stays unmapped and a gated document stays closed. It advises giving Scalar only the public documents, because its sidebar shows the names of every document it was given.Testing
rgb(255, 255, 255); with the override restored, it passes.Sample.Ownwith a temporary setting (not committed). In light mode the page and sidebar compute to#eceff4and the text to#2e3440; dark mode keeps--color-white: #000000and the dark preset.GitHubLightis covered by unit tests only./scalar/and/scalar/{name}load the host-served specs,/openapi/...stays a 404, andMapScalarApiReference(...).RequireAuthorization(...)compiles. The Swashbuckle route pattern in the adapter READMEs was not run.🤖 Generated with Claude Code