-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for predefined constraints #35
Comments
Yeah, this tool doesn't yet support predefined constraints... but I'm curious why it's outputting that way for you + eventItemRefId:
+ type: string
+ title: event_item_ref_id
+ description: |-
+ (buf.validate.field).string.(refid) is now re-usable across many other messages
+ that all have the same field type It looks like I need to add some code to specifically get the predefined constraints add add it to the description like the unpredefined version. I'm going to adjust your title a little bit to reflect this. |
My output was different because the comment in my example was just added to show some reasoning why I was doing it for the GH issue. The actual code lacked that comment block. |
Oh got it! Understood! But yeah, thanks for the issue! This should be quick but I am asking buf folks about the best way to get this information since they don't yet provide an easy interface for getting constraints defined this way. |
Sounds good @sudorandom! 👍 |
Related: bufbuild/protovalidate-go#147 |
@sudorandom looks like the upstream change (addition of |
Using the rather new (released within the last week or two as part of protovalidate-go v0.8.0 from this pr) support for predefined constraints, the openapi output looks a little odd.
In and effort to reduce boilerplate, I went from a definition of this:
To this:
And the openapi output changed thusly:
Is this description change expected?
If using a predefined constraint, it would be nice to retain the simpler and more easily readable description, if possible (eg. drill down to show the message and expression like before).
The text was updated successfully, but these errors were encountered: