Skip to content

Commit 3431e18

Browse files
author
Peter Amstutz
committed
Use scopedRef and typeDSL in metaschema
1 parent 1e6dab6 commit 3431e18

File tree

4 files changed

+114
-101
lines changed

4 files changed

+114
-101
lines changed

schema_salad/metaschema/metaschema.yml

Lines changed: 49 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,8 @@ $graph:
194194
fields:
195195
- name: doc
196196
type:
197-
- "null"
198-
- string
199-
- type: array
200-
items: string
197+
- string?
198+
- string[]?
201199
doc: "A documentation string for this type, or an array of strings which should be concatenated."
202200
jsonldPredicate: "sld:doc"
203201

@@ -212,10 +210,8 @@ $graph:
212210

213211
- name: docChild
214212
type:
215-
- "null"
216-
- string
217-
- type: array
218-
items: string
213+
- string?
214+
- string[]?
219215
doc: |
220216
Hint to indicate that during documentation generation, documentation
221217
for `docChild` should appear in a subsection under this type.
@@ -236,19 +232,18 @@ $graph:
236232

237233
- name: SchemaDefinedType
238234
type: record
239-
extends: "#DocType"
235+
extends: DocType
240236
doc: |
241237
Abstract base for schema-defined types.
242238
abstract: true
243239
fields:
244240
- name: jsonldPredicate
245241
type:
246-
- "null"
247-
- string
248-
- "#JsonldPredicate"
242+
- string?
243+
- JsonldPredicate?
249244
doc: |
250245
Annotate this type with linked data context.
251-
jsonldPredicate: "sld:jsonldPredicate"
246+
jsonldPredicate: sld:jsonldPredicate
252247

253248
- name: documentRoot
254249
type: boolean?
@@ -259,7 +254,7 @@ $graph:
259254
260255
- name: RecordField
261256
type: record
262-
doc: "A field of a record."
257+
doc: A field of a record.
263258
fields:
264259
- name: name
265260
type: string
@@ -275,36 +270,36 @@ $graph:
275270

276271
- name: type
277272
type:
278-
- "#PrimitiveType"
279-
- "#RecordSchema"
280-
- "#EnumSchema"
281-
- "#ArraySchema"
273+
- PrimitiveType
274+
- RecordSchema
275+
- EnumSchema
276+
- ArraySchema
282277
- string
283278
- type: array
284279
items:
285-
- "#PrimitiveType"
286-
- "#RecordSchema"
287-
- "#EnumSchema"
288-
- "#ArraySchema"
280+
- PrimitiveType
281+
- RecordSchema
282+
- EnumSchema
283+
- ArraySchema
289284
- string
290285
jsonldPredicate:
291-
_id: "sld:type"
286+
_id: sld:type
292287
_type: "@vocab"
293288
typeDSL: true
289+
refScope: 0
294290
doc: |
295291
The field type
296292
297293
298294
- name: SaladRecordField
299295
type: record
300-
extends: "#RecordField"
296+
extends: RecordField
301297
doc: "A field of a record."
302298
fields:
303299
- name: jsonldPredicate
304300
type:
305-
- "null"
306-
- string
307-
- "#JsonldPredicate"
301+
- string?
302+
- JsonldPredicate?
308303
doc: |
309304
Annotate this type with linked data context.
310305
jsonldPredicate: "sld:jsonldPredicate"
@@ -323,19 +318,16 @@ $graph:
323318
_id: "sld:type"
324319
_type: "@vocab"
325320
typeDSL: true
321+
refScope: 0
326322
- name: "fields"
327-
type:
328-
- "null"
329-
- type: "array"
330-
items: "#RecordField"
331-
323+
type: RecordField[]?
332324
jsonldPredicate: "sld:fields"
333325
doc: "Defines the fields of the record."
334326

335327

336328
- name: SaladRecordSchema
337329
type: record
338-
extends: ["#NamedType", "#RecordSchema", "#SchemaDefinedType"]
330+
extends: [NamedType, RecordSchema, SchemaDefinedType]
339331
documentRoot: true
340332
specialize:
341333
specializeFrom: "#RecordField"
@@ -349,22 +341,19 @@ $graph:
349341
350342
- name: extends
351343
type:
352-
- "null"
353-
- string
354-
- type: array
355-
items: string
344+
- string?
345+
- string[]?
356346
jsonldPredicate:
357347
_id: "sld:extends"
358348
_type: "@id"
349+
refScope: 0
359350
doc: |
360351
Indicates that this record inherits fields from one or more base records.
361352
362353
- name: specialize
363354
type:
364-
- "null"
365-
- "#SpecializeDef"
366-
- type: array
367-
items: "#SpecializeDef"
355+
- SpecializeDef?
356+
- SpecializeDef[]?
368357
doc: |
369358
Only applies if `extends` is declared. Apply type specialization using the
370359
base record as a template. For each field inherited from the base
@@ -388,10 +377,9 @@ $graph:
388377
_id: "sld:type"
389378
_type: "@vocab"
390379
typeDSL: true
380+
refScope: 0
391381
- name: "symbols"
392-
type:
393-
- type: "array"
394-
items: "string"
382+
type: string[]
395383
jsonldPredicate:
396384
_id: "sld:symbols"
397385
_type: "@id"
@@ -401,20 +389,19 @@ $graph:
401389

402390
- name: SaladEnumSchema
403391
type: record
404-
extends: ["#EnumSchema", "#SchemaDefinedType"]
392+
extends: [EnumSchema, SchemaDefinedType]
405393
documentRoot: true
406394
doc: |
407395
Define an enumerated type.
408396
fields:
409397
- name: extends
410398
type:
411-
- "null"
412-
- string
413-
- type: array
414-
items: string
399+
- string?
400+
- string[]?
415401
jsonldPredicate:
416402
_id: "sld:extends"
417403
_type: "@id"
404+
refScope: 0
418405
doc: |
419406
Indicates that this enum inherits symbols from a base enum.
420407
@@ -433,29 +420,31 @@ $graph:
433420
_id: "sld:type"
434421
_type: "@vocab"
435422
typeDSL: true
423+
refScope: 0
436424
- name: items
437425
type:
438-
- "#PrimitiveType"
439-
- "#RecordSchema"
440-
- "#EnumSchema"
441-
- "#ArraySchema"
426+
- PrimitiveType
427+
- RecordSchema
428+
- EnumSchema
429+
- ArraySchema
442430
- string
443431
- type: array
444432
items:
445-
- "#PrimitiveType"
446-
- "#RecordSchema"
447-
- "#EnumSchema"
448-
- "#ArraySchema"
433+
- PrimitiveType
434+
- RecordSchema
435+
- EnumSchema
436+
- ArraySchema
449437
- string
450438
jsonldPredicate:
451439
_id: "sld:items"
452440
_type: "@vocab"
441+
refScope: 0
453442
doc: "Defines the type of the array elements."
454443

455444

456445
- name: Documentation
457446
type: record
458-
extends: ["#NamedType", "#DocType"]
447+
extends: [NamedType, DocType]
459448
documentRoot: true
460449
doc: |
461450
A documentation section. This type exists to facilitate self-documenting
@@ -471,4 +460,5 @@ $graph:
471460
jsonldPredicate:
472461
_id: "sld:type"
473462
_type: "@vocab"
474-
typeDSL: true
463+
typeDSL: true
464+
refScope: 0

0 commit comments

Comments
 (0)