NCATSTranslator / workflow-runner

1 stars 1 forks source link

An unknown operation doesn't give a helpful error message #36

Open kennethmorton opened 2 years ago

kennethmorton commented 2 years ago

Attempting to use a valid operation that has no valid operation provider currently results in a 500. We should check that all operations are valid and that we have operation providers for that operation.

cbizon commented 2 years ago

I think that this is supposed to raise a 422 (at least that's what aragorn does)

uhbrar commented 2 years ago

Just to clarify, is this for an unknown operation, or an operation without any operation providers? An invalid or unknown operation already raises a 422. The error is caused when we have no operation providers for a given operation, but the operation itself is valid.

cbizon commented 2 years ago

Does the workflow runner have an operations element in its openapi saying which operations it implements?

Assuming it does, then any incoming operation that's not in the list (valid or not) should return something in the 400 range b/c the user should know better than to send invalid or unimplemented ops.

uhbrar commented 2 years ago

The workflow runner maintains a list of valid operations (as dictated by the operations schema from the operations and workflow repo and exposed at standards.ncats.io), but it doesn't report any operations in its openapi spec, at least not that I can see.

Even if it did, I don't think it would make sense to to even report something like "operations which have at least one valid service provider" reported in openapi since the /refresh endpoint can be used to reload all operations and operation providers, which would then necessitate a refresh of the openapi spec.

We do throw a 422 for an invalid operation, but since the workflow runner doesn't actually implement any operations and only acts a messenger to contact services that do provide services, I think it's reasonable that it isn't exposed at all.