Skip to content

Commit

Permalink
Merge pull request #27 from gdcc/fix-datetime-year
Browse files Browse the repository at this point in the history
Fix date fields not accepting years
  • Loading branch information
JR-1991 authored Oct 16, 2024
2 parents 0688ff1 + 3770c99 commit d1543ab
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 75 deletions.
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

0 comments on commit d1543ab

Please sign in to comment.