-
-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Why do we need this improvement?
Spec is great, but if it's validated on a gateway level it creates possibility of developer sending message and gateway silently rejecting it. Plus, when there is a version difference between validation (on a gateway) and a client (on developer side) it could create situations where developer sending proper message (according to his spec) and gateway rejecting it. This decrease development cycle speed
How will this change help?
Developer will get exception immediately after passing wrong arguments.
Screenshots
No response
How could it be implemented/designed?
There is pydantic rules for python already, but for JS/TS this could be done with https://github.com/colinhacks/zod or as it's done in glee with ajv: https://github.com/asyncapi/glee/blob/897d7a81946897c00b6db87ca879d308ae13d914/src/lib/util.ts#L101. It doesn't matter, but this feature should be cross-language.
I don't like that you need to enable them per language with different options, that's crazy. I was expecting that you'll have just one argument --no-validation that will disable automatic validation rules generation, and if it's not present validation rules should be forced into models. For real, there is no use for models if I can put any garbage into them.
p.s. I don't want to rise another issue, but why spec descriptions is not present in models? In languages like python, it will bring you intellisense for free
🚧 Breaking changes
Yes
👀 Have you checked for similar open issues?
- I checked and didn't find a similar issue
🏢 Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to work on this issue?
Yes I am willing to submit a PR!