trompamusic / trompace-client

A python library to read from and write to the Trompa CE
Apache License 2.0
1 stars 0 forks source link

Mutation Property Value Error #41

Closed aggelosgkiokas closed 4 years ago

aggelosgkiokas commented 4 years ago

I get the following error:

File "/home/aggelos/PycharmProjects/processing_library/application.py", line 113, in register resp = trompace.connection.submit_query(qry) File "/home/aggelos/envs/tpl/lib/python3.7/site-packages/trompace/connection.py", line 52, in submit_query raise QueryException(resp['errors']) trompace.exceptions.QueryException: Query error

  1. Expected type [ValidAdditionalPropertyNodeValueType], found "DigitalDocument". Did you mean the enum value DigitalDocument or DigitalDocumentPermission? occurred

Query executed:

mutation { CreateProperty( title: "Targetfile" name: "Magic input" description: "This is a magical input" rangeIncludes: "DigitalDocument" ) { identifier } }

config file when the pararams were read:

[Property1] name = Magic input title = Targetfile description = This is a magical input rangeincludes = DigitalDocument num_inputs = 1

alastair commented 4 years ago

It looks like the issue is here:

rangeIncludes: "DigitalDocument"

because when I search for ValidAdditionalPropertyNodeValueType in the CE, I see that it's an enum. In the CE, enums don't have quotes around them. for example when we set a language we do language: en not language: "en"

The documentation for this method says that it takes a list of string constants: https://github.com/trompamusic/trompa-ce-client/blob/master/trompace/mutations/property.py#L52, which should be correct for representing an enum.

It should be correctly loaded here: https://github.com/trompamusic/trompa-ce-client/blob/0ec27fcca02a3b453d8c067a3eba4090071db5b2/trompace/application/entrypoint_subs.py#L170, are you using this method, or did you write something different?

pc2752 commented 4 years ago

DigitalDocument is an enum value, please try it without the quotation symbols.

alastair commented 4 years ago

In the methods for creating people/compositions, etc, we accept a string argument and turn it into a StringConstant in the method: https://github.com/trompamusic/trompa-ce-client/blob/0ec27fcca02a3b453d8c067a3eba4090071db5b2/trompace/mutations/person.py#L66 I'm not sure what solution is best here, if we should use the same system in this part of the library, or if we should directly require StringConstants. I'll have a think through the best way to go ahead with this

aggelosgkiokas commented 4 years ago

Thanks!