Skip to content

Commit

Permalink
Merge pull request #735 from danilvpetrov/main
Browse files Browse the repository at this point in the history
fix(gen): avoid faulty warnings for `number` and `integer` types
  • Loading branch information
tdakkota authored Dec 31, 2022
2 parents 3879106 + afe34ee commit 46038bf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions gen/schema_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,16 @@ func (g *schemaGen) generate2(name string, schema *jsonschema.Schema) (ret *ir.T
}
if t.Validators.Int.Set() {
switch t.Primitive {
case ir.String, ir.ByteSlice:
case ir.Int,
ir.Int8,
ir.Int16,
ir.Int32,
ir.Int64,
ir.Uint,
ir.Uint8,
ir.Uint16,
ir.Uint32,
ir.Uint64:
default:
g.log.Warn("Int validator cannot be applied to generated type and will be ignored", fields...)
}
Expand All @@ -325,7 +334,7 @@ func (g *schemaGen) generate2(name string, schema *jsonschema.Schema) (ret *ir.T
}
if t.Validators.Float.Set() {
switch t.Primitive {
case ir.String, ir.ByteSlice:
case ir.Float32, ir.Float64:
default:
g.log.Warn("Float validator cannot be applied to generated type and will be ignored", fields...)
}
Expand Down

0 comments on commit 46038bf

Please sign in to comment.