Commit 216d6bd
fix(license): support SPDX identifier field in OAS v3.1.0 License Object (#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>1 parent 59e7ecc commit 216d6bd
File tree
4 files changed
+64
-1
lines changed- demo/examples/tests
- packages/docusaurus-plugin-openapi-docs/src
- markdown
- openapi
4 files changed
+64
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
| |||
0 commit comments