Add ability to support case-insensitive enum validation

Issue #23 new
James Navin created an issue

The JSON Schema spec treats enum validation as case-sensitive - http://json-schema.org/latest/json-schema-validation.html#anchor76

There are some cases where case-insensitive validation would be desirable.

e.g.

java.lang.AssertionError: Validation errors found.
    * atlassian-scheduler
        - schedule a new job    
            [ERROR] [Path '/notificationMethod'] Instance value ("unknown") not found in enum (possible values: ["SQS","HTTP_GET","HTTP_POST","HTTP_PUT","HTTP_DELETE","NONE","UNKNOWN"])
            [ERROR] [Path '/type'] Instance value ("interval") not found in enum (possible values: ["SINGLE","CRON","INTERVAL","UNKNOWN"])

Comments (3)

  1. James Navin reporter

    Ideally we could support this using the log levels mechanism rather than introducing a new configuration mechanism.

    Some ideas:

    • Detect the enum validation failure and then perform case-insensitive validation, then emit messages at the correct level
    • Perform both case sensitive and case insensitive validations and emit both messages at configured levels
  2. Nikhil Raman

    How does the framework know that user would like to perform case insensitive validation in case of failure? Also people may not look into log unless something failing in CI. I prefer to have a config options like enableCaseInsensitiveEnumValidation()

  3. Sven Döring

    That feature would come in handy for us at this point.

    But I see a major problem. What if case-insensitivity is good for some enums but not for others in the same API definition?

  4. Log in to comment