stoplightio / spectral

A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v3.1, v3.0, and v2.0 as well as AsyncAPI v2.x.
https://stoplight.io/spectral
Apache License 2.0
2.35k stars 226 forks source link

tokenUrl doesn't permit for relative references in OAS 3.1 #2635

Open saturna opened 4 weeks ago

saturna commented 4 weeks ago

Describe the bug In OAS 3.0 tokenUrl was of uri-reference type but in 3.1 it seemed to be switched back to uri As per OAS 3.1 documentation tokenUrl should be of type URL and as per section Relative References in URLs:

Unless specified otherwise, all properties that are URLs MAY be relative references as defined by [RFC3986]. RFC-3986 section 4.2 link

I'm assuming that tokenUrl should in fact permit relative paths and default to a baseURL as defined by the Server Object

This would make sense because using tools such as editor-next.swagger.io, Authorize button should allow for baseUrl selection from the Servers drop-down. If tokenUrl cannot use relative paths, it will not work with this drop-down. image

To Reproduce

Expected behavior Spectral validation should pass and allow for relative URLs

Environment (remove any that are not applicable):

daniel-white commented 3 weeks ago

this definitely seems to be a bug. we would welcome a PR as rulesets are pretty straight forward to change. thanks!