schema-org-json-schemas

2.1.4 • Public • Published

Schema.org to JSON Schema

CircleCI

Generate JSON Schemas from Schema.org classes

You can find the generated schemas in the schemas/ directory.

To match the JSON-LD approach, properties that accept an array also accept a single value.

Example

Schema.org class for a Book

Property Expected Type Description
abridged Boolean Indicates whether the book is an abridged edition.
bookEdition Text The edition of the book.
bookFormat BookFormatType The format of the book.
illustrator Person The illustrator of the book.
isbn Text The ISBN of the book.
numberOfPages Integer The number of pages in the book.

Generated JSON Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "schema:Book",
  "title": "Book",
  "description": "A book.",
  "type": "object",
  "allOf": [
    {
      "description": "The most generic kind of creative work, including books, movies, photographs, software programs, etc.",
      "$ref": "schema:CreativeWork"
    }
  ],
  "properties": {
    "abridged": {
      "description": "Indicates whether the book is an abridged edition.",
      "type": "boolean"
    },
    "bookEdition": {
      "description": "The edition of the book.",
      "type": "string"
    },
    "bookFormat": {
      "description": "The format of the book.",
      "$ref": "schema:BookFormatType"
    },
    "illustrator": {
      "description": "The illustrator of the book.",
      "$ref": "schema:Person"
    },
    "isbn": { "description": "The ISBN of the book.", "type": "string" },
    "numberOfPages": {
      "description": "The number of pages in the book.",
      "type": "integer"
    }
  }
}

To do

Credits

Thanks to geraintluff for the property multiplicity and the hardcoded schemas (licensed under the MIT License).

Readme

Keywords

Package Sidebar

Install

npm i schema-org-json-schemas

Weekly Downloads

1

Version

2.1.4

License

Apache-2.0

Unpacked Size

1.2 MB

Total Files

884

Last publish

Collaborators

  • charlestati