-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
protoc-gen-swagger: support JSON Schema Validation properties and add openapiv2_field option #687
protoc-gen-swagger: support JSON Schema Validation properties and add openapiv2_field option #687
Conversation
5c5945d
to
95a51b4
Compare
95a51b4
to
f1640f4
Compare
Codecov Report
@@ Coverage Diff @@
## master #687 +/- ##
==========================================
- Coverage 56.3% 56.16% -0.14%
==========================================
Files 30 30
Lines 3062 3112 +50
==========================================
+ Hits 1724 1748 +24
- Misses 1167 1193 +26
Partials 171 171
Continue to review full report at Codecov.
|
Hi, I really need these changes for my works but there aren't any reactions for a month. |
This is really interesting, but to make things easier for us maintainers, could you please include a description of the changes? Include any external links as well. |
@johanbrandhorst Thanks for your advice! I've added descriptions to this pull request. If it's OK, I will also change the commit message to follow it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't think of a better way to go about it. I would just rename the new option, but otherwise this seems to be it.
// | ||
// All IDs are the same, as assigned. It is okay that they are the same, as they extend | ||
// different descriptor messages. | ||
JSONSchema openapiv2_field_json_schema = 1042; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we name this just openapiv2_field
similar to what was done with other options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed it in 48e32c9
390572b
to
48e32c9
Compare
I wonder why the |
@co3k There's definitely something weird up with our CI pipeline at the moment, I'm trying to work out with the other maintainers what we need to do, sorry for the inconvenience. We'll get this change in as soon as possible! |
48e32c9
to
2f1899b
Compare
… openapiv2_field option This change supports [JSON Schema Validation](https://tools.ietf.org/html/draft-fge-json-schema-validation-00) properties. It allows you to specify some validation rules in `openapiv2_schema` option and `openapiv2_field` option of your .proto files.
2f1899b
to
757aaa0
Compare
Oh, I'm sorry...I've forgotten to do Finally, Travis CI builds have been passed. |
You absolutely should not be expected to do this. Install it from the vendor folder: |
Thanks for your contribution! |
@johanbrandhorst would it be possible to have the |
This change supports JSON Schema Validation properties.
It allows you to specify some validation rules in
.proto
file like this:And also this supports openapiv2_field field option.
It allows you to specifiy additional JSON schema setting like this:
The both of
grpc.gateway.protoc_gen_swagger.options.openapiv2_schema
andgrpc.gateway.protoc_gen_swagger.options.openapiv2_field
now supports the following validation properties.Please see also JSON Schema Validation spec to understand about these properties.