-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
License URL Ignored, Redirects to SPDX Instead of Custom URL #2711
Comments
Looking at the code, I think I know what the issue is. This problem happen because of how the Current Logic:const licenseUrl =
license?.url || license?.identifier ? `https://spdx.org/licenses/${license?.identifier}.html` : undefined; This will cause the SPDX URL to be built whenever the Suggested Change:const licenseUrl = license?.url ? license?.url : license?.identifier ? `https://spdx.org/licenses/${license?.identifier}.html` : undefined; This will ensure that:
This should fix the issue and respect the mutually exclusive behavior between url and identifier. |
This ticket has been labeled jira. A tracking ticket in Stoplight's Jira ( |
@elmiomar Would you mind creating a PR for this please and add some tests? We'd be happy to review and merge. |
@mnaumanali94 I've created PR #2724. |
Description:
When using the Stoplight Elements API to render an OpenAPI specification, the
license.url
field is ignored, and instead, the system defaults to an SPDX URL format. Clicking on the license link redirects tohttps://spdx.org/licenses/undefined.html
when noidentifier
is given, even though theurl
is provided. According to the OpenAPI spec,url
andidentifier
are mutually exclusive, and I expect theurl
to be used when it is provided, instead of defaulting to an SPDX identifier.Steps to Reproduce:
Create an OpenAPI specification that uses a License object with a
url
field:Use Stoplight Elements API as described in Stoplight Elements Documentation to render the OpenAPI spec.
Click on the license link.
Expected Behavior:
The license link should direct to the provided
url
(https://www.nist.gov/open/copyright-fair-use-and-licensing-statements-srd-data-software-and-technical-series-publications
), even when noidentifier
is provided.Actual Behavior:
The license link incorrectly redirects to
https://spdx.org/licenses/undefined.html
, indicating that theurl
field is being ignored and the system is defaulting to an SPDX identifier even when no identifier is provided.Additional Notes:
identifier
andurl
fields are mutually exclusive, so only one of them should be used. In this case, if theurl
is provided, it should be respected and used for the license link.identifier
is provided, leading to incorrect redirection tohttps://spdx.org/licenses/undefined.html
.Screenshot:
Environment:
HTML setup: Following Stoplight Elements Documentation
Browser: Chrome - Version 128.0.6613.85 (Official Build) (arm64)
OS: macOS Sonoma 14.6.1
Please let me know if you need additional information.
The text was updated successfully, but these errors were encountered: