Conversation
5b027a6 to
b6afb5e
Compare
|
Visit the preview URL for this PR (updated for commit b6afb5e): https://docusaurus-openapi-36b86--pr1249-5y63xwne.web.app (expires Thu, 15 Jan 2026 22:20:59 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
|
Thanks @dsuket! The i18n approach looks solid — moving translatable strings from the plugin to the theme is the right move. Questions before merging:
|
Move qualifier-message rendering fully to the theme layer so that
Docusaurus i18n can translate the human-readable constraint strings:
- "characters" (minLength / maxLength)
- "non-empty" (minLength === 1)
- "Value must match regular expression" (pattern)
Architecture:
- `getQualifierMessage` is removed from the plugin and kept only in
the theme (`docusaurus-theme-openapi-docs/src/markdown/schema.ts`),
where `translate()` is available at render time.
- `SchemaItem` now computes `qualifierMessage` from its `schema` prop
when the caller doesn't pass one explicitly, so all callers are
simplified — no more `qualifierMessage={getQualifierMessage(schema)}`
at every call site.
- Plugin `createSchema.ts` and `Schema/index.tsx` drop all
`qualifierMessage` prop passes; the theme component handles it.
- `utils.ts` `create()` skips props with `undefined` values, cleaning
up generated MDX.
- Dead code removed: `humanizeConstraints`, `humanizeNumberRange`, and
related helpers were exported but unused.
Translation IDs added:
theme.openapi.schemaItem.characters
theme.openapi.schemaItem.nonEmpty
theme.openapi.schemaItem.expression
Demo directory intentionally untouched (no locale config added).
Closes #1249. Credit: @dsuket
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Thanks @dsuket! The approach is solid. Since this PR has been open for a while without updates, I've taken ownership and applied the changes in #1364 with one cleanup: the demo Closing this in favour of #1364. |
Move qualifier-message rendering fully to the theme layer so that
Docusaurus i18n can translate the human-readable constraint strings:
- "characters" (minLength / maxLength)
- "non-empty" (minLength === 1)
- "Value must match regular expression" (pattern)
Architecture:
- `getQualifierMessage` is removed from the plugin and kept only in
the theme (`docusaurus-theme-openapi-docs/src/markdown/schema.ts`),
where `translate()` is available at render time.
- `SchemaItem` now computes `qualifierMessage` from its `schema` prop
when the caller doesn't pass one explicitly, so all callers are
simplified — no more `qualifierMessage={getQualifierMessage(schema)}`
at every call site.
- Plugin `createSchema.ts` and `Schema/index.tsx` drop all
`qualifierMessage` prop passes; the theme component handles it.
- `utils.ts` `create()` skips props with `undefined` values, cleaning
up generated MDX.
- Dead code removed: `humanizeConstraints`, `humanizeNumberRange`, and
related helpers were exported but unused.
Translation IDs added:
theme.openapi.schemaItem.characters
theme.openapi.schemaItem.nonEmpty
theme.openapi.schemaItem.expression
Demo directory intentionally untouched (no locale config added).
Closes #1249. Credit: @dsuket
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…ect (#1365) * feat(i18n): make QualifierMessage strings translatable Move qualifier-message rendering fully to the theme layer so that Docusaurus i18n can translate the human-readable constraint strings: - "characters" (minLength / maxLength) - "non-empty" (minLength === 1) - "Value must match regular expression" (pattern) Architecture: - `getQualifierMessage` is removed from the plugin and kept only in the theme (`docusaurus-theme-openapi-docs/src/markdown/schema.ts`), where `translate()` is available at render time. - `SchemaItem` now computes `qualifierMessage` from its `schema` prop when the caller doesn't pass one explicitly, so all callers are simplified — no more `qualifierMessage={getQualifierMessage(schema)}` at every call site. - Plugin `createSchema.ts` and `Schema/index.tsx` drop all `qualifierMessage` prop passes; the theme component handles it. - `utils.ts` `create()` skips props with `undefined` values, cleaning up generated MDX. - Dead code removed: `humanizeConstraints`, `humanizeNumberRange`, and related helpers were exported but unused. Translation IDs added: theme.openapi.schemaItem.characters theme.openapi.schemaItem.nonEmpty theme.openapi.schemaItem.expression Demo directory intentionally untouched (no locale config added). Closes #1249. Credit: @dsuket Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(license): support SPDX identifier field in OAS v3.1.0 License Object Adds rendering support for the `identifier` field introduced in OAS v3.1.0, which is mutually exclusive with `url`. When present, links to the canonical SPDX license page at https://spdx.org/licenses/<identifier>.html. Closes #1319 * test(license): add demo test spec for SPDX identifier support Adds licenseIdentifier.yaml to demo/examples/tests to verify that a spec using license.identifier renders a clickable SPDX license link correctly. Related to #1319 * test(license): add licenseUrl.yaml for regression check alongside identifier test Related to #1319 * fix(types): add identifier field to LicenseObject Required for createLicense.ts to compile after adding SPDX identifier support. Closes #1319 --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Description
Motivation and Context
The QualifierMessage was not internationalized, so I fixed it.
How Has This Been Tested?
Screenshots (if appropriate)
Types of changes
Checklist