Demo models for http://supermodel.io
Supermodel demo models using the Star Wars API "theme", the models can be found in the in the supermodel/starwars folder or directly viewed at https://supermodel.io/starwars.
Supermodel data models follows these conventions:
- Models are written as JSON Schema in YAML format, one schema definition per one YAML file
- Every model must start with JSON Schema
$id
- A model should specify the used version of JSON Schema in the
$schema
field
A model can freely reference any other model or model property using the JSON Schema $ref
reference mechanism. The reference can point to any JSON Schema on the web, or it can be relative to the current model.
$id: http://supermodel.io/starwars/core/Person
$schema: http://json-schema.org/draft-07/schema#
title: Person
type: object
description: >-
An individual person or character within the Star Wars universe.
properties:
name:
type: string
examples:
- Luke Skywalker
- Darth Vader
homeworld:
$ref: http://supermodel.io/starwars/core/Planet
See more examples in the supermodel/starwars/core folder.
The Supermodel CLI tool can be used to create, validate schemas or convert the models into various formats such as OpenAPI Spec, GraphQL schema, Avro schema, and others.
See the package.json scripts section for examples how to use the Supermodel CLI.
Refer to the Supermodel CLI tool documentation for further details.
When published to http://supermodel.io, a model becomes globally available under its $id
(e.g., http://supermodel.io/starwars/core/Starship
). The model can be referred to by any other JSON Schema or consumed via http://supermodel.io API.
Visit http://supermodel.io/starwars/core/Starship for further details on how to reference the model.
This repository demonstrates how OpenAPI Specification 2.0, GraphQL Schema and Avro Schema are build from the supermodels.
Sources are as follows:
- OpenAPI Specfication:
starwars-api.oas2.yaml
+./supermodel/starwars/core
models - Avro (Film Kafka Topic):
/supermodel/starwars/avro/FilmTopic
model - GraphQL:
./supermodel/starwars/core
models
Refer to the build folder for the build artifacts.
Let us know what you think either in the issues or via twitter at @supermodelio.
Made with 🖤 in Prague.