[plone.restapi] dealing with references and their constraints

I am using plone.restapi for creating objects containing fields with UID references like:

    gl_refs_onkopedia_p = schema.List(
        title=_('References to Onkopedia-P'),
        description=_('References to Onkopedia-P'),
        required=False,
        value_type=schema.Choice(
            source=OnkopediaPathBinder(['onkopedia-p'])
        ),
        default=[],
    

The configured vocabulary sources contains a list of object uids matching a particular catalog query.

As part of a migration the related vocabulary values (the UIDs of the related objects) are not yet available and lead to this error:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 128, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 268, in publish_module
  Module ZPublisher.WSGIPublisher, line 210, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 57, in call_object
  Module plone.rest.service, line 23, in __call__
  Module plone.restapi.services, line 19, in render
  Module plone.restapi.services.content.add, line 70, in reply
  Module plone.restapi.deserializer.dxcontent, line 129, in __call__
zExceptions.BadRequest: [{'message': 'Constraint not satisfied', 'field': 'gl_refs_onkopedia', 'error': ConstraintNotSatisfied('e76d6fae2b48461080e5170d6d59ab33', '')}, {'message': 'Constraint not satisfied', 'field': 'gl_refs_my_onkopedia', 'error': ConstraintNotSatisfied('2e83a9b71f784046ae315a63b9a96299', '')}, {'message': 'Constraint not satisfied', 'field': 'gl_refs_knowledge_database', 'error': ConstraintNotSatisfied('961089d8febbd6eb8604ea618eceba65', '')}]

Could you please create an issue on github?

I don't think that this is a specific plone.restapi problem...it would occur when you recreate the content through a ZEO client as well. I think it is a more fundamental issue.