Skip to content

Supermodel Demo repository showcasing Star Wars JSON Schema data models and how to convert them into OAS2, GraphQL and Avro

License

Notifications You must be signed in to change notification settings

clemensberndt/starwars

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Star Wars Supermodel

Demo models for http://supermodel.io

Overview

CircleCI

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 Models

Supermodel data models follows these conventions:

  1. Models are written as JSON Schema in YAML format, one schema definition per one YAML file
  2. Every model must start with JSON Schema $id
  3. 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.

Model Example

$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.

CLI

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.

Always Available Models

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.

OpenAPI Specification, Avro Schema, GraphQL Schema Examples

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.

Questions? Comments?

Let us know what you think either in the issues or via twitter at @supermodelio.


Made with 🖤 in Prague.

About

Supermodel Demo repository showcasing Star Wars JSON Schema data models and how to convert them into OAS2, GraphQL and Avro

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published