fix(license): support SPDX identifier field in OAS v3.1.0 License Object#1365
Merged
fix(license): support SPDX identifier field in OAS v3.1.0 License Object#1365
Conversation
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>
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
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
…ntifier test Related to #1319
Required for createLicense.ts to compile after adding SPDX identifier support. Closes #1319
|
Size Change: +5.17 kB (+0.23%) Total Size: 2.21 MB
ℹ️ View Unchanged
|
|
Visit the preview URL for this PR (updated for commit ce454f5): https://docusaurus-openapi-36b86--pr1365-3o9e7ijz.web.app (expires Wed, 29 Apr 2026 17:29:05 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
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.
Summary
identifierfield to the License Object as an SPDX expression, mutually exclusive withurlcreateLicenseonly rendered content whenurlwas present; specs usingidentifiergot an empty License sectionguard(identifier, ...)block that links tohttps://spdx.org/licenses/<identifier>.htmlTest plan
license.identifier: Apache-2.0(and nourl) renders a clickable "Apache 2.0" link pointing tohttps://spdx.org/licenses/Apache-2.0.htmllicense.urlstill renders correctly (no regression)license.name(nourloridentifier) renders the section header without a link (existing behavior)Closes #1319
🤖 Generated with Claude Code