devongovett / protobuf-jsonschema

Compiles Protobuf IDL to JSON Schema
120 stars 37 forks source link

Any chance for transferring proto comments directly above a field to `"$comment"` keyword inside the json type? #10

Open iguberman opened 5 years ago

iguberman commented 5 years ago

i.e. PROTO:

message TIMESTAMP {
        // Represents seconds of UTC time since Unix epoch
        required int64 seconds = 1;   

        // Non-negative fractions of a second at millisecond resolution
        required int32 millis = 2;        
}

JSON SCHEMA:


"TIMESTAMP": {
      "title": "TIMESTAMP",
      "type": "object",
      "properties": {
        "seconds": {
          "type": "integer",
          "minimum": -9007199254740991,
          "maximum": 9007199254740991,
          "$comment" : "Represents seconds of UTC time since Unix epoch"
        },
        "millis": {
          "type": "integer",
          "minimum": -2147483648,
          "maximum": 2147483647,
          "$comment" : "Non-negative fractions of a second at millisecond resolution",
        }
      },
      "required": [
        "seconds",
        "millis"
      ]
    }