Skip to content

License identifier results in empty License section (OAS v3.1.0+) #1319

@pcolby

Description

@pcolby

Describe the bug

Prior to OpenAPI Spec v3.1.0, the Licence Object only allowed two fields1:

  1. name (required)
  2. 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:

  1. name (required)
  2. identified (optional)
  3. url (optional)

Where:

  • identifier is an SPDX expression; and
  • identifier and url are 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.0

Screenshots

Image

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

Additional Information

I can see that both identifier and url are implemented in this project's types:

It's just not being applied here:

Should be pretty simply, I suspect, to add identifier support to that createLicense function 🤞🏼

Footnotes

  1. https://spec.openapis.org/oas/v3.0.4.html#license-object

  2. https://spec.openapis.org/oas/v3.1.0.html#license-object

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions