Skip to content

Schema causes RegexpError: empty range in char class #829

@kjwierenga

Description

@kjwierenga

I'm using the Ruby JSON Schema Validator (https://github.com/ruby-json-schema/json-schema) and an accompanying matcher to match API responses to JSON schema definitions.

When I match against the JSONAPI schema found at http://jsonapi.org/schema I get the following error:

 Failure/Error: response.body.should match_json_schema('json-api')
 RegexpError:
   empty range in char class: /^(?!relationships$|links$)\w[\w-_]*$/

The [\w-_] char class seems to be a problem.
See also: http://stackoverflow.com/questions/13161903/regular-expression-empty-range-in-char-class-error

The solution is to move the dash to the front of the char class like so: [-\w_]. I'll supply a PR shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions