Stream: hapi
Topic: How to define a type-level global @Operation
Michael Lawley (Mar 08 2020 at 00:13):
I'm trying to implement a type-level operation that is common across all resources but can't work out how to do it.
If I do: @Operation(name="$my-op", global=true, idempotent=true)
then I get something that only operates at the server level. If I add an @IdParam
then I get something that operates at the instance level.
James Agnew (Mar 08 2020 at 13:04):
There's a typeName
attribute on the @Operation
annotation that should be usable for this
Michael Lawley (Mar 08 2020 at 13:06):
Thanks - I tried that but couldn't work out what to set it to.
It can't be a specific resource, because the operation applies to all resources. Setting it to "Resource" or similar doesn't work either.
James Agnew (Mar 08 2020 at 13:07):
oh, like you want it to work at thew type level, but for all resource types...
i don't think that's currently possible. probably would need a syntax like @Operation(typeName="*")
but that's not currently implemented
Michael Lawley (Mar 08 2020 at 13:09):
Yep, "*" would be awesome. At the moment I have to iterate through all types and register a provider instance for each one.
Michael Lawley (Mar 08 2020 at 13:12):
This is for $validate
BTW
Last updated: Apr 12 2022 at 19:14 UTC