Commit 54ac969f authored by Rod Vagg's avatar Rod Vagg Committed by Eric Myhre

schema fixups

Cherry-picked by eric with several changes.

- The fixups of missing bits of schema-schema are a fair cop.

- Several critical typos in the example.ipldsch.json file are fixed.

- I tweaked the syntax for aliases in the example file; we've had the
  idea since this was originally posted of putting representational
  concerns that are clearly associated with a field inline with the
  fields for convenience, but in parens to distinguish that they're
  indeed representation concerns rather than type/cardinality concerns,
  so this is the expression of that idea.

- I actually walked back the removal of representation blocks in the
  json.  There's probably valid considerations to be made on that, but
  it deserves separate handling.  (Disconcertingly, I actually added
  two *new* representation blocks that seem to previously have been
  missing due to typos.)

Any new errors are presumably mine.

Original: https://github.com/ipld/go-ipld-prime/pull/10
parent 853e4a7c
......@@ -2,10 +2,8 @@
type ExampleWithNullable map {String : nullable String}
type ExampleWithAnonDefns struct {
fooField optional {String:String}
fooField optional {String:String} (alias "foo_field")
barField nullable {String:String}
bazField {String : nullable String}
wozField {String:[nullable String]}
} representation map (
fooField: alias="foo_field"
)
} representation map
......@@ -10,35 +10,35 @@
"kind": "struct",
"fields": {
"fooField": {
"valueType": {
"type": "map",
"type": {
"kind": "map",
"keyType": "String",
"valueType": "String"
},
"optional": true
},
"barField": {
"valueType": {
"type": "map",
"type": {
"kind": "map",
"keyType": "String",
"valueType": "String"
},
"nullable": true
},
"bazField": {
"valueType": {
"type": "map",
"type": {
"kind": "map",
"keyType": "String",
"valueType": "String",
"valueNullable": true
}
},
"wozField": {
"valueType": {
"type": "map",
"type": {
"kind": "map",
"keyType": "String",
"valueType": {
"type": "list",
"kind": "list",
"valueType": "String",
"valueNullable": true
}
......
......@@ -37,6 +37,22 @@
}
}
},
"TypeKind": {
"kind": "enum",
"members": {
"bool": null,
"string": null,
"bytes": null,
"int": null,
"float": null,
"map": null,
"list": null,
"link": null,
"union": null,
"struct": null,
"enum": null
}
},
"RepresentationKind": {
"kind": "enum",
"members": {
......@@ -128,6 +144,13 @@
}
}
},
"TypeLink": {
"kind": "struct",
"fields": {},
"representation": {
"map": {}
}
},
"TypeUnion": {
"kind": "struct",
"fields": {
......@@ -176,6 +199,9 @@
"valueType": "TypeName"
}
}
},
"representation": {
"map": {}
}
},
"UnionRepresentation_Inline": {
......@@ -191,6 +217,9 @@
"valueType": "TypeName"
}
}
},
"representation": {
"map": {}
}
},
"TypeStruct": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment