-
Notifications
You must be signed in to change notification settings - Fork 303
Description
Describe the bug
Prior to OpenAPI Spec v3.1.0, the Licence Object only allowed two fields1:
name(required)url(optional)
If present, this plugin will show a License section with the name and url accordingly.
However, as of OpenAPI Spec v3.1.0, there are now three allowed fields2:
name(required)identified(optional)url(optional)
Where:
identifieris an SPDX expression; andidentifierandurlare mutually exclusive.
Expected behavior
If an OpenAPI Spec uses either identifier or url, then this plugin should produce a License section with relevant content (as it already does for url).
Current behavior
If an OpenAPI Spec uses the identifier instead of url, then this plugin will produce a License section with no content.
Possible solution
In the case of identifier, I would suggest linking to:
https://spdx.org/licenses/<license-indentifier>.html
Steps to reproduce
Create an OpenAPI Spec, with a License Object like:
openapi: 3.1.0
info:
license:
name: Apache 2.0
identifier: Apache-2.0Screenshots
Context
We use SPDX identifiers wherever possible. And since OpenAPI Spec v3.1+ states identifier and url as mutually exclusive, we cannot simply provide both.
Your Environment
- Version used: v4.5.1 and v4.7.1
- Environment name and version: N/A
- Operating System and version: Server side.
- Link to your project: https://developers.dasintel.io/docs/api/user-farms/das-user-farms-rest-api
Additional Information
I can see that both identifier and url are implemented in this project's types:
docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/src/openapi/utils/types.ts
Line 303 in 7a5535e
identifier?: string; docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/src/openapi/utils/types/open-api.ts
Line 302 in 7a5535e
identifier?: string;
It's just not being applied here:
docusaurus-openapi-docs/packages/docusaurus-plugin-openapi-docs/src/markdown/createLicense.ts
Line 13 in 7a5535e
const { name, url } = license;
Should be pretty simply, I suspect, to add identifier support to that createLicense function 🤞🏼