Chemical-Curation / chemcurator_django

Backend services for chemical curation
https://api.chemreg.epa.gov
MIT License
1 stars 0 forks source link

#120 update inchikey conflict error, validate in serializer #205

Closed debboutr closed 3 years ago

debboutr commented 3 years ago

In order to build the links in the returned validation error I moved the validation to the validate method of the serializer. Seeing as we don't require an inchikey it is not supplied in initial_data until the to_internal_value method is run.

As for the error, IDK if all of the keys are really required to keep in the output, I had just kept it as close to how it was originally and added the links, but if you look closer in the tests at the serialized.errors you will see that it is not really a pretty object, but delivers what is needed.