A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI (v3.1, v3.0, and v2.0), Arazzo v1.0, as well as AsyncAPI v2.x.
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.
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.