Skip to content

weird response #44

@CodersBrothers

Description

@CodersBrothers

If you are using Restify, the normal error have this schema example:

{
  "code": "ResourceNotFound",
  "message": "/v1/test does not exist"
}

Have code and message.

But in restify-validator you can get something like this:

{
  "status": "validation failed",
  "errors": [
    {
      "field": "amount",
      "code": "INVALID",
      "message": "Invalid number"
    }
  ]
}

As you can see, no there are any first level code param, and there are a status param. That is the first time that I see.

Maybe will be maintain the same schema:

{
  "code": "BadRequest",
  "message": "Validation failed",
  "errors": [
    {
      "field": "amount",
      "code": "INVALID",
      "message": "Invalid number"
    }
  ]
}

The main idea is maintain a similar schema of Restify

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions