forked from loafle/openapi-generator-original
[GO] Add assert constraints checks for complex types in the model template (#18654)
* [GO] Add assert constraints checks for complex types in the model template * [GO] Update samples * [GO] revert AssertRecurseInterface naming
This commit is contained in:
@@ -64,5 +64,13 @@ func AssertUserRequired(obj User) error {
|
||||
|
||||
// AssertUserConstraints checks if the values respects the defined constraints
|
||||
func AssertUserConstraints(obj User) error {
|
||||
if obj.DeepSliceModel != nil {
|
||||
if err := AssertRecurseInterfaceRequired(*obj.DeepSliceModel, AssertTagConstraints); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := AssertRecurseInterfaceRequired(obj.DeepSliceMap, AssertAnObjectConstraints); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user