Skip to content

Commit

Permalink
fix: required condition
Browse files Browse the repository at this point in the history
  • Loading branch information
uanid committed Sep 18, 2023
1 parent 1695fd3 commit 6b058ee
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pkg/modules/1_middleend_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func buildFromMessage(pluginOptions *proto.PluginOptions, message pgs.Message, m
}}
}

if !field.InRealOneOf() && !field.HasOptionalKeyword() && !field.Type().IsRepeated() {
if !field.InRealOneOf() && !field.HasOptionalKeyword() && !field.Type().IsRepeated() && !field.Type().IsMap() {
// If field is not a member of oneOf
schema.Required = append(schema.Required, propName)
}
Expand Down
3 changes: 1 addition & 2 deletions testdata/cases/plugin-entrypoint/test.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
"required": [
"int32",
"int32_2",
"string",
"map"
"string"
],
"description": "This is values2 message"
},
Expand Down
11 changes: 1 addition & 10 deletions testdata/cases/proto-map/test.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,7 @@
"$ref": "#/$defs/.tests.Values.enum_map"
}
},
"type": "object",
"required": [
"basic_map",
"int_map",
"float_map",
"bool_map",
"string_map",
"nested_map",
"enum_map"
]
"type": "object"
},
".tests.Values.basic_map": {
"additionalProperties": {
Expand Down

0 comments on commit 6b058ee

Please sign in to comment.