Skip to content

Commit 8f6e232

Browse files
bblfishmr-c
andauthored
add missing basket examples (#542)
Co-authored-by: Michael R. Crusoe <[email protected]>
1 parent 73cf507 commit 8f6e232

File tree

3 files changed

+64
-10
lines changed

3 files changed

+64
-10
lines changed

schema_salad/tests/basket.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# N.B.: this example is used in a test that needs a file without $base,
2-
# so please do not include $base here.
3-
- name: Basket
4-
doc: A basket of products.
5-
type: record
6-
documentRoot: true
7-
fields:
8-
product: string
9-
price: float
1+
basket:
2+
- product: bananas
3+
price: 0.39
4+
per: pound
5+
weight: 1
6+
- product: cucumbers
7+
price: 0.79
8+
per: item
9+
count: 3

schema_salad/tests/basket_schema.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# N.B.: this example is used in a test that needs a file without $base,
2+
# so please do not include $base here.
3+
- name: Product
4+
doc: |
5+
The base type for a product. This is an abstract type, so it
6+
can't be used directly, but can be used to define other types.
7+
type: record
8+
abstract: true
9+
fields:
10+
product: string
11+
price: float
12+
13+
- name: ByWeight
14+
doc: |
15+
A product, sold by weight. Products may be sold by pound or by
16+
kilogram. Weights may be fractional.
17+
type: record
18+
extends: Product
19+
fields:
20+
per:
21+
type:
22+
type: enum
23+
symbols:
24+
- pound
25+
- kilogram
26+
jsonldPredicate: "#per"
27+
weight: float
28+
29+
- name: ByCount
30+
doc: |
31+
A product, sold by count. The count must be a integer value.
32+
type: record
33+
extends: Product
34+
fields:
35+
per:
36+
type:
37+
type: enum
38+
symbols:
39+
- item
40+
jsonldPredicate: "#per"
41+
count: int
42+
43+
- name: Basket
44+
doc: |
45+
A basket of products. The 'documentRoot' field indicates it is a
46+
valid starting point for a document. The 'basket' field will
47+
validate subtypes of 'Product' (ByWeight and ByCount).
48+
type: record
49+
documentRoot: true
50+
fields:
51+
basket:
52+
type:
53+
type: array
54+
items: Product

schema_salad/tests/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ def get_data_uri(resource_path: str) -> str:
4040

4141
cwl_file_uri = get_data_uri("tests/test_schema/CommonWorkflowLanguage.yml")
4242
metaschema_file_uri = get_data_uri("metaschema/metaschema.yml")
43-
basket_file_uri = get_data_uri("basket.yml")
43+
basket_file_uri = get_data_uri("tests/basket_schema.yml")

0 commit comments

Comments
 (0)