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

Allow passing of "id" during the schema generation

Open sghosh-discovery opened this issue 2 years ago • 1 comments

Hi,

It appears that we can't pass an "id" field. This is useful for JSON schema versioning. We should be able to pass a remote ID.

Thanks.

sghosh-discovery avatar Nov 18 '22 01:11 sghosh-discovery

Hi @sghosh-discovery, thank you for getting in touch. Just so I can understand, are you talking about filling in some value for the $id property (as described here)?

This is something I can have a look at. Where would you suggest that we source this property from? I've had issues with this property before, as depending on what you're using these schemas with they may want to actually resolve references in here. I've certainly seen this break certain validators in the past, so we'd need to be careful how this is implemented (probably controlled by an option or flag, off by default).

Some suggestions:

  • The name of the generated json file
  • Some name derived from the source proto file and message/enum

Please let me know what you were thinking and we'll see what we can come up with. Thanks for your interest in the project!

chrusty avatar Dec 15 '22 20:12 chrusty