Skip to content

Add output formatting tests #247

Closed
@gregsdennis

Description

@gregsdennis

In light of draft2019-09's output formatting, I think it might be prudent to have a set of tests that validate the output formatting.


Maybe this can be included in the draft2019-09 tests themselves (when they're added).

Something like:

Example test from draft-07's *properties.json*

{
  "description": "object properties validation",
  "schema": {
    "properties": {
      "foo": {"type": "integer"},
      "bar": {"type": "string"}
    }
  },
  "tests": [
    {
      ...
    },
    {
      "description": "one property invalid is invalid",
      "data": {"foo": 1, "bar": {}},
      "valid": false,
      "outputs": {
        "flag": {
          "valid": false
        },
        "basic":{
          "valid" : false,
          "errors" : [
            {
              "valid" : false,
              "keywordLocation" : "#/properties",
              "instanceLocation" : "#"
            },
            {
              "valid" : false,
              "keywordLocation" : "#/properties/foo/type",
              "instanceLocation" : "#/foo"
            },
            {
              "valid" : false,
              "keywordLocation" : "#/properties/bar/type",
              "instanceLocation" : "#/bar"
            }
          ]
        },
        "detailed": {
          "valid" : false,
          "keywordLocation" : "#/properties",
          "instanceLocation" : "#",
          "errors" : [
            {
              "valid" : false,
              "keywordLocation" : "#/properties/foo/type",
              "instanceLocation" : "#/foo"
            },
            {
              "valid" : false,
              "keywordLocation" : "#/properties/bar/type",
              "instanceLocation" : "#/bar"
            }
          ]
        },
        "verbose": {
          "valid" : false,
          "keywordLocation" : "#",
          "instanceLocation" : "#",
          "errors" : [
            {
              "valid" : false,
              "keywordLocation" : "#/properties",
              "instanceLocation" : "#",
              "errors" : [
                {
                  "valid" : false,
                  "keywordLocation" : "#/properties/foo",
                  "instanceLocation" : "#/foo",
                  "errors" : [
                    {
                      "valid" : false,
                      "keywordLocation" : "#/properties/foo/type",
                      "instanceLocation" : "#/foo"
                    }
                  ]
                },
                {
                  "valid" : false,
                  "keywordLocation" : "#/properties/bar",
                  "instanceLocation" : "#/bar",
                  "errors" : [
                    {
                      "valid" : false,
                      "keywordLocation" : "#/properties/bar/type",
                      "instanceLocation" : "#/bar"
                    }
                  ]
                }
              ]
            }
          ]
        }
      }
    },
    {
      ...
    }
  ]
}

Doing this on all the tests, though, seems like overkill. I think a set of tests specifically for output would be more concise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing testA request to add a test to the suite that is currently not covered elsewhere.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions