/
model_http_request.go
49 lines (40 loc) 路 1.29 KB
/
model_http_request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
* TraceTest
*
* OpenAPI definition for TraceTest endpoint and resources
*
* API version: 0.2.1
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
type HttpRequest struct {
Url string `json:"url,omitempty"`
Method string `json:"method,omitempty"`
Headers []HttpHeader `json:"headers,omitempty"`
Body string `json:"body,omitempty"`
Auth HttpAuth `json:"auth,omitempty"`
SslVerification bool `json:"sslVerification,omitempty"`
}
// AssertHttpRequestRequired checks if the required fields are not zero-ed
func AssertHttpRequestRequired(obj HttpRequest) error {
for _, el := range obj.Headers {
if err := AssertHttpHeaderRequired(el); err != nil {
return err
}
}
if err := AssertHttpAuthRequired(obj.Auth); err != nil {
return err
}
return nil
}
// AssertRecurseHttpRequestRequired recursively checks if required fields are not zero-ed in a nested slice.
// Accepts only nested slice of HttpRequest (e.g. [][]HttpRequest), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseHttpRequestRequired(objSlice interface{}) error {
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
aHttpRequest, ok := obj.(HttpRequest)
if !ok {
return ErrTypeAssertionError
}
return AssertHttpRequestRequired(aHttpRequest)
})
}