Skip to content

contentSchema tests inadequate #609

@gregsdennis

Description

@gregsdennis

I'm not sure that the contentSchema are fully testing what they intend to.

For example:

  • file: content.json (any draft)
  • case: validation of binary-encoded media type documents with schema
  • test: a valid base64-encoded JSON document
  • expected: valid

Schema:

 {
  "$schema": "https://json-schema.org/draft/next/schema",
  "contentMediaType": "application/json",
  "contentEncoding": "base64",
  "contentSchema": {
    "required": [
      "foo"
    ],
    "properties": {
      "foo": {
        "type": "string"
      }
    }
  }
}

Instance

"eyJmb28iOiAiYmFyIn0K"

(instance decodes to {"foo": "bar"})

The subschema at /contentSchema (based on the keywords present) seems to be expecting an object. However, if an implementation ignores the encoding and media type and just validates this as a string, the test incorrectly passes. (Mine does this.)

I suggest we need to add a "type": "object" restriction to the subschema to ensure that it requires an object and doesn't just validate the base64 string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA test is wrong, or tooling is broken or buggy.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions