Skip to content

The value of the examples annotation should be an object or an array #48

@K-Adam

Description

@K-Adam

Json schema has examples annotation, which comes handy, when I would like to run a mock server for my api.

Unfortunately the spec states, that the value of examples keyword MUST be an array:

{
  "title" : "Match anything",
  "description" : "This is a schema that matches anything.",
  "default" : "Default value",
  "examples" : [
    "Anything",
    4035
  ]
}

I suggest to enable objects as well, so each example could be referenced by name:

{
  "title" : "Match anything",
  "description" : "This is a schema that matches anything.",
  "default" : "Default value",
  "examples" : {
    "stringValue": "Anything",
    "integerValue": 4035
  }
}

This change could make the construction of complex examples ( like a list ) much simpler.

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