Skip to content

docs: show SwaggerUI persistAuthorization in DocsRendererConfig example - #1122

Merged
wolveix merged 1 commit into
danielgtaylor:mainfrom
ize-302:docs/add-persist-authorization-reference
Sep 27, 2026
Merged

wolveix merged 1 commit into
danielgtaylor:mainfrom
ize-302:docs/add-persist-authorization-reference

Conversation

@ize-302

@ize-302 ize-302 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds swagger UI's persistAuthorization option to keep credentials across page reloads. Huma already supports it via the DocsRenderConfig. It just wasn't documented so it was easy to miss

  • Docs: add "persistAuthorization": true to the SwaggerUI DocsRendererConfig example in docs/docs/features/api-docs.md.
  • Test: extend TestDocsRenderers/SwaggerUIRendererConfig to check that the option is serialized into the docs page's data-config attribute.

Usage

config.DocsRenderer = huma.DocsRendererSwaggerUI
config.DocsRendererConfig = map[string]any{
      "persistAuthorization": true,
}

## Summary

Adds swagger UI's `persistAuthorization` option to keep credentials
across page reloads. Huma already supports it via the
`DocsRenderConfig`. It just wasn't documented so it was easy to miss

- **Docs:** add `"persistAuthorization": true` to the SwaggerUI
`DocsRendererConfig` example in `docs/docs/features/api-docs.md`.
- **Test:** extend `TestDocsRenderers/SwaggerUIRendererConfig` to check
that the option is serialized into the docs page's `data-config`
attribute.

## Usage

```go
config.DocsRenderer = huma.DocsRendererSwaggerUI
config.DocsRendererConfig = map[string]any{
      "persistAuthorization": true,
}
@codecov

codecov Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.19%. Comparing base (5d2b1be) to head (2c0e4f4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1122   +/-   ##
=======================================
  Coverage   93.19%   93.19%           
=======================================
  Files          24       24           
  Lines        5008     5008           
=======================================
  Hits         4667     4667           
  Misses        273      273           
  Partials       68       68           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wolveix
wolveix merged commit ef50837 into danielgtaylor:main Sep 27, 2026
4 checks passed
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