Replies: 1 comment 2 replies
-
My approach would be (and usually is) what you mentioned - custom scalars. Like a P.S. Could you link the mentioned thread? I'd like to catch up. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
What's the best practice of doing input validation with Ariadne. One of the threads mentions that directive-based validation is an anti-pattern, so I'd like to know what would be the correct way of doing it.
Example:
For example, I know that the ID must be a valid uuid, and the
nonNegativeValue
is strictly non-negative. With directives, I can annotate both of them with smth like@validUuid
, write a custom validation logic, and then it will be validated on any level regardless of how nested the input is. I can imagine one more way to be custom scalars but this would require extra integration on the frontend. Also it's possible to transform the input into pydantic BaseModel, but can be pretty slow.Best regards,
Petr
Beta Was this translation helpful? Give feedback.
All reactions