Skip to content

alternativeURL value with doNotValidate=true causes a 500 error with vague error message #12114

@FlorianRhiem

Description

@FlorianRhiem

What steps does it take to reproduce the issue?

  • When does this issue occur?

When attempting to create a dataset via the API with the query-Parameter doNotValidate set to true and the following JSON body:

{
    "datasetVersion": {
        "metadataBlocks": {
            "citation": {
                "displayName": "Citation Metadata",
                "fields": [
                    {
                        "typeName": "title",
                        "multiple": false,
                        "typeClass": "primitive",
                        "value": "Example Title"
                    },
                    {
                        "typeName": "alternativeURL",
                        "multiple": false,
                        "typeClass": "primitive",
                        "value": "http://localhost:5000/objects/8"
                    },
                    {
                        "typeName": "author",
                        "multiple": true,
                        "typeClass": "compound",
                        "value": [
                            {
                                "authorName": {
                                    "typeName": "authorName",
                                    "multiple": false,
                                    "typeClass": "primitive",
                                    "value": "Example Author Name"
                                }
                            }
                        ]
                    }
                ]
            }
        }
    }
}

I'm attaching a Python script containing the example: dataverse_mwe.py

  • Which page(s) does it occurs on?

POST requests to API endpoint /api/v1/dataverses/<id>/datasets/

  • What happens?

The API returns status code 500 and the following body:

{"status":"ERROR","message":"Command [DatasetCreate dataset:null] failed: Exception thrown from bean: jakarta.validation.ConstraintViolationException: One or more Bean Validation constraints were violated while executing Automatic Bean Validation on callback event: prePersist for class: edu.harvard.iq.dataverse.DatasetFieldValue. Please refer to the embedded constraint violations for details."}

Omitting the alternativeURL field or using "http://example.com/objects/8" instead of "http://localhost:5000/objects/8" is successful.

Omitting the doNotValidate query parameter instead results in status code 403 and the following body:

{"status":"ERROR","message":"Validation Failed: PoF IV topic is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]), Alternative URL http://localhost:5000/objects/8  is not a valid URL. (Invalid value:edu.harvard.iq.dataverse.DatasetFieldValueValue[ id=null ]), Subject is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]), Institute is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]), Method Parameters Name is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]), Point of Contact E-mail is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]), Description Text is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]), Processing Methods Name is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]), Software Name is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]), Instruments Name is required. (Invalid value:edu.harvard.iq.dataverse.DatasetField[ id=null ]).java.util.stream.ReferencePipeline$3@49cf567a"}
  • To whom does it occur (all users, curators, superusers)?

Curators

  • What did you expect to happen?

Either the dataset should be created successfully, or a more specific error message should be reported on failure. The error message Alternative URL http://localhost:5000/objects/8 is not a valid URL. that occurs when doNotValidate is not set, would be clearer. I don't know whether the better error message or successful creation of the dataset is the "correct" outcome.

Which version of Dataverse are you using?

6.8

Any related open or closed issues to this bug report?

#4108 is about email validation, but the issue resulted in the same error message.

Related discussion: https://dataverse.zulipchat.com/#narrow/channel/378866-troubleshooting/topic/create.20dataset.20validation.20failure/near/570117371

Metadata

Metadata

Assignees

Type

Projects

Status

Important

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions