You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the following custom rule in the spectral ruleset:
response-object-additional-properties:
description: Every model of type object used in a response has additionalProperties=true
message: '{{path}} {{error}}'
severity: error
given: '$.components.schemas.[?(@.type == ''object'')]'
resolved: false
then:
function: response-object-additional-properties
and the following response-object-additional-properties.js function defined:
Run this CLI command: spectral lint 2020-09-14.yml
Error received:
Error #1: Function "responseObjectAdditionalProperties" threw an exception: parentPropertyName.endsWith is not a function
Error #2: Function "responseObjectAdditionalProperties" threw an exception: parentPropertyName.endsWith is not a function
Error #3: Function "responseObjectAdditionalProperties" threw an exception: parentPropertyName.endsWith is not a function
Expected behavior
I expected spectral to run without an error.
Additional context
This error appears in Spectral 6.4.0 and later. Spectral 6.3.0 does not exhibit this issue.
The text was updated successfully, but these errors were encountered:
phoenixy1
changed the title
Exception when running spectral 6.4.0 with specific custom rule using js function: endsWith is not a function
Exception when running spectral 6.4.0 or later with specific custom rule using js function: endsWith is not a function
Dec 11, 2023
Describe the bug
A custom rule that worked in spectral 6.3.0 and earlier is causing spectral to throw an exception in 6.4.0 and later
To Reproduce
and the following response-object-additional-properties.js function defined:
spectral lint 2020-09-14.yml
Expected behavior
I expected spectral to run without an error.
Additional context
This error appears in Spectral 6.4.0 and later. Spectral 6.3.0 does not exhibit this issue.
The text was updated successfully, but these errors were encountered: