Skip to content

cannot use builtin functions from override rule #2447

@rittneje

Description

@rittneje

Describe the bug

If I do this:

extends:
- "spectral:oas"
- "spectral:asyncapi"
aliases:
  OperationObject:
    - "#PathItem[get,put,post,delete,options,head,patch,trace]"
  PathItem:
    - $.paths[*]
overrides:
- files: ["*"]
  rules:
    operation-description:
      given: '#OperationObject'
      then:
        field: 'summary'
        function: 'truthy'
      severity: warn

I get an error:

Error running Spectral!
Error #1: Function is not defined
          at validateFunction  …tors/function.ts:27  return new RulesetV…
          at validate26        …ompile/index.ts:171  const makeValidate …
          at validate15        …ompile/index.ts:171  const makeValidate …
          at validate45        …ompile/index.ts:171  const makeValidate …
          at validate14        …ompile/index.ts:171  const makeValidate …

If I do this similar thing:

extends:
- "spectral:oas"
- "spectral:asyncapi"
aliases:
  OperationObject:
    - "#PathItem[get,put,post,delete,options,head,patch,trace]"
  PathItem:
    - $.paths[*]
rules:
  operation-summary:
    given: '#OperationObject'
    then:
      field: 'summary'
      function: 'truthy'
    severity: warn

Then it works.

Environment (remove any that are not applicable):

  • Library version: 6.0.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions