All Projects → seagreen → Plate

seagreen / Plate

Principled schema system for JSON. Work in progress.

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Plate

Ngx Form Builder
Angular Form generation base on Angular , dynamic template support ng-zorro-antd/BootStrap UI (基于ng8的 json schema 表单生成器,提供生成组件源码,可对生成的表单代码进行编辑)
Stars: ✭ 109 (-16.15%)
Mutual labels:  schema
Typedload
Python library to load dynamically typed data into statically typed data structures
Stars: ✭ 120 (-7.69%)
Mutual labels:  schema
Pulsar Flink
Elastic data processing with Apache Pulsar and Apache Flink
Stars: ✭ 126 (-3.08%)
Mutual labels:  schema
Meteor Autoform
AutoForm is a Meteor package that adds UI components and helpers to easily create basic forms with automatic insert and update events, and automatic reactive validation.
Stars: ✭ 1,453 (+1017.69%)
Mutual labels:  schema
Rdfunit
An RDF Unit Testing Suite
Stars: ✭ 117 (-10%)
Mutual labels:  schema
Openapi Core
OpenAPI core
Stars: ✭ 119 (-8.46%)
Mutual labels:  schema
Workbase
Grakn Workbase (Knowledge IDE)
Stars: ✭ 106 (-18.46%)
Mutual labels:  schema
Goose
A database migration tool. Supports SQL migrations and Go functions.
Stars: ✭ 2,112 (+1524.62%)
Mutual labels:  schema
Adt
Algebraic data types for Python (experimental, not actively maintained)
Stars: ✭ 120 (-7.69%)
Mutual labels:  algebraic-data-types
Graphql Schema Registry
GraphQL schema registry
Stars: ✭ 124 (-4.62%)
Mutual labels:  schema
Datum
pure functional and generic programming for Erlang
Stars: ✭ 111 (-14.62%)
Mutual labels:  algebraic-data-types
Postgraphile
GraphQL is a new way of communicating with your server. It eliminates the problems of over- and under-fetching, incorporates strong data types, has built-in introspection, documentation and deprecation capabilities, and is implemented in many programming languages. This all leads to gloriously low-latency user experiences, better developer experiences, and much increased productivity. Because of all this, GraphQL is typically used as a replacement for (or companion to) RESTful API services.
Stars: ✭ 10,967 (+8336.15%)
Mutual labels:  schema
Callapp Lib
🔥call app from h5(H5唤起客户端 )
Stars: ✭ 1,857 (+1328.46%)
Mutual labels:  schema
Schema Registry
Confluent Schema Registry for Kafka
Stars: ✭ 1,647 (+1166.92%)
Mutual labels:  schema
Dataenum
Algebraic data types in Java.
Stars: ✭ 128 (-1.54%)
Mutual labels:  algebraic-data-types
Functionaljava
Functional programming in Java
Stars: ✭ 1,472 (+1032.31%)
Mutual labels:  algebraic-data-types
React Structured Data
React Structured Data provides an easy way to add structured data to your React apps
Stars: ✭ 120 (-7.69%)
Mutual labels:  schema
Elementui
Generate a form using JSON Schema, Vue and ElementUI
Stars: ✭ 130 (+0%)
Mutual labels:  schema
Scobot
SCORM API for Content. JavaScript library, QUnit tests and examples.
Stars: ✭ 128 (-1.54%)
Mutual labels:  schema
Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (-4.62%)
Mutual labels:  schema
Plate

Language-agnostic schemas based on Haskell's type system.

Why Schemas

Schema languages like JSON Schema let you to describe data in a way that can be understood by any programming language. They're one of the core components of API description tools like Swagger. Once you write schemas to describe the data your API deals with you can use them to automatically generate documentation, UIs, and client code. This avoids lots of manual, error-prone work at your application boundary.

Why Another Schema Language

Writing a schema language is trickier than it looks. You have to strike a careful balance between over and under-expressiveness.

If you make your schema under-expressive it becomes little better than no schema at all. For example JSchema allows all values described by the schema to be null. While it's easy to find nice things to say about JSchema (such as its simplicity), implicit nulls don't allow enough structure for many tasks.

On the other hand you can error by allowing too much expressiveness. For instance in JSON Schema a clever combination of the "anyOf", "allOf", and "not" keywords is enough to build if and case statements (discovered by Evgeny Poberezkin).

This allows schemas to describe enormously complex structures for which it's impossible to automatically generate clean UIs or client code. Once again this defeats the original purpose. One solution would be to ask schema writers to work in only some subset of the schema langauge, but which subset? We're back to the original problem.

The Idea Behind Plate

The solution is to look for rescue from a related field. Language-specific type system writers have been feeling out the sweet spot of expressiveness longer than the other tools mentioned here have existed. Even better, many of them are battle-hardened and sit on a principled theoretical foundation.

And of course the most glorious, battle-hardened, and principled of these is Haskell. Plate is what you get when you steal the most basic, essential features of Haskell's type system and build a schema language from them. Hopefully this lets Plate strike the right level of expressiveness for many tasks.

Status

Work-in-progress. Nothing is final or production ready. Everything is a mess. Documentation is wrong.

Example

Say we have the following Haskell type:

data Album = Album
  { title  :: Text
  , artist :: Text
  , tracks :: [Text]
  }

We can also express it as a Plate schema using the plate library:

album :: Schema
album = ProductType (HM.fromList
  [ ("title", Builtin SString)
  , ("artist", Builtin SString)
  , ("tracks", Builtin (SSequence (Builtin SString)))
  ])

(It won't be hard to make this conversion automatic, though I haven't gotten around to it yet.)

We can then generate a JSON representation of the schema for other tools to use:

{
  "schema.product": {
    "title": {
      "type": {
        "schema.string": {}
      }
    },
    "artist": {
      "type": {
        "schema.string": {}
      }
    },
    "tracks": {
      "type": {
        "schema.sequence": {
          "type": {
            "schema.string": {}
          }
        }
      }
    }
  }
}

We can also generate UIs so users can conveniently create instances of our schema:

(Note: the editor isn't released yet)

Then say a user creates this piece of data:

{
  "title": "Interstellar: Original Motion Picture Soundtrack",
  "artist": "Hans Zimmer",
  "tracks": {
    "sequence": [
      "Dreaming of the Crash",
      "Cornfield Chase",
      "Dust",
      "Day One",
      "Stay",
      "Message from Home",
      "The Wormhole",
      "Mountains",
      "Afraid of Time",
      "A Place Among the Stars",
      "Running Out",
      "I'm Going Home",
      "Coward",
      "Detach",
      "S.T.A.Y.",
      "Where We're Going"
    ]
  }
}

We can convert it to its Plate representation and then validate it:

λ> Plate.validate mempty albumSchema interstellarSountrack
Right ()

Special Thanks

TJ Weigel created the logo.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].