Skip to content

Commit 7c24d64

Browse files
committed
chore: fix linting issues
1 parent ebdd90d commit 7c24d64

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkg/generator/schema_generator.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/atombender/go-jsonschema/pkg/schemas"
1010
)
1111

12-
var errCannotSupportMultipleTypesForAdditionalProperties = errors.New("cannot support multiple types for additional properties")
12+
var errTooManyTypesForAdditionalProperties = errors.New("cannot support multiple types for additional properties")
1313

1414
type schemaGenerator struct {
1515
*Generator
@@ -535,10 +535,10 @@ func (g *schemaGenerator) generateStructType(
535535
structType.AddField(structField)
536536
}
537537

538-
// checking .Not here because `false` is unmarshalled to .Not = Type{}
538+
// Checking .Not here because `false` is unmarshalled to .Not = Type{}.
539539
if t.AdditionalProperties != nil && t.AdditionalProperties.Not == nil {
540540
if len(t.AdditionalProperties.Type) > 1 {
541-
return nil, errCannotSupportMultipleTypesForAdditionalProperties
541+
return nil, errTooManyTypesForAdditionalProperties
542542
}
543543

544544
var (
@@ -554,30 +554,35 @@ func (g *schemaGenerator) generateStructType(
554554
KeyType: codegen.PrimitiveType{Type: "string"},
555555
ValueType: codegen.PrimitiveType{Type: "string"},
556556
}
557+
557558
case schemas.TypeNameArray:
558559
defaultValue = map[string][]any{}
559560
fieldType = codegen.MapType{
560561
KeyType: codegen.PrimitiveType{Type: "string"},
561562
ValueType: codegen.ArrayType{Type: codegen.EmptyInterfaceType{}},
562563
}
564+
563565
case schemas.TypeNameNumber:
564566
defaultValue = map[string]float64{}
565567
fieldType = codegen.MapType{
566568
KeyType: codegen.PrimitiveType{Type: "string"},
567569
ValueType: codegen.PrimitiveType{Type: "float64"},
568570
}
571+
569572
case schemas.TypeNameInteger:
570573
defaultValue = map[string]int{}
571574
fieldType = codegen.MapType{
572575
KeyType: codegen.PrimitiveType{Type: "string"},
573576
ValueType: codegen.PrimitiveType{Type: "int"},
574577
}
578+
575579
case schemas.TypeNameBoolean:
576580
defaultValue = map[string]bool{}
577581
fieldType = codegen.MapType{
578582
KeyType: codegen.PrimitiveType{Type: "string"},
579583
ValueType: codegen.PrimitiveType{Type: "bool"},
580584
}
585+
581586
default:
582587
defaultValue = map[string]any{}
583588
fieldType = codegen.MapType{

0 commit comments

Comments
 (0)