Replies: 2 comments 1 reply
-
I like this idea, and also feels easy to implement. One potential caveat here is lack of actual JSON in some cases, for example tag-based validation is applied also to Perhaps such scenario might be relevant for other transports, or if we want to stick to |
Beta Was this translation helpful? Give feedback.
-
I like this idea, especially for testable code. I'd also like to see if it were possible to set the validation values via methods on the struct. For example if I have an enum type, I would rather reference a string slice in my code as possible enums then have to update a tag that's static, or let's say I have a setting that allows customization of a max length of a field that an end user can set, being able to pull that in from a configuration an set maxlength to this dynamic setting on server startup when the openapi config is generated would be very nice. Additionally, it would be nice if I could add For example if I'm using a ULID or a UUID field, it would be nice to validate them as valid parseable values before getting into the interact portion of my code. @vearutop thoughts? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've tried to test usecases in isolation without the http-transport and request-decoding. This is easy but misses the schema validation. The validation seems to be bound to the the http-request if I did not miss something. This problem would also be the case if I would try to reuse a usecase f.e. in a CLI-context.
To me it seems like mapping and validation are two separate concerns. Ideally I would be able to
Interact
with ausecase
and the validation would be done automagically as, at least to me, it's part of the business logic.f.e.:
Alternatively an API like this would also be fine so that I would be able to validate on a case by case basis:
Beta Was this translation helpful? Give feedback.
All reactions