Skip to content

Add support for title and descriptions for exampes #128

@tomcollins

Description

@tomcollins

It would be useful to be able to set an optional title or optional description for each example in a schema.

The title could be set using meta:title and the description using meta:description e.g.

{
  "$id": "http://example.com/schemas/name.json",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Name",
  "description": "A name.",
  "type": "object",
  "properties": {
    "firstNames": {
      "$ref": "#/definitions/firstNames"
    },
    "lastName": {
      "$ref": "#/definitions/lastName"
    }
  },
  "additionalProperties": false,
  "required": ["lastName"],
  "definitions": {
    "firstNames": {
      "description": "One or more first names separated by a space character.",
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "pattern": "[A-Za-z ]{1,100}"
    },
    "lastName": {
      "description": "A single last name.",
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "pattern": "[A-Za-z]{1,100}"
    }
  },
  "examples": [
    {
      "meta:title": "First example",
      "meta:description": "First description.",
      "firstNames": "Andrew Barry",
      "lastName": "Cunningham"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions