locdb / loc-db

This is the central component of the LOC-DB project.
9 stars 2 forks source link

Form Validation: Update Entry #11

Closed lgalke closed 6 years ago

lgalke commented 6 years ago

When submitting any entry form, the form validation fails for its identifiers (we added those because of CrossRef)

Error updating entry 500 - Internal Server Error
{"errors":{"parts.20.identifiers":{"message":"Cast to Array failed for value \"[ { scheme: 'DOI', literalValue: '10.2307/1914033' } ]\" at path \"identifiers\"","name":"CastError","stringValue":"\"[ { scheme: 'DOI', literalValue: '10.2307/1914033' } ]\"","kind":"Array","value":[{"scheme":"DOI","literalValue":"10.2307/1914033","_id":"5a05a8f5549461504d049e58"}],"path":"identifiers","reason":{}}},"_message":
"br validation failed","message":"br validation failed: parts.20.identifiers:
Cast to Array failed for value \"[ { scheme: 'DOI', literalValue: '10.2307/1914033' } ]\" at path \"identifiers\"","name":"ValidationError"}

When there are no identifiers given (as usual for the OCR result), everything works fine.

anlausch commented 6 years ago

Could you maybe provide an example with which I can test?

lgalke commented 6 years ago

Basically any bibliographic entry from the EXTERNAL tab and also the internal ones whenever you dare to add some identifier.

In particular,

{ "_id": "59f89542cddeb54b39191259" 
"identifiers":  [
{ scheme: "DOI", literalValue: "10.1007/978-3-642-60805-6" }
], ...
}
anlausch commented 6 years ago

I deployed a new version in which the identifiers array was added for BibliographicEntries to the Swagger validation. This should resolve the problem. Please check whether it works.

lgalke commented 6 years ago

Still a thing:

500 - Internal Server Error {"errors":{"parts.10.identifiers":{"message":"Cast to Array failed for value \"[ { scheme: 'DOI', literalValue: '10.1016/S0165-4896(99)00007-4' } ]\" at path \"identifiers\"","name":"CastError","stringValue":"\"[ { scheme: 'DOI', literalValue: '10.1016/S0165-4896(99)00007-4' } ]\"","kind":"Array","value":[{"scheme":"DOI","literalValue":"10.1016/S0165-4896(99)00007-4","_id":"5a12e12ea207a468e522244b"}],"path":"identifiers","reason":{}}},"_message":"br validation failed","message":"br validation failed: parts.10.identifiers: Cast to Array failed for value \"[ { scheme: 'DOI', literalValue: '10.1016/S0165-4896(99)00007-4' } ]\" at path \"identifiers\"","name":"ValidationError"}
anlausch commented 6 years ago

https://github.com/locdb/loc-db/commit/2e6130da986ac1fed92952f0746c7e06de406e5a