Skip to content

Commit f65e2a7

Browse files
Gaurav Ojhagauravojha
authored andcommitted
Update golangci
Avoid repeated calls Retrigger
1 parent cbabf27 commit f65e2a7

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ linters:
1313
- lll # don't want hard limits for line length
1414
- maintidx # covered by gocyclo
1515
- mnd # some unnamed constants are okay
16+
- nestif # covered by gocyclo
1617
- nilnil
1718
- nlreturn # generous whitespace violates house style
1819
- noinlineerr

internal/protoschema/jsonschema/jsonschema.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,12 @@ func (p *Generator) generateField(entry *msgSchema, field protoreflect.FieldDesc
382382
func (p *Generator) generateFieldValidation(entry *msgSchema, field protoreflect.FieldDescriptor, hasImplicitPresence bool, rules *validate.FieldRules, schema map[string]any) error {
383383
if field.IsList() {
384384
schema["type"] = jsArray
385-
if rules.HasRepeated() {
386-
if rules.GetRepeated().MinItems != nil {
387-
schema["minItems"] = rules.GetRepeated().GetMinItems()
385+
if repeated := rules.GetRepeated(); repeated != nil {
386+
if repeated.HasMinItems() {
387+
schema["minItems"] = repeated.GetMinItems()
388388
}
389-
if rules.GetRepeated().MaxItems != nil {
390-
schema["maxItems"] = rules.GetRepeated().GetMaxItems()
389+
if repeated.HasMaxItems() {
390+
schema["maxItems"] = repeated.GetMaxItems()
391391
}
392392
}
393393
items := make(map[string]any)

0 commit comments

Comments
 (0)