vacuum icon indicating copy to clipboard operation
vacuum copied to clipboard

Correct pattern returns a false positive

Open zzau13 opened this issue 9 months ago • 6 comments

This pattern return error: (@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})

But is valid https://regex101.com/r/ZLzqnq/1

zzau13 avatar Mar 19 '25 20:03 zzau13

using a json schema validator such as https://json-schema.hyperjump.io/ it mentionned as well that is is not a correct pattern same for https://json-everything.net/json-schema/ there should be something wrong about ecaping char

LasneF avatar Mar 19 '25 22:03 LasneF

My bad. Sorry, legacy code. It brings out the worst in me.

zzau13 avatar Mar 20 '25 11:03 zzau13

{
  "openapi": "3.0.3",
  "components": {
    "schemas": {
      "foo": {
        "type": "object",
        "properties": {
          "foo": {
            "default": "*/15 * * * *",
            "pattern": "(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every ([0-9]+(ns|us|\u00b5s|ms|s|m|h))+)|(((([0-9]+,)+[0-9]+|([0-9]+(/|-)[0-9]+)|[0-9]+|\\*) ?){5,7})",
            "title": "foo",
            "type": "string"
          }
        }
      }
    }
  }
}

@LasneF That's fails but is valid in the previous validators

zzau13 avatar Mar 20 '25 14:03 zzau13

{ "openapi": "3.0.3", "components": { "schemas": { "foo": { "type": "object", "properties": { "foo": { "default": "*/15 * * * ", "pattern": "(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every ([0-9]+(ns|us|\u00b5s|ms|s|m|h))+)|(((([0-9]+,)+[0-9]+|([0-9]+(/|-)[0-9]+)|[0-9]+|\) ?){5,7})", "title": "foo", "type": "string" } } } } } } @LasneF That's fails but is valid in the previous validators

Which previous validators? earlier versions of vacuum? or something else?

daveshanley avatar Mar 20 '25 21:03 daveshanley

Version 0.16.4

Test with: https://json-schema.hyperjump.io/ https://json-everything.net/json-schema/ https://github.com/OpenAPITools/openapi-generator

oas-schema-check error

Also, in the report, the file:line_number is bad, is in main file and the error is in schemas file, and a line number outside the file. Path is correct in the report.

zzau13 avatar Mar 20 '25 22:03 zzau13

I'll add this to the list of investigations required

daveshanley avatar Mar 21 '25 04:03 daveshanley

This was fixed in v0.16.6

daveshanley avatar Aug 28 '25 23:08 daveshanley