Skip to content

Commit 4a847d7

Browse files
authored
Merge pull request #1320 from Sage-Bionetworks/SYNPY-1766-display-names
valid values and properties now use labels at the same time
2 parents 23ea50c + 8352ee1 commit 4a847d7

7 files changed

Lines changed: 125 additions & 326 deletions

File tree

docs/tutorials/python/schema_operations.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ Create a JSON Schema
8989

9090
If you don't set `output` parameter the JSON Schema file will be created in the current working directory.
9191

92+
## 9. Create a JSON Schema using display names
93+
94+
Create a JSON Schema
95+
96+
```python
97+
{!docs/tutorials/python/tutorial_scripts/schema_operations.py!lines=56-62}
98+
```
99+
100+
You can have Curator format the property names and valid values in the JSON Schema. This will remove whitespace and special characters.
101+
92102
## Source Code for this Tutorial
93103

94104
<details class="quote">

docs/tutorials/python/tutorial_scripts/schema_operations.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,11 @@
5252
data_types=DATA_TYPE,
5353
synapse_client=syn,
5454
)
55+
56+
# Create JSON Schema in using display names for both properties names and valid values
57+
schemas, file_paths = generate_jsonschema(
58+
data_model_source=DATA_MODEL_SOURCE,
59+
data_types=DATA_TYPE,
60+
data_model_labels="display_label",
61+
synapse_client=syn,
62+
)

synapseclient/extensions/curator/schema_generation.py

Lines changed: 67 additions & 75 deletions
Large diffs are not rendered by default.

tests/unit/synapseclient/extensions/schema_files/expected_jsonschemas/expected.JSONSchemaComponent.display_names_schema.json

Lines changed: 0 additions & 211 deletions
This file was deleted.

tests/unit/synapseclient/extensions/schema_files/expected_jsonschemas/expected.JSONSchemaComponent.schema.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@
1919
"Enum": {
2020
"description": "TBD",
2121
"enum": [
22-
"ab",
23-
"cd",
24-
"ef",
25-
"gh"
22+
"Ab",
23+
"Cd",
24+
"Ef",
25+
"Gh"
2626
],
2727
"title": "Enum"
2828
},
2929
"EnumNotRequired": {
3030
"description": "TBD",
3131
"enum": [
32-
"ab",
33-
"cd",
34-
"ef",
35-
"gh"
32+
"Ab",
33+
"Cd",
34+
"Ef",
35+
"Gh"
3636
],
3737
"title": "Enum Not Required"
3838
},
@@ -67,10 +67,10 @@
6767
"description": "TBD",
6868
"items": {
6969
"enum": [
70-
"ab",
71-
"cd",
72-
"ef",
73-
"gh"
70+
"Ab",
71+
"Cd",
72+
"Ef",
73+
"Gh"
7474
],
7575
"type": "string"
7676
},
@@ -81,10 +81,10 @@
8181
"description": "TBD",
8282
"items": {
8383
"enum": [
84-
"ab",
85-
"cd",
86-
"ef",
87-
"gh"
84+
"Ab",
85+
"Cd",
86+
"Ef",
87+
"Gh"
8888
],
8989
"type": "string"
9090
},

tests/unit/synapseclient/extensions/schema_files/expected_jsonschemas/expected.MockComponent.schema.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
"description": "TBD",
3838
"items": {
3939
"enum": [
40-
"ab",
41-
"cd",
42-
"ef",
43-
"gh"
40+
"Ab",
41+
"Cd",
42+
"Ef",
43+
"Gh"
4444
],
4545
"type": "string"
4646
},
@@ -51,10 +51,10 @@
5151
"description": "TBD",
5252
"items": {
5353
"enum": [
54-
"ab",
55-
"cd",
56-
"ef",
57-
"gh"
54+
"Ab",
55+
"Cd",
56+
"Ef",
57+
"Gh"
5858
],
5959
"type": "string"
6060
},
@@ -70,10 +70,10 @@
7070
"description": "TBD",
7171
"items": {
7272
"enum": [
73-
"ab",
74-
"cd",
75-
"ef",
76-
"gh"
73+
"Ab",
74+
"Cd",
75+
"Ef",
76+
"Gh"
7777
],
7878
"type": "string"
7979
},

0 commit comments

Comments
 (0)