From 0b326c7970ab3c95e50fa20030f203fcb1548ba3 Mon Sep 17 00:00:00 2001 From: Cassondra Foesch Date: Thu, 19 Sep 2024 11:12:31 +0000 Subject: [PATCH] tests and fix bug --- internal/converter/testdata/proto/WellKnown.proto | 2 +- internal/converter/testdata/wellknown.go | 3 ++- internal/converter/types.go | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/converter/testdata/proto/WellKnown.proto b/internal/converter/testdata/proto/WellKnown.proto index 69a6292..a93e40f 100644 --- a/internal/converter/testdata/proto/WellKnown.proto +++ b/internal/converter/testdata/proto/WellKnown.proto @@ -13,7 +13,7 @@ message WellKnown { map map_of_scalar_integers = 3; repeated google.protobuf.Int32Value list_of_integers = 4; - google.protobuf.BoolValue bool_value = 5; + google.protobuf.BoolValue bool_value = 5; // description google.protobuf.BytesValue bytes_value = 6; google.protobuf.DoubleValue double_value = 7; google.protobuf.Duration duration = 8; diff --git a/internal/converter/testdata/wellknown.go b/internal/converter/testdata/wellknown.go index 3c2d961..cc7a443 100644 --- a/internal/converter/testdata/wellknown.go +++ b/internal/converter/testdata/wellknown.go @@ -53,7 +53,8 @@ const WellKnown = `{ { "type": "boolean" } - ] + ], + "description": "description" }, "bytes_value": { "oneOf": [ diff --git a/internal/converter/types.go b/internal/converter/types.go index ef4fa1a..4eda159 100644 --- a/internal/converter/types.go +++ b/internal/converter/types.go @@ -281,7 +281,8 @@ func (c *Converter) convertField(curPkg *ProtoPackage, desc *descriptor.FieldDes case pkgName == ".google.protobuf": jsonSchemaType.Type = recursedJSONSchemaType.Type jsonSchemaType.OneOf = recursedJSONSchemaType.OneOf - return recursedJSONSchemaType, nil + jsonSchemaType.AdditionalProperties = nil + return jsonSchemaType, nil // Objects: default: