镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Improvement: error context reporting #47

Open

Description

@fredbi

Errors and warnings are dumped in any order, with poor information about context in the spec.

Since retrieving line numbers is a hard problem, I suggest we could extend the Result object to provide a map of paths linked to errors.

Beware : this would affect the interface with Result (AddError and possibly some more direct usage).

In the end, messages would be pretty printed by sorting and indenting keys.
Not quite line numbers but better than the unordered list we have today.

Also referred by:

Activity

  1. diafour commented on Sep 26, 2019

    @diafour

    messages would be pretty printed by sorting and indenting keys.

    It also helps to include an index of item in array.

    type: array
    items:
      type: object
      properties:
        prop1:
          type: string
    
    [
      { "prop1": "valid"},
      { "prop1": 2989 },
    ]
    

    Error now:

    prop1 in body must be of type string: "number"
    

    Error with index:

    [1].prop1 in body must be of type string: "number"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions