Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix date fields not accepting years #27

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions easyDataverse/classgen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from datetime import date
import forge
import types
import re
Expand All @@ -17,7 +16,7 @@
"integer": int,
"int": int,
"textbox": str,
"date": date,
"date": str,
"email": EmailStr,
}

Expand Down
148 changes: 76 additions & 72 deletions tests/fixtures/minimal_upload.json
Original file line number Diff line number Diff line change
@@ -1,75 +1,79 @@
{
"datasetVersion": {
"metadataBlocks": {
"citation": {
"fields": [
{
"multiple": true,
"typeClass": "compound",
"typeName": "author",
"value": [
{
"authorName": {
"multiple": false,
"typeClass": "primitive",
"typeName": "authorName",
"value": "John Doe"
}
}
]
},
{
"multiple": true,
"typeClass": "compound",
"typeName": "datasetContact",
"value": [
{
"datasetContactName": {
"multiple": false,
"typeClass": "primitive",
"typeName": "datasetContactName",
"value": "John Doe"
},
"datasetContactEmail": {
"multiple": false,
"typeClass": "primitive",
"typeName": "datasetContactEmail",
"value": "[email protected]"
}
}
]
},
{
"multiple": true,
"typeClass": "compound",
"typeName": "dsDescription",
"value": [
{
"dsDescriptionValue": {
"multiple": false,
"typeClass": "primitive",
"typeName": "dsDescriptionValue",
"value": "This is a description of the dataset"
}
}
]
},
{
"multiple": true,
"typeClass": "controlledVocabulary",
"typeName": "subject",
"value": [
"Other"
]
},
{
"multiple": false,
"typeClass": "primitive",
"typeName": "title",
"value": "My dataset"
}
]
}
}
"datasetVersion": {
"metadataBlocks": {
"citation": {
"fields": [
{
"multiple": true,
"typeClass": "compound",
"typeName": "author",
"value": [
{
"authorName": {
"multiple": false,
"typeClass": "primitive",
"typeName": "authorName",
"value": "John Doe"
}
}
]
},
{
"multiple": true,
"typeClass": "compound",
"typeName": "datasetContact",
"value": [
{
"datasetContactName": {
"multiple": false,
"typeClass": "primitive",
"typeName": "datasetContactName",
"value": "John Doe"
},
"datasetContactEmail": {
"multiple": false,
"typeClass": "primitive",
"typeName": "datasetContactEmail",
"value": "[email protected]"
}
}
]
},
{
"multiple": true,
"typeClass": "compound",
"typeName": "dsDescription",
"value": [
{
"dsDescriptionValue": {
"multiple": false,
"typeClass": "primitive",
"typeName": "dsDescriptionValue",
"value": "This is a description of the dataset"
},
"dsDescriptionDate": {
"multiple": false,
"typeClass": "primitive",
"typeName": "dsDescriptionDate",
"value": "2024"
}
}
]
},
{
"multiple": true,
"typeClass": "controlledVocabulary",
"typeName": "subject",
"value": ["Other"]
},
{
"multiple": false,
"typeClass": "primitive",
"typeName": "title",
"value": "My dataset"
}
]
}
}
}
}
3 changes: 2 additions & 1 deletion tests/integration/test_dataset_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def test_creation(
dataset.citation.subject = ["Other"]
dataset.citation.add_author(name="John Doe")
dataset.citation.add_ds_description(
value="This is a description of the dataset"
value="This is a description of the dataset",
date="2024",
)
dataset.citation.add_dataset_contact(
name="John Doe",
Expand Down
Loading