Skip to content

Commit bdf9676

Browse files
committed
fix: ozzo validation
OpenAPI required, nullable, min and minLength influence how OZZO validation should be done.
1 parent 48607d1 commit bdf9676

File tree

24 files changed

+710
-249
lines changed

24 files changed

+710
-249
lines changed

pkg/generators/models/generate.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ import (
1111
"path/filepath"
1212
"strings"
1313

14-
tpl "github.com/contiamo/openapi-generator-go/v2/pkg/generators/templates"
1514
"github.com/getkin/kin-openapi/openapi3"
1615
"github.com/pkg/errors"
1716
"github.com/rs/zerolog"
17+
18+
tpl "github.com/contiamo/openapi-generator-go/v2/pkg/generators/templates"
1819
)
1920

2021
// DefaultPackageName used in the models source code
@@ -284,7 +285,7 @@ func (g generator) writeModelToFile(ctx context.Context, model *Model, dst strin
284285
log.Debug().Msg("Formatting the rendered code...")
285286
content, err := format.Source(buf.Bytes())
286287
if err != nil {
287-
return errors.Wrap(err, "cannot format model code")
288+
return errors.Wrap(err, "cannot format model code: "+buf.String())
288289
}
289290
log.Debug().Msg("Code has been formatted.")
290291

0 commit comments

Comments
 (0)