-
-
Save mattdanielbrown/29db90f18a8679deaf8a087b1d9f972e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *https://medium.com/@hintology/sdd-schema-driven-development-f1d232d73ea6 | |
| { | |
| "$schema": "http://json-schema.org/draft-07/schema#", | |
| "$id": "http://:::1/partner.schema.json#", | |
| "title": "Partner", | |
| "description": "business partner specification", | |
| "type": "object", | |
| "definitions": { | |
| "id": { "type": "integer" }, | |
| "company": { "enum": [ "apple", "daimler" ] } | |
| }, | |
| "properties": { | |
| "id": { "type": "number" }, | |
| "phone": { "$ref": "phone.schema.json" }, | |
| "email": { "format": "email", "type": "string" }, | |
| "company":{ "$ref": "#/definitions/company" }, | |
| "if": {"properties": { "company":{ "const": "apple" }}}, | |
| "then": {"properties": { "email": { "pattern":"^appl.*" }}}, | |
| "else": {"properties": { "email": { "pattern":"^(.*)$" }}}, | |
| "$schema": { "$ref": "http://:::1/net.json" }, | |
| "not": { "$schema": "http://:::1/person.json" }, | |
| "any": { | |
| "$comment": "Must be valid against any of the subschemas", | |
| "anyOf": [{ "type": "string" }, { "type": "number" } ]}, | |
| "all": { | |
| "$comment": "Must be valid against all of the subschemas", | |
| "allOf":[ { "type": "string" },{ "maxLength": 5 } ]}}, | |
| "one": { | |
| "$comment": "Must be valid against exactly one of the subschemas", | |
| "allOf":[ { "type": "string" },{ "maxLength": 5 } ]}, | |
| "devices": { | |
| "type": "array", | |
| "uniqueItems": true, | |
| "$comment": "max 4 devices in array", | |
| "maxItems": 4, | |
| "minItems": 1, | |
| "items": { | |
| "description": "sample with many options", | |
| "$id": "$device", | |
| "default": ":::1", | |
| "format": "ipv6", | |
| "examples": [ ":::1", ":::2", "::.3" ], | |
| "contentEncoding": "application/json", | |
| "contentMediaType": "image/gif", | |
| "additionalProperties": false, | |
| "additionalItems": false, | |
| "exclusiveMinimum": 20, | |
| "exclusiveMaximum": 40, | |
| "multipleOf": 10, | |
| "minItems": 2, | |
| "maxLength": 5, | |
| "maximum": 0, | |
| "minimum": 0 | |
| } | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment