protoc-gen-twirp_swagger icon indicating copy to clipboard operation
protoc-gen-twirp_swagger copied to clipboard

How do you specify optional attributes?

Open doapp-ryanp opened this issue 6 years ago • 1 comments

Not sure this is a limitation of Twirp or .proto(3), but how do you convey to consumers that an attribute is optional?

For example what if I wanted to make the inches attribute optional on twitch.twirp.example.Haberdasher/MakeHat? I know I could manually modify the generated swagger.json file, however that diminishes the value of auto-generation.

doapp-ryanp avatar Apr 19 '18 13:04 doapp-ryanp

Required/optional doesn't exist in proto3. We could do it with some extended proto annotations though.

I started some work generating json-schema from the same proto files, and using them in the generated swagger file (see use-refs-to-jsonschema branch) but it isn't in a working state yet.

elliots avatar May 07 '18 06:05 elliots