JSON Schema Cheat Sheet

Since June 2011, several major search engines have been collaborating on a new common data vocabulary called schema.org.

The schema.org vocabulary can be used with both Microdata or RDFa 1.1 Lite syntax, and it has types for Event, Organization, Person, Product, Review, AggregateRating, Offer and hundreds of others.

Datatypes

Datentypen

  • string "string":"Hello World"
  • number "number":1.23
  • integer "integer":123
  • boolean "boolean":true
  • object "object":{"foo":"bar", "baz":"Hello World"}
  • array "array":["foo","bar", 5,"hello"]
  • null "null": null

Schema.org - DataType

-LD Syntax Tokens and Keywords

  • @context
  • @id
  • @value
  • @language
  • @type
  • @container
  • @list
  • @set
  • @reverse
  • @index
  • @base
  • @vocab
  • @graph

Die wichtigsten Properties/Datentypen/Definitionen

Thing name, description, url, image

Meta Listen

Weitere

Beispiele

 

Definitions

Special definitions

  • patternProperties
  • dependencies
  • extends
  • id
  • $ref
  • $schema

Features

  • type: string
    • enum
    • format
    • minLength, maxLength
    • pattern
    • required
    • disallow
  • type: number + integer
    • enum
    • format
    • minimum, maximum
    • exclusiveMinimum,exclusiveMaximum
    • divisibleBy ,
    • required
    • disallow
  • type: boolean
    • required
    • disallow
  • type: array
    • items
    • minItems, maxItems
    • required
    • uniqueItems
    • disallow
  • type: object
    • required_properties
    • properties
    • required
    • additionalProperties
    • disallow

Werte für "format"

  • color
  • date
  • datetime
  • datetime-local
  • email
  • month
  • number
  • range
  • tel
  • text
  • textarea
  • time
  • url
  • week

Spezifikationen & Formate

Visualisierung

Composite

allOf
anyOf
oneOf
not

Die wichtigsten Properties/Datentypen/Definitionen

    JSON-Schema JSON-LD  
Event Veranstaltung JSON-Schema Event JSON-LD Event  hCalendar, iCalendar
Events Veranstaltungen JSON-Schema Events  JSON-LD  
     JSON-Schema  JSON-LD  
 Recipe Rezept  JSON-Schema Recipe  JSON-LD  microformats.org
     JSON-Schema  JSON-LD  
 MusicEvent    JSON-Schema MusikEvent  JSON-LD  
WebPage    JSON-Schema  JSON-LD  

Beispiel Code

{
    "type": "string", 
    "title": "string", 
    "minLength": 0,
    "maxLength": 100,
    "enum": ["foo", "bar", "baz"]
}
{
    "type": "number",
    "minimum": 1,
    "maximum": 10
}
{
    "type": "integer",
    "default": 25,
    "minimum": 18,
    "maximum": 99
}
{
    "type": "boolean"
}
{
    "type": "object",
    "properties": {
        "propertyA" : {},
        "propertyB" : {}
    }
}
{
    "type": "array",
    "items": {},
    "minItems": 2,
    "maxItems": 5
}

Folgende Artikel könnten auch interessieren