Skip to content

The serialized JSON Example do not pass against the schema #332

@fabiojose

Description

@fabiojose

Then validation against the schema produces the following error:

[ { keyword: 'format',
    dataPath: '.source',
    schemaPath: '#/definitions/source/format',
    params: { format: 'uri' },
    message: 'should match format "uri"' } ]

This is because of source value is /mycontext, that is an invalid URI.

A valid URI must have this format: URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]. Checkout here: https://www.ietf.org/rfc/rfc3986.txt

According to RFC 3986, Section 3, the scheme and hier-part are required.

Then, to work properly against the schema validation, I suggest an edit in the serialized JSON example, in source value example, changing it to from:/mycontext adding the scheme from:, as follows:

{
  "cloudEventsVersion":"0.1",
  "eventType":"com.example.someevent",
  "source":"from:/mycontext",
  "eventID":"A234-1234-1234",
  "eventTime":"2018-04-05T17:31:00Z",
  "comExampleExtension1":"value",
  "comExampleExtension2":{
    "otherValue":5
  },
  "contentType":"text/xml",
  "data":"<much wow=\"xml\"/>"
}

Or an adjustment in JSON Schema in source definition, changing it to another type instead of URI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions