-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Valid "servers" URL values cause Spectral to crash #2064
Comments
Hmmm, we don't use Hm, We actually even have a test fixture having the very same server urls https://github.com/stoplightio/spectral/blob/develop/test-harness/scenarios/oas3.1/petstore.scenario. Are you sure it's not a custom ruleset that has some logic that's breaking? |
Thanks for looking into this!
If you're not able to reproduce the issue, I suppose it must be. Though, I believe I isolated my testing of this issue from any custom rulesets and I don't think we use |
Oops, turns out this is coming from a custom rule. Must've used the wrong |
Describe the bug
Spectral expects all URLs in the "servers" field of an API definition to create valid Node
URL
objects, despite the fact that this excludes valid field values according to the OpenAPI specification.To Reproduce
Run Spectral CLI on the document
spectral lint api-definition.yaml
See error:
Error running Nimma
It's a rather uninformative error but I am aware that work is being done to address this problem. Digging a bit deeper, this is the error happening inside nimma:
RuntimeError: $ threw: NodeError("Invalid URL: https://{username}.gigantic-server.com:{port}/{basePath}")
caused by this Node exception:
cause: TypeError [ERR_INVALID_URL]: Invalid URL: https://{username}.gigantic-server.com:{port}/{basePath}
Expected behavior
I would expect URL values that are allowed by the OpenAPI specification to not cause Spectral to crash. It surprises me that 1) these values are being used to create Node
URL
objects and 2) that these values are not at least being resolved (with the server variables and their default values, etc.) before validated with Node. Whatever the approach is, it should allow valid values for these fields.Environment (remove any that are not applicable):
The text was updated successfully, but these errors were encountered: