Schema as Meta-programming

Schema as Meta-programmingRelational representation - TBDOverviewSourcesAlgorithmGraphLegendMeta$schema: uri$id: uri-reference$ref: uri-referencedefinitions: Schema{}type: (string | string[]) => booleanPredicate1 = (data, any[]) => booleanrequired: string[]enum: any[]Predicate0 (data, primitive) => booleanmultipleOf: numbermaximum: numberexclusiveMaximum: number | booleanminimum: numberexclusiveMinimum: number | booleanmaxLength: numberminLength: numberpattern: regexmaxItems: numberminItems: numberuniqueItems: booleanmaxProperties: numberminProperties: numberconst: anyformat: stringLogicalif-then-else: (data, Schema) => booleanallOf, anyOf, oneOf: (data, Schema[]) => booleanoneOf implementationnot: (data, Schema) => boolean? contains: Schema? dependencies: Schema | Schema[]DeductoradditionalItems: Schemaitems: Schema | Schema[]additionalProperties: Schemaproperties: Schema{}patternProperties: Schema{}propertyNames: SchemaUItitle: stringdescription: string$comment: stringdefault: anyexamples: any[]?ControlsreadOnly: booleanwriteOnly: booleancontentMediaType: stringcontentEncoding: stringType constraints

Relational representation - TBD

action
schema
data
Lambda
AST/PT
RDF
NT
deductor
h
T1
g
subject
T0
f
object
f
g
h
T0
T1
NT
object
subject
deductor

Overview

Sources

Algorithm

Meta
Predicate0
Predicate1
Logical
Context
Deductor
?Controls

Graph

draft07
Meta
UI
Predicate1
Predicate0
Logical
Deductor
?Controls
draft06
Meta
Predicate1
Predicate0
Logical
Deductor
UI
dependencies
required
$schema
draft04
Meta
Predicate1
Predicate0
Logical
Deductor
UI
dependencies
required
$schema
*.0 is integer
rename
? describe
instance
properties ?
change type
enum[x]
? ? ?
? ? ?
readOnly
writeOnly
contentMediaType
contentEncoding
items
additionalItems
properties
additionalProperties
patternProperties
propertyNames
if-then-else
anyOf
allOf
oneOf
not
?contains
?dependencies
const
exclusive
min/max
multipleOf
minLength
maxLength
pattern
format
minItems
maxItems
uniqueItems
minProperties
maxProperties
required
enum
title
description
default
examples
$comment
$schema
$id
$ref
type
definitions
title
description
default
examples
items
additionalItems
properties
additionalProperties
patternProperties
propertyNames
anyOf
allOf
oneOf
not
?contains
?dependencies: []
exclusive
Min and Max
:number
min/max
multipleOf
minLength
maxLength
pattern
format
minItems
maxItems
uniqueItems
minProperties
maxProperties
const
enum
required: []
$id
$ref(?)
definitions
type
$schema: true
$schema: false
title
description
default
items
additionalItems
properties
additionalProperties
patternProperties
anyOf
allOf
oneOf
not
?dependencies: ?
exclusive
Min and Max
:boolean
min/max
multipleOf
minLength
maxLength
pattern
format
minItems
maxItems
uniqueItems
minProperties
maxProperties
enum
required: ?
id
$ref(?)
definitions
type
$schema: {}
$schema: {not: {}}

Legend

Meta

$schema: uri
$id: uri-reference
$ref: uri-reference
definitions: Schema{}
type: (string | string[]) => boolean

Predicate1 = (data, any[]) => boolean

required: string[]
enum: any[]

Predicate0 (data, primitive) => boolean

multipleOf: number
maximum: number
exclusiveMaximum: number | boolean
minimum: number
exclusiveMinimum: number | boolean
maxLength: number
minLength: number
pattern: regex
maxItems: number
minItems: number
uniqueItems: boolean
maxProperties: number
minProperties: number
const: any
format: string

Logical

= (data, Schema!) => boolean

if-then-else
: (data, Schema) => boolean
allOf, anyOf, oneOf
: (data, Schema[]) => boolean
oneOf implementation
index 01234567
value 00100100
acc := !(v && or) 111110  
or := v || or000111111
acc ? while : return or ->->->->->!  
result0001110  
not
: (data, Schema) => boolean
? contains
: Schema
? dependencies
: Schema | Schema[]

Deductor

= (data, Schema!) => (data[k], Schema[k])

additionalItems
: Schema
items
: Schema | Schema[]
additionalProperties
: Schema
properties
: Schema{}
patternProperties
: Schema{}
propertyNames
: Schema

UI

title: string
description: string
$comment: string
default: any
examples: any[]

?Controls

readOnly: boolean
writeOnly: boolean
contentMediaType: string
contentEncoding: string

Type constraints

typeindexOfmin/maxregincludesspecial
null-----
booleanenum...---
number/integerenummin/max, exclusiveMin/Max-multipleOf-
stringenummin/maxLengthpattern, formatpattern-
arrayadditionaltemsmin/maxItems-containsuniqueItems
objectadditionalPropertiesmin/maxPropertiespatternProperties-required, propertyNames