Skip to content

Commit

Permalink
fix: Fix schemaForScalar
Browse files Browse the repository at this point in the history
Signed-off-by: Oğuzhan Durgun <[email protected]>
  • Loading branch information
oguzhand95 committed Sep 27, 2023
1 parent 041f0f2 commit 2a0008c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions internal/module/scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,20 @@ func (m *Module) schemaForScalar(scalar pgs.ProtoType, constraints *validate.Fie
return m.schemaForNumericScalar(scalar, constraints)
}

if constraints == nil {
return nil, false
ignoreEmpty := false
if constraints != nil {
ignoreEmpty = constraints.IgnoreEmpty
}

switch scalar {
case pgs.BoolT:
return m.schemaForBool(constraints.GetBool())

case pgs.BytesT:
return m.schemaForBytes(constraints.GetBytes(), constraints.IgnoreEmpty)
return m.schemaForBytes(constraints.GetBytes(), ignoreEmpty)

case pgs.StringT:
return m.schemaForString(constraints.GetString_(), constraints.IgnoreEmpty)
return m.schemaForString(constraints.GetString_(), ignoreEmpty)

default:
m.Failf("unexpected scalar type %q", scalar)
Expand Down

0 comments on commit 2a0008c

Please sign in to comment.