Skip to content

Commit 563c6e5

Browse files
committed
optimize: reduce quantor allocations
1 parent deac891 commit 563c6e5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

schema_props.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ func (s *schemaPropsValidator) SetPath(path string) {
4343
}
4444

4545
func newSchemaPropsValidator(path string, in string, allOf, oneOf, anyOf []spec.Schema, not *spec.Schema, deps spec.Dependencies, root interface{}, formats strfmt.Registry) *schemaPropsValidator {
46-
var anyValidators []SchemaValidator
46+
anyValidators := make([]SchemaValidator, 0, len(anyOf))
4747
for _, v := range anyOf {
4848
anyValidators = append(anyValidators, *NewSchemaValidator(&v, root, path, formats))
4949
}
50-
var allValidators []SchemaValidator
50+
allValidators := make([]SchemaValidator, 0, len(allOf))
5151
for _, v := range allOf {
5252
allValidators = append(allValidators, *NewSchemaValidator(&v, root, path, formats))
5353
}
54-
var oneValidators []SchemaValidator
54+
oneValidators := make([]SchemaValidator, 0, len(oneOf))
5555
for _, v := range oneOf {
5656
oneValidators = append(oneValidators, *NewSchemaValidator(&v, root, path, formats))
5757
}

0 commit comments

Comments
 (0)