Skip to content

Commit 6992048

Browse files
bugfix standard attribute validation and EngMeta example
1 parent 4764975 commit 6992048

File tree

9 files changed

+557
-49
lines changed

9 files changed

+557
-49
lines changed

docs/conventions/examples/EngMeta.ipynb

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,55 @@
128128
{
129129
"cell_type": "code",
130130
"execution_count": 4,
131-
"id": "d6837d44-1064-4d0b-aa37-09df20f5bbb8",
131+
"id": "1ff37233-79f8-4da2-92d3-a705281520ba",
132132
"metadata": {},
133133
"outputs": [
134134
{
135-
"name": "stderr",
136-
"output_type": "stream",
137-
"text": [
138-
"C:\\Users\\da4323\\Documents\\programming\\GitHub\\h5RDMtoolbox\\h5rdmtoolbox\\conventions\\standard_attributes.py:297: StandardAttributeValidationWarning: The attribute \"creator\" could not be validated due to: 1 validation error for personOrOrganization\n",
139-
"role.value\n",
140-
" Input should be a valid string [type=string_type, input_value={'value': 'Researcher'}, input_type=dict]\n",
141-
" For further information visit https://errors.pydantic.dev/2.3/v/string_type\n",
142-
" warnings.warn(f'The attribute \"{self.name}\" could not be validated due to: {err}',\n",
143-
"C:\\Users\\da4323\\Documents\\programming\\GitHub\\h5RDMtoolbox\\h5rdmtoolbox\\conventions\\standard_attributes.py:297: StandardAttributeValidationWarning: The attribute \"pid\" could not be validated due to: 1 validation error for pid\n",
144-
"type.value\n",
145-
" Input should be a valid string [type=string_type, input_value={'value': 'other'}, input_type=dict]\n",
146-
" For further information visit https://errors.pydantic.dev/2.3/v/string_type\n",
147-
" warnings.warn(f'The attribute \"{self.name}\" could not be validated due to: {err}',\n"
148-
]
149-
},
135+
"data": {
136+
"text/plain": [
137+
"personOrOrganization(name='Matthias Probst', givenName=None, familyName=None, address=None, affiliation=None, email=None, id='https://orcid.org/0000-0001-8729-0482', role=contributorType(value=<contributorType.Researcher: 'Researcher'>))"
138+
]
139+
},
140+
"execution_count": 4,
141+
"metadata": {},
142+
"output_type": "execute_result"
143+
}
144+
],
145+
"source": [
146+
"contact.validate(dict(name='Matthias Probst',\n",
147+
" id='https://orcid.org/0000-0001-8729-0482',\n",
148+
" role='Researcher'\n",
149+
" ), None)"
150+
]
151+
},
152+
{
153+
"cell_type": "code",
154+
"execution_count": 5,
155+
"id": "94d4146a-726c-4c46-aca6-7a771748c864",
156+
"metadata": {},
157+
"outputs": [
158+
{
159+
"data": {
160+
"text/plain": [
161+
"personOrOrganization(name='Matthias Probst', givenName=None, familyName=None, address=None, affiliation=None, email=None, id=None, role=None)"
162+
]
163+
},
164+
"execution_count": 5,
165+
"metadata": {},
166+
"output_type": "execute_result"
167+
}
168+
],
169+
"source": [
170+
"contact.validate(dict(name='Matthias Probst',\n",
171+
" ), None)"
172+
]
173+
},
174+
{
175+
"cell_type": "code",
176+
"execution_count": 10,
177+
"id": "d6837d44-1064-4d0b-aa37-09df20f5bbb8",
178+
"metadata": {},
179+
"outputs": [
150180
{
151181
"data": {
152182
"text/html": [
@@ -338,12 +368,12 @@
338368
"\n",
339369
" <ul style=\"list-style-type: none;\" class=\"h5grp-sections\">\n",
340370
" <li>\n",
341-
" <input id=\"group-ds--6465795800\" type=\"checkbox\" checked>\n",
342-
" <label style=\"font-weight: bold\" for=\"group-ds--6465795800\">\n",
371+
" <input id=\"group-ds--15793881400\" type=\"checkbox\" checked>\n",
372+
" <label style=\"font-weight: bold\" for=\"group-ds--15793881400\">\n",
343373
" /<span>(0)</span></label>\n",
344374
" \n",
345375
"\n",
346-
" <ul class=\"h5tb-attr-list\"><li style=\"list-style-type: none; font-style: italic\">__h5rdmtoolbox_version__ : 0.10.0</li><li style=\"list-style-type: none; font-style: italic\">contact : name='Matthias Probst' givenName=None familyName=None address=None affiliation=None email=None id...</li><li style=\"list-style-type: none; font-style: italic\">creator : {'name': 'Matthias Probst', 'id': 'https://orcid.org/0000-0001-8729-0482', 'role': {'value': 'Res...</li><li style=\"list-style-type: none; font-style: italic\">pid : {'id': '123', 'type': {'value': 'other'}}</li><li style=\"list-style-type: none; font-style: italic\">title : Test file to demonstrate usage of EngMeta schema</li>\n",
376+
" <ul class=\"h5tb-attr-list\"><li style=\"list-style-type: none; font-style: italic\">__h5rdmtoolbox_version__ : 0.11.0</li><li style=\"list-style-type: none; font-style: italic\">contact : name='Matthias Probst' givenName=None familyName=None address=None affiliation=None email=None id...</li><li style=\"list-style-type: none; font-style: italic\">creator : name='Matthias Probst' givenName=None familyName=None address=None affiliation=None email=None id...</li><li style=\"list-style-type: none; font-style: italic\">pid : id='123' type=pidTypes(value=<pidTypes.other: 'other'>) scheme=None</li><li style=\"list-style-type: none; font-style: italic\">title : Test file to demonstrate usage of EngMeta schema</li>\n",
347377
" </ul>\n",
348378
"</li>\n",
349379
"</ul>\n",
@@ -381,7 +411,7 @@
381411
},
382412
{
383413
"cell_type": "code",
384-
"execution_count": 5,
414+
"execution_count": 11,
385415
"id": "206c6ca0-35ac-4221-b626-d27e3abe4a02",
386416
"metadata": {},
387417
"outputs": [],
@@ -396,7 +426,7 @@
396426
},
397427
{
398428
"cell_type": "code",
399-
"execution_count": 6,
429+
"execution_count": 12,
400430
"id": "6258751b-b488-45fd-a0b1-1f8dacca3b64",
401431
"metadata": {},
402432
"outputs": [
@@ -405,10 +435,10 @@
405435
"text/plain": [
406436
"{'file_size': array(10552) <Unit('byte')>,\n",
407437
" 'file_type': 'hdf5',\n",
408-
" 'checksum': '64b4e38830dbffc210f256b3cd469774'}"
438+
" 'checksum': '72a399d75914328a923e8d22c3276270'}"
409439
]
410440
},
411-
"execution_count": 6,
441+
"execution_count": 12,
412442
"metadata": {},
413443
"output_type": "execute_result"
414444
}
@@ -420,7 +450,7 @@
420450
{
421451
"cell_type": "code",
422452
"execution_count": null,
423-
"id": "34a7f701-24de-4404-8015-f7c035e1548c",
453+
"id": "3452fe5a-707a-41b1-b937-fb93036eec54",
424454
"metadata": {},
425455
"outputs": [],
426456
"source": []

docs/conventions/examples/EngMeta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ description:
8989
keywords:
9090
description: List of describing keywords.
9191
target_method: __init__
92-
validator: $list_of_str
92+
validator: List[str]
9393
default_value: $NONE
9494

9595
$subject:

0 commit comments

Comments
 (0)