Skip to content

Error Path, Error Message, and Unlimited Max Errors #15

Closed
@paulcruse3

Description

@paulcruse3

Not sure if I should separate these issues, but I can if needed.

  1. Error Message & Error Path
    The current structure for error response varies pretty widely dependent on the error. Is there anyway I can just get the key path that the error occurred and an error message? (like the python implementation of json-schema) If that's not possible, are there any docs on all the possible error response structures? Example:
/*schema being used*/
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "$id": "/API/V1/Login/schemas/post.json",
    "type" : "object",
    "properties" : {
        "email" : {
            "type" : "string",
            "format" : "email"
        },
        "password" : {
            "type": "string",
            "minLength": 6
        }
    },
    "required" : ["email", "password"],
    "additionalProperties" : false
}
/*bad request recieved*/
{
  "password": 1
}
/*library error response using all the available methods on ValidationError class*/
[
   {
      "pointer": [],
      "keyword": "required",
      "arguments": {
        "missing": "email"
      }
    },
    {
      "pointer": [
        "password"
      ],
      "keyword": "type",
      "arguments": {
        "expected": "string",
        "used": "integer"
      }
    }
]
/* python style implementation (what I am trying to get) 
ValidationError class has two more methods (getErrorPath(), getErrorMessage()) */
[
    {
      "path": "email",
      "message": "missing required field"
    },
    {
      "path": "password",
      "message": "type must be a `string`"
    }
]    
  1. Unlimited Errors
    I see the default for $max_errors is set to 1; how can I set max errors to unlimited? I've tried to just not pass anything (it defaults to 1) and tried setting to null (it throws an error).

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