Skip to content

Commit 3d01afe

Browse files
committed
sync metaschema
1 parent cbbf982 commit 3d01afe

File tree

9 files changed

+74
-20
lines changed

9 files changed

+74
-20
lines changed

.github/workflows/spellcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Codespell with annotations
1616
uses: codespell-project/[email protected]
1717
with:
18-
skip: tests/EDAM.owl,tests/foaf.rdf,tests/underscore.js
18+
skip: EDAM.owl,foaf.rdf,underscore.js,CODE_OF_CONDUCT.md
1919
- uses: rojopolis/[email protected]
2020
name: Spellcheck
2121
# https://github.com/marketplace/actions/github-spellcheck-action

salad/schema_salad/metaschema/field_name_schema.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"$graph": [{
66
"name": "ExampleType",
77
"type": "record",
8+
"documentRoot": true,
89
"fields": [{
910
"name": "base",
1011
"type": "string",

salad/schema_salad/metaschema/ident_res_schema.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"$graph": [{
66
"name": "ExampleType",
77
"type": "record",
8+
"documentRoot": true,
89
"fields": [{
910
"name": "id",
1011
"type": "string",

salad/schema_salad/metaschema/import_include.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ document must be the URI used to retrieve the imported document. If the
1616
`$import` URI includes a document fragment, the fragment must be excluded
1717
from the base URI used to preprocess the imported document.
1818

19-
Once loaded and processed, the `$import` node is replaced in the document
20-
structure by the object or array yielded from the import operation.
19+
If the `$import` node is in an array and the import operation yields an array,
20+
it is flattened to the parent array. Otherwise the `$import` node is replaced
21+
in the document structure by the object or array yielded from the import operation.
2122

2223
URIs may reference document fragments which refer to specific an object in
2324
the target document. This indicates that the `$import` node must be
@@ -26,7 +27,7 @@ replaced by only the object with the appropriate fragment identifier.
2627
It is a fatal error if an import directive refers to an external resource
2728
or resource fragment which does not exist or is not accessible.
2829

29-
### Import example
30+
### Import example: replacing the `$import` node
3031

3132
import.json:
3233
```
@@ -60,6 +61,38 @@ This becomes:
6061
}
6162
```
6263

64+
### Import example: flattening the `$import`ed array
65+
66+
import.json:
67+
```
68+
[ "hello", "world" ]
69+
```
70+
71+
parent.json:
72+
```
73+
{
74+
"form": [
75+
"bar",
76+
{
77+
"$import": "import.json"
78+
}
79+
]
80+
}
81+
82+
```
83+
84+
This becomes:
85+
86+
```
87+
{
88+
"form": [
89+
"bar",
90+
"hello",
91+
"world"
92+
]
93+
}
94+
```
95+
6396
## Include
6497

6598
During preprocessing traversal, an implementation must resolve `$include`

salad/schema_salad/metaschema/link_res.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Link resolution
33
44
The schema may designate one or more fields as link fields that reference other
5-
objects. Processing must resolve links to either absolute URIs using the
5+
objects. Processing must resolve links to absolute URIs using the
66
following rules:
77
88
* If a reference URI is prefixed with `#` it is a relative

salad/schema_salad/metaschema/metaschema.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ $graph:
154154
then finally `#foo`. The first valid URI in the search order shall be
155155
used as the fully resolved value of the identifier. The value of the
156156
refScope field is the specified number of levels from the containing
157-
identifer scope before starting the search, so if `refScope: 2` then
157+
identifier scope before starting the search, so if `refScope: 2` then
158158
"baz" and "bar" must be stripped to get the base `#foo` and search
159159
`#foo/foo` and the `#foo`. The last scope searched must be the top
160160
level scope before determining if the identifier cannot be resolved.
@@ -309,7 +309,8 @@ $graph:
309309
type: boolean?
310310
doc: |
311311
If true, this record is abstract and may be used as a base for other
312-
records, but is not valid on its own.
312+
records, but is not valid on its own. Inherited fields may be
313+
re-specified to narrow their type.
313314
314315
- name: extends
315316
type:
@@ -321,7 +322,7 @@ $graph:
321322
refScope: 1
322323
doc: |
323324
Indicates that this record inherits fields from one or more base records.
324-
325+
Inherited fields may be re-specified to narrow their type.
325326
- name: specialize
326327
type:
327328
- SpecializeDef[]?
@@ -368,6 +369,7 @@ $graph:
368369
doc: "Must be `documentation`"
369370
type:
370371
type: enum
372+
name: Documentation_name
371373
symbols:
372374
- "sld:documentation"
373375
jsonldPredicate:

salad/schema_salad/metaschema/metaschema_base.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ $graph:
3939
- "xsd:string"
4040
doc:
4141
- |
42-
Salad data types are based on Avro schema declarations. Refer to the
43-
[Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for
42+
Names of salad data types (based on Avro schema declarations).
43+
44+
Refer to the [Avro schema declaration documentation](https://avro.apache.org/docs/current/spec.html#schemas) for
4445
detailed information.
4546
- "null: no value"
4647
- "boolean: a binary value"
@@ -100,6 +101,7 @@ $graph:
100101
doc: "Must be `record`"
101102
type:
102103
type: enum
104+
name: Record_name
103105
symbols:
104106
- "sld:record"
105107
jsonldPredicate:
@@ -125,13 +127,17 @@ $graph:
125127
doc: "Must be `enum`"
126128
type:
127129
type: enum
130+
name: Enum_name
128131
symbols:
129132
- "sld:enum"
130133
jsonldPredicate:
131134
_id: "sld:type"
132135
_type: "@vocab"
133136
typeDSL: true
134137
refScope: 2
138+
name:
139+
type: string?
140+
jsonldPredicate: "@id"
135141
symbols:
136142
type: string[]
137143
jsonldPredicate:
@@ -148,6 +154,7 @@ $graph:
148154
doc: "Must be `array`"
149155
type:
150156
type: enum
157+
name: Array_name
151158
symbols:
152159
- "sld:array"
153160
jsonldPredicate:
@@ -173,5 +180,4 @@ $graph:
173180
_id: "sld:items"
174181
_type: "@vocab"
175182
refScope: 2
176-
typeDSL: True
177183
doc: "Defines the type of the array elements."

salad/schema_salad/metaschema/salad.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22

33
Author:
44

5-
* Peter Amstutz <[email protected]>, Arvados Project, Curii Corporation
5+
* Peter Amstutz <[email protected]>, Curii Corporation
66

77
Contributors:
88

99
* The developers of Apache Avro
1010
* The developers of JSON-LD
1111
* Nebojša Tijanić <[email protected]>, Seven Bridges Genomics
12+
* Michael R. Crusoe, ELIXIR-DE
1213

1314
# Abstract
1415

@@ -72,7 +73,7 @@ documentation.
7273

7374
## Introduction to v1.1
7475

75-
This is the third version of the Schema Salad specification. It is
76+
This is the third version of of the Schema Salad specification. It is
7677
developed concurrently with v1.1 of the Common Workflow Language for use in
7778
specifying the Common Workflow Language, however Schema Salad is intended to be
7879
useful to a broader audience. Compared to the v1.0 schema salad
@@ -86,6 +87,13 @@ specification, the following changes have been made:
8687
is poorly documented, not included in conformance testing,
8788
and not widely supported.
8889

90+
## Introduction to v1.2
91+
92+
This is the fourth version of the Schema Salad specification. It was created to
93+
ease the development of extensions to CWL v1.2. The only change is that
94+
inherited records can narrow the types of fields if those fields are re-specified
95+
with a matching jsonldPredicate.
96+
8997
## References to Other Specifications
9098

9199
**Javascript Object Notation (JSON)**: http://json.org
@@ -113,7 +121,7 @@ the behavior of conforming implementations.
113121

114122
The terminology used to describe Salad documents is defined in the Concepts
115123
section of the specification. The terms defined in the following list are
116-
used in building those definitions and in describing the actions of a
124+
used in building those definitions and in describing the actions of an
117125
Salad implementation:
118126

119127
**may**: Conforming Salad documents and Salad implementations are permitted but
@@ -139,7 +147,7 @@ enable or disable the behavior described.
139147
## Data concepts
140148

141149
An **object** is a data structure equivalent to the "object" type in JSON,
142-
consisting of an unordered set of name/value pairs (referred to here as
150+
consisting of a unordered set of name/value pairs (referred to here as
143151
**fields**) and where the name is a string and the value is a string, number,
144152
boolean, array, or object.
145153

@@ -248,23 +256,26 @@ rules:
248256
field.
249257

250258
* If the value of `jsonldPredicate` is an object, and that
251-
object contains the field `_type` with the value `@id`, the field is a
252-
link field subject to [link validation](#Link_validation).
259+
object contains the field `_type` with the value `@id`, the
260+
field is a link field. If the field `jsonldPredicate` also
261+
has the field `identity` with the value `true`, the field is
262+
resolved with [identifier resolution](#Identifier_resolution).
263+
Otherwise it is resolved with [link resolution](#Link_resolution).
253264

254265
* If the value of `jsonldPredicate` is an object which contains the
255266
field `_type` with the value `@vocab`, the field value is subject to
256267
[vocabulary resolution](#Vocabulary_resolution).
257268

258269
## Document traversal
259270

260-
To perform document preprocessing, link validation and schema
271+
To perform document document preprocessing, link validation and schema
261272
validation, the document must be traversed starting from the fields or
262273
array items of the root object or array and recursively visiting each child
263274
item which contains an object or arrays.
264275

265276
## Short names
266277

267-
The "short name" of a fully qualified identifier is the portion of
278+
The "short name" of an fully qualified identifier is the portion of
268279
the identifier following the final slash `/` of either the fragment
269280
identifier following `#` or the path portion, if there is no fragment.
270281
Some examples:

salad/schema_salad/metaschema/typedsl_res.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
following micro-DSL for schema salad types:
66
77
* If the type ends with a question mark `?`, the question mark is stripped off and the type is expanded to a union with `null`
8-
* If the type ends with square brackets `[]` it is expanded to an array with items of the preceeding type symbol
8+
* If the type ends with square brackets `[]` it is expanded to an array with items of the preceding type symbol
99
* The type may end with both `[]?` to indicate it is an optional array.
1010
* Identifier resolution is applied after type DSL expansion.
1111

0 commit comments

Comments
 (0)