Skip to content

better error messages for policy schema failures #34

@mathause

Description

@mathause

Since the policy schema is pretty simple, I was thinking about extracting information from the error message: if the error message is

Invalid policy definition: [] is not of type 'object'

Failed validating 'type' in schema['properties']['policy']['properties']['overrides']:
    {'additionalProperties': False,
     'patternProperties': {'^[a-z][-a-z_]*': {'format': 'date',
                                              'type': 'string'}},
     'type': 'object'}

On instance['policy']['overrides']:
    []

Then we have the path of the wrong object in On instance['policy']['overrides'], and the actual and expected types in the first line. This should be sufficient to create a new error message that is friendlier to a python audience.

Originally posted by @keewis in #32 (comment)

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