V2
This commit is contained in:
49
backend/dashapi/model_tracking_entry.go
Normal file
49
backend/dashapi/model_tracking_entry.go
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Dash API
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 0.1
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package dashapi
|
||||
|
||||
type TrackingEntry struct {
|
||||
|
||||
Date string `json:"date"`
|
||||
|
||||
Items []TrackingItem `json:"items"`
|
||||
}
|
||||
|
||||
// AssertTrackingEntryRequired checks if the required fields are not zero-ed
|
||||
func AssertTrackingEntryRequired(obj TrackingEntry) error {
|
||||
elements := map[string]interface{}{
|
||||
"date": obj.Date,
|
||||
"items": obj.Items,
|
||||
}
|
||||
for name, el := range elements {
|
||||
if isZero := IsZeroValue(el); isZero {
|
||||
return &RequiredError{Field: name}
|
||||
}
|
||||
}
|
||||
|
||||
for _, el := range obj.Items {
|
||||
if err := AssertTrackingItemRequired(el); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssertRecurseTrackingEntryRequired recursively checks if required fields are not zero-ed in a nested slice.
|
||||
// Accepts only nested slice of TrackingEntry (e.g. [][]TrackingEntry), otherwise ErrTypeAssertionError is thrown.
|
||||
func AssertRecurseTrackingEntryRequired(objSlice interface{}) error {
|
||||
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
|
||||
aTrackingEntry, ok := obj.(TrackingEntry)
|
||||
if !ok {
|
||||
return ErrTypeAssertionError
|
||||
}
|
||||
return AssertTrackingEntryRequired(aTrackingEntry)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user