Skip to content

Human readable errors #9

@moshe5745

Description

@moshe5745

I want to output the error that occurs in schema validation to the user.

Right now, we got something like this(from the docs):

	// []jtd.ValidateError{
	// 	jtd.ValidateError{
	// 		InstancePath: []string{},
	// 		SchemaPath: []string{"properties", "name"}
	// 	},
	// 	jtd.ValidateError{
	// 		InstancePath: []string{"age"},
	// 		SchemaPath: []string{"properties", "age", "type"}
	// 	},
	// 	jtd.ValidateError{
	// 		InstancePath: []string{"phones", "1"},
	// 		SchemaPath: []string{"properties", "phones", "elements", "type"}
	// 	}
	// }

It would be nice to get an output like:

  • property "name" is missing
  • property "age" expected string found int

I could try to make my own output string but I am afraid I don't have all the data I need. Like the expected type and the one found in the json.

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