daveshanley / vacuum

vacuum is the worlds fastest OpenAPI 3, OpenAPI 2 / Swagger linter and quality analysis tool. Built in go, it tears through API specs faster than you can think. vacuum is compatible with Spectral rulesets and generates compatible reports.
https://quobix.com/vacuum
MIT License
489 stars 39 forks source link

Length function is not working #417

Closed AdrianMachado closed 5 months ago

AdrianMachado commented 5 months ago

Description

I tried creating a new rule that used lengthin my ruleset, as described here

Problem

I copied and modified the check-the-length rule from the link above


check-the-length:
    description: "Check the length of 'name' is at least 5 characters long"
    type: style
    recommended: true
    given: $.tags[*]
    then:
      field: name
      function: "length"
      functionOptions:
        min: 5
        max: 8

and ran it against Asana's OpenAPI file, but it did not work - I made sure there were violations in the OpenAPI file so I know the rule is likely just not running.

Repro

Command vacuum spectral-report -r /Users/adrianmachado/Code/rate-my-openapi-cli/rulesets/rules.vacuum.yaml example-specs/asana.json

My ruleset is extends: [[spectral:oas, all], [vacuum:owasp, all]] with a few others added in, including that check-the-length. I am pretty sure my other rules are working fine.

daveshanley commented 5 months ago

This is a bug, will fix.

daveshanley commented 5 months ago

This has been fixed in v0.8.0 There were multiple issues at play.