Skip to content

Generated enum value errors do not contain field name #467

@agemooij

Description

@agemooij

I'm using a lot of enums in my schemas and the code generated by go-jsonschema generates the following style of errors:

	if !ok {
		return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_MyEnum, v)
	}

This is not very helpful when handling validation errors since the field name is missing and you have to recognize the field by its possible values.
It would be better if we can print the field name in the error messages so the end user knows which field to look at.

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