Skip to content

v0.6.0-jsonname+1

Pre-release
Pre-release
Compare
Choose a tag to compare
@uanid uanid released this 08 Nov 02:37
· 7 commits to main since this release

This is beta version of protoc-gen-jsonschema.

Now this can respoects protobuf`s json_name field.

The api or option of plugin would be change!

Source protobuf:

message Message {
  float foo_bar_baz = 1 [
    json_name = "fooBarBaz",
    (pubg.jsonschema.field) = {numeric : {exclusive_minimum : 0}}
  ];
}

Destination json schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$ref": "#/$defs/.Message",
  "$defs": {
    ".Message": {
      "properties": {
        "fooBarBaz": {
          "$ref": "#/$defs/.Message.foo_bar_baz"
        }
      },
      "type": "object",
      "required": [
        "fooBarBaz"
      ]
    },
    ".Message.foo_bar_baz": {
      "type": "number",
      "exclusiveMinimum": 0
    }
  },
  "type": "object"
}

Changelog

  • e08295e feat: Respect json_name option