-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
fix(rulesets): variable not supported in server url within OAS 3.1 #1914
Conversation
@@ -138,7 +140,8 @@ | |||
"type": "object", | |||
"properties": { | |||
"url": { | |||
"$ref": "#/$defs/uri" | |||
"type": "string", | |||
"format": "uri-template" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the original schema has uri-reference
here.
@@ -167,7 +170,7 @@ | |||
"default": { | |||
"type": "string" | |||
}, | |||
"descriptions": { | |||
"description": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo, it's description
-> https://spec.openapis.org/oas/v3.1.0#server-object
a8f5bf8
to
23cb15b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks OK - more just questions for my own edification on the changes to the schema.
@@ -840,45 +856,42 @@ | |||
"default": false, | |||
"type": "boolean" | |||
}, | |||
"allowEmptyValue": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 where did this go? And why didn't header have schema or content before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for Header Object, and allowEmptyValue
is not a valid trait since it only applies to query parameters and Header Object has to follow "header"
All traits that are affected by the location MUST be applicable to a location of header (for example, style).
}, | ||
"explode": { | ||
"default": false, | ||
"type": "boolean" | ||
}, | ||
"allowReserved": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto - seems like a substantial change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -909,7 +922,8 @@ | |||
"type": "object", | |||
"properties": { | |||
"$ref": { | |||
"$ref": "#/$defs/uri" | |||
"type": "string", | |||
"format": "uri-reference" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting - why did some "#/$defs/uri"
become uri
(see towards top of file), and some uri-reference
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uri-reference
means it can be a relative URI, like ../foo.json
, while uri
format enforces a well-formed absolute URI with the scheme and so on.
@@ -1003,7 +1017,8 @@ | |||
"const": "http" | |||
}, | |||
"scheme": { | |||
"const": "bearer" | |||
"type": "string", | |||
"pattern": "^[Bb][Ee][Aa][Rr][Ee][Rr]$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha yeah, it's case insensitive 😆
# [@stoplight/spectral-rulesets-v1.2.7](https://github.com/stoplightio/spectral/compare/@stoplight/spectral-rulesets-v1.2.6...@stoplight/spectral-rulesets-v1.2.7) (2021-10-25) ### Bug Fixes * **rulesets:** exclusiveMinimum must be a number thrown for OAS 3.0 ([#1913](#1913)) ([65d287a](65d287a)) * **rulesets:** variable not supported in server url within OAS 3.1 ([#1914](#1914)) ([c4f6762](c4f6762))
🎉 This PR is included in version @stoplight/spectral-rulesets-v1.2.7 🎉 The release is available on npm package (@latest dist-tag) Your semantic-release bot 📦🚀 |
Fixes #1911
Checklist
Does this PR introduce a breaking change?
Additional context
I treated this issue as an opportunity to pull the latest JSON Schema definition for OAS 3.1.
That being said, a few manual changes have been applied:
$dynamicRef
->$ref
cause Ajv doesn't like it. The former definition has the same transformation applied.descriptions
- should bedescription
url
property in schema had still an invalid type - they changeduri
touri-reference
, but it'suri-template
.