", context))
- if err != nil {
- return nil, err
- }
- x.Schema = append(x.Schema, y)
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewJsonReference creates an object of type JsonReference if possible, returning an error if not.
-func NewJsonReference(in interface{}, context *compiler.Context) (*JsonReference, error) {
- errors := make([]error, 0)
- x := &JsonReference{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"$ref"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"$ref", "description"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string _ref = 1;
- v1 := compiler.MapValueForKey(m, "$ref")
- if v1 != nil {
- x.XRef, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for $ref: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 2;
- v2 := compiler.MapValueForKey(m, "description")
- if v2 != nil {
- x.Description, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewLicense creates an object of type License if possible, returning an error if not.
-func NewLicense(in interface{}, context *compiler.Context) (*License, error) {
- errors := make([]error, 0)
- x := &License{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"name"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"name", "url"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string url = 2;
- v2 := compiler.MapValueForKey(m, "url")
- if v2 != nil {
- x.Url, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for url: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 3;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedAny creates an object of type NamedAny if possible, returning an error if not.
-func NewNamedAny(in interface{}, context *compiler.Context) (*NamedAny, error) {
- errors := make([]error, 0)
- x := &NamedAny{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Any value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewAny(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedHeader creates an object of type NamedHeader if possible, returning an error if not.
-func NewNamedHeader(in interface{}, context *compiler.Context) (*NamedHeader, error) {
- errors := make([]error, 0)
- x := &NamedHeader{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Header value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewHeader(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedParameter creates an object of type NamedParameter if possible, returning an error if not.
-func NewNamedParameter(in interface{}, context *compiler.Context) (*NamedParameter, error) {
- errors := make([]error, 0)
- x := &NamedParameter{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Parameter value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewParameter(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedPathItem creates an object of type NamedPathItem if possible, returning an error if not.
-func NewNamedPathItem(in interface{}, context *compiler.Context) (*NamedPathItem, error) {
- errors := make([]error, 0)
- x := &NamedPathItem{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // PathItem value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewPathItem(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedResponse creates an object of type NamedResponse if possible, returning an error if not.
-func NewNamedResponse(in interface{}, context *compiler.Context) (*NamedResponse, error) {
- errors := make([]error, 0)
- x := &NamedResponse{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Response value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewResponse(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedResponseValue creates an object of type NamedResponseValue if possible, returning an error if not.
-func NewNamedResponseValue(in interface{}, context *compiler.Context) (*NamedResponseValue, error) {
- errors := make([]error, 0)
- x := &NamedResponseValue{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // ResponseValue value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewResponseValue(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedSchema creates an object of type NamedSchema if possible, returning an error if not.
-func NewNamedSchema(in interface{}, context *compiler.Context) (*NamedSchema, error) {
- errors := make([]error, 0)
- x := &NamedSchema{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Schema value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewSchema(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedSecurityDefinitionsItem creates an object of type NamedSecurityDefinitionsItem if possible, returning an error if not.
-func NewNamedSecurityDefinitionsItem(in interface{}, context *compiler.Context) (*NamedSecurityDefinitionsItem, error) {
- errors := make([]error, 0)
- x := &NamedSecurityDefinitionsItem{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // SecurityDefinitionsItem value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewSecurityDefinitionsItem(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedString creates an object of type NamedString if possible, returning an error if not.
-func NewNamedString(in interface{}, context *compiler.Context) (*NamedString, error) {
- errors := make([]error, 0)
- x := &NamedString{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- x.Value, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for value: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNamedStringArray creates an object of type NamedStringArray if possible, returning an error if not.
-func NewNamedStringArray(in interface{}, context *compiler.Context) (*NamedStringArray, error) {
- errors := make([]error, 0)
- x := &NamedStringArray{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"name", "value"}
- var allowedPatterns []*regexp.Regexp
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // StringArray value = 2;
- v2 := compiler.MapValueForKey(m, "value")
- if v2 != nil {
- var err error
- x.Value, err = NewStringArray(v2, compiler.NewContext("value", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewNonBodyParameter creates an object of type NonBodyParameter if possible, returning an error if not.
-func NewNonBodyParameter(in interface{}, context *compiler.Context) (*NonBodyParameter, error) {
- errors := make([]error, 0)
- x := &NonBodyParameter{}
- matched := false
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"in", "name", "type"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // HeaderParameterSubSchema header_parameter_sub_schema = 1;
- {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewHeaderParameterSubSchema(m, compiler.NewContext("headerParameterSubSchema", context))
- if matchingError == nil {
- x.Oneof = &NonBodyParameter_HeaderParameterSubSchema{HeaderParameterSubSchema: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- // FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
- {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewFormDataParameterSubSchema(m, compiler.NewContext("formDataParameterSubSchema", context))
- if matchingError == nil {
- x.Oneof = &NonBodyParameter_FormDataParameterSubSchema{FormDataParameterSubSchema: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- // QueryParameterSubSchema query_parameter_sub_schema = 3;
- {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewQueryParameterSubSchema(m, compiler.NewContext("queryParameterSubSchema", context))
- if matchingError == nil {
- x.Oneof = &NonBodyParameter_QueryParameterSubSchema{QueryParameterSubSchema: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- // PathParameterSubSchema path_parameter_sub_schema = 4;
- {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewPathParameterSubSchema(m, compiler.NewContext("pathParameterSubSchema", context))
- if matchingError == nil {
- x.Oneof = &NonBodyParameter_PathParameterSubSchema{PathParameterSubSchema: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- if matched {
- // since the oneof matched one of its possibilities, discard any matching errors
- errors = make([]error, 0)
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewOauth2AccessCodeSecurity creates an object of type Oauth2AccessCodeSecurity if possible, returning an error if not.
-func NewOauth2AccessCodeSecurity(in interface{}, context *compiler.Context) (*Oauth2AccessCodeSecurity, error) {
- errors := make([]error, 0)
- x := &Oauth2AccessCodeSecurity{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"authorizationUrl", "flow", "tokenUrl", "type"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "tokenUrl", "type"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string type = 1;
- v1 := compiler.MapValueForKey(m, "type")
- if v1 != nil {
- x.Type, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [oauth2]
- if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string flow = 2;
- v2 := compiler.MapValueForKey(m, "flow")
- if v2 != nil {
- x.Flow, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for flow: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [accessCode]
- if ok && !compiler.StringArrayContainsValue([]string{"accessCode"}, x.Flow) {
- message := fmt.Sprintf("has unexpected value for flow: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Oauth2Scopes scopes = 3;
- v3 := compiler.MapValueForKey(m, "scopes")
- if v3 != nil {
- var err error
- x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string authorization_url = 4;
- v4 := compiler.MapValueForKey(m, "authorizationUrl")
- if v4 != nil {
- x.AuthorizationUrl, ok = v4.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for authorizationUrl: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string token_url = 5;
- v5 := compiler.MapValueForKey(m, "tokenUrl")
- if v5 != nil {
- x.TokenUrl, ok = v5.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for tokenUrl: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 6;
- v6 := compiler.MapValueForKey(m, "description")
- if v6 != nil {
- x.Description, ok = v6.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v6, v6)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 7;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewOauth2ApplicationSecurity creates an object of type Oauth2ApplicationSecurity if possible, returning an error if not.
-func NewOauth2ApplicationSecurity(in interface{}, context *compiler.Context) (*Oauth2ApplicationSecurity, error) {
- errors := make([]error, 0)
- x := &Oauth2ApplicationSecurity{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"flow", "tokenUrl", "type"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string type = 1;
- v1 := compiler.MapValueForKey(m, "type")
- if v1 != nil {
- x.Type, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [oauth2]
- if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string flow = 2;
- v2 := compiler.MapValueForKey(m, "flow")
- if v2 != nil {
- x.Flow, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for flow: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [application]
- if ok && !compiler.StringArrayContainsValue([]string{"application"}, x.Flow) {
- message := fmt.Sprintf("has unexpected value for flow: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Oauth2Scopes scopes = 3;
- v3 := compiler.MapValueForKey(m, "scopes")
- if v3 != nil {
- var err error
- x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string token_url = 4;
- v4 := compiler.MapValueForKey(m, "tokenUrl")
- if v4 != nil {
- x.TokenUrl, ok = v4.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for tokenUrl: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 5;
- v5 := compiler.MapValueForKey(m, "description")
- if v5 != nil {
- x.Description, ok = v5.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 6;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewOauth2ImplicitSecurity creates an object of type Oauth2ImplicitSecurity if possible, returning an error if not.
-func NewOauth2ImplicitSecurity(in interface{}, context *compiler.Context) (*Oauth2ImplicitSecurity, error) {
- errors := make([]error, 0)
- x := &Oauth2ImplicitSecurity{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"authorizationUrl", "flow", "type"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"authorizationUrl", "description", "flow", "scopes", "type"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string type = 1;
- v1 := compiler.MapValueForKey(m, "type")
- if v1 != nil {
- x.Type, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [oauth2]
- if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string flow = 2;
- v2 := compiler.MapValueForKey(m, "flow")
- if v2 != nil {
- x.Flow, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for flow: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [implicit]
- if ok && !compiler.StringArrayContainsValue([]string{"implicit"}, x.Flow) {
- message := fmt.Sprintf("has unexpected value for flow: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Oauth2Scopes scopes = 3;
- v3 := compiler.MapValueForKey(m, "scopes")
- if v3 != nil {
- var err error
- x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string authorization_url = 4;
- v4 := compiler.MapValueForKey(m, "authorizationUrl")
- if v4 != nil {
- x.AuthorizationUrl, ok = v4.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for authorizationUrl: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 5;
- v5 := compiler.MapValueForKey(m, "description")
- if v5 != nil {
- x.Description, ok = v5.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 6;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewOauth2PasswordSecurity creates an object of type Oauth2PasswordSecurity if possible, returning an error if not.
-func NewOauth2PasswordSecurity(in interface{}, context *compiler.Context) (*Oauth2PasswordSecurity, error) {
- errors := make([]error, 0)
- x := &Oauth2PasswordSecurity{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"flow", "tokenUrl", "type"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"description", "flow", "scopes", "tokenUrl", "type"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string type = 1;
- v1 := compiler.MapValueForKey(m, "type")
- if v1 != nil {
- x.Type, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [oauth2]
- if ok && !compiler.StringArrayContainsValue([]string{"oauth2"}, x.Type) {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string flow = 2;
- v2 := compiler.MapValueForKey(m, "flow")
- if v2 != nil {
- x.Flow, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for flow: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [password]
- if ok && !compiler.StringArrayContainsValue([]string{"password"}, x.Flow) {
- message := fmt.Sprintf("has unexpected value for flow: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Oauth2Scopes scopes = 3;
- v3 := compiler.MapValueForKey(m, "scopes")
- if v3 != nil {
- var err error
- x.Scopes, err = NewOauth2Scopes(v3, compiler.NewContext("scopes", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string token_url = 4;
- v4 := compiler.MapValueForKey(m, "tokenUrl")
- if v4 != nil {
- x.TokenUrl, ok = v4.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for tokenUrl: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 5;
- v5 := compiler.MapValueForKey(m, "description")
- if v5 != nil {
- x.Description, ok = v5.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 6;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewOauth2Scopes creates an object of type Oauth2Scopes if possible, returning an error if not.
-func NewOauth2Scopes(in interface{}, context *compiler.Context) (*Oauth2Scopes, error) {
- errors := make([]error, 0)
- x := &Oauth2Scopes{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- // repeated NamedString additional_properties = 1;
- // MAP: string
- x.AdditionalProperties = make([]*NamedString, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- pair := &NamedString{}
- pair.Name = k
- pair.Value = v.(string)
- x.AdditionalProperties = append(x.AdditionalProperties, pair)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewOperation creates an object of type Operation if possible, returning an error if not.
-func NewOperation(in interface{}, context *compiler.Context) (*Operation, error) {
- errors := make([]error, 0)
- x := &Operation{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"responses"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"consumes", "deprecated", "description", "externalDocs", "operationId", "parameters", "produces", "responses", "schemes", "security", "summary", "tags"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // repeated string tags = 1;
- v1 := compiler.MapValueForKey(m, "tags")
- if v1 != nil {
- v, ok := v1.([]interface{})
- if ok {
- x.Tags = compiler.ConvertInterfaceArrayToStringArray(v)
- } else {
- message := fmt.Sprintf("has unexpected value for tags: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string summary = 2;
- v2 := compiler.MapValueForKey(m, "summary")
- if v2 != nil {
- x.Summary, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for summary: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 3;
- v3 := compiler.MapValueForKey(m, "description")
- if v3 != nil {
- x.Description, ok = v3.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v3, v3)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // ExternalDocs external_docs = 4;
- v4 := compiler.MapValueForKey(m, "externalDocs")
- if v4 != nil {
- var err error
- x.ExternalDocs, err = NewExternalDocs(v4, compiler.NewContext("externalDocs", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string operation_id = 5;
- v5 := compiler.MapValueForKey(m, "operationId")
- if v5 != nil {
- x.OperationId, ok = v5.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for operationId: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated string produces = 6;
- v6 := compiler.MapValueForKey(m, "produces")
- if v6 != nil {
- v, ok := v6.([]interface{})
- if ok {
- x.Produces = compiler.ConvertInterfaceArrayToStringArray(v)
- } else {
- message := fmt.Sprintf("has unexpected value for produces: %+v (%T)", v6, v6)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated string consumes = 7;
- v7 := compiler.MapValueForKey(m, "consumes")
- if v7 != nil {
- v, ok := v7.([]interface{})
- if ok {
- x.Consumes = compiler.ConvertInterfaceArrayToStringArray(v)
- } else {
- message := fmt.Sprintf("has unexpected value for consumes: %+v (%T)", v7, v7)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated ParametersItem parameters = 8;
- v8 := compiler.MapValueForKey(m, "parameters")
- if v8 != nil {
- // repeated ParametersItem
- x.Parameters = make([]*ParametersItem, 0)
- a, ok := v8.([]interface{})
- if ok {
- for _, item := range a {
- y, err := NewParametersItem(item, compiler.NewContext("parameters", context))
- if err != nil {
- errors = append(errors, err)
- }
- x.Parameters = append(x.Parameters, y)
- }
- }
- }
- // Responses responses = 9;
- v9 := compiler.MapValueForKey(m, "responses")
- if v9 != nil {
- var err error
- x.Responses, err = NewResponses(v9, compiler.NewContext("responses", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // repeated string schemes = 10;
- v10 := compiler.MapValueForKey(m, "schemes")
- if v10 != nil {
- v, ok := v10.([]interface{})
- if ok {
- x.Schemes = compiler.ConvertInterfaceArrayToStringArray(v)
- } else {
- message := fmt.Sprintf("has unexpected value for schemes: %+v (%T)", v10, v10)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [http https ws wss]
- if ok && !compiler.StringArrayContainsValues([]string{"http", "https", "ws", "wss"}, x.Schemes) {
- message := fmt.Sprintf("has unexpected value for schemes: %+v", v10)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool deprecated = 11;
- v11 := compiler.MapValueForKey(m, "deprecated")
- if v11 != nil {
- x.Deprecated, ok = v11.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for deprecated: %+v (%T)", v11, v11)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated SecurityRequirement security = 12;
- v12 := compiler.MapValueForKey(m, "security")
- if v12 != nil {
- // repeated SecurityRequirement
- x.Security = make([]*SecurityRequirement, 0)
- a, ok := v12.([]interface{})
- if ok {
- for _, item := range a {
- y, err := NewSecurityRequirement(item, compiler.NewContext("security", context))
- if err != nil {
- errors = append(errors, err)
- }
- x.Security = append(x.Security, y)
- }
- }
- }
- // repeated NamedAny vendor_extension = 13;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewParameter creates an object of type Parameter if possible, returning an error if not.
-func NewParameter(in interface{}, context *compiler.Context) (*Parameter, error) {
- errors := make([]error, 0)
- x := &Parameter{}
- matched := false
- // BodyParameter body_parameter = 1;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewBodyParameter(m, compiler.NewContext("bodyParameter", context))
- if matchingError == nil {
- x.Oneof = &Parameter_BodyParameter{BodyParameter: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // NonBodyParameter non_body_parameter = 2;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewNonBodyParameter(m, compiler.NewContext("nonBodyParameter", context))
- if matchingError == nil {
- x.Oneof = &Parameter_NonBodyParameter{NonBodyParameter: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- if matched {
- // since the oneof matched one of its possibilities, discard any matching errors
- errors = make([]error, 0)
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewParameterDefinitions creates an object of type ParameterDefinitions if possible, returning an error if not.
-func NewParameterDefinitions(in interface{}, context *compiler.Context) (*ParameterDefinitions, error) {
- errors := make([]error, 0)
- x := &ParameterDefinitions{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- // repeated NamedParameter additional_properties = 1;
- // MAP: Parameter
- x.AdditionalProperties = make([]*NamedParameter, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- pair := &NamedParameter{}
- pair.Name = k
- var err error
- pair.Value, err = NewParameter(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- x.AdditionalProperties = append(x.AdditionalProperties, pair)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewParametersItem creates an object of type ParametersItem if possible, returning an error if not.
-func NewParametersItem(in interface{}, context *compiler.Context) (*ParametersItem, error) {
- errors := make([]error, 0)
- x := &ParametersItem{}
- matched := false
- // Parameter parameter = 1;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewParameter(m, compiler.NewContext("parameter", context))
- if matchingError == nil {
- x.Oneof = &ParametersItem_Parameter{Parameter: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // JsonReference json_reference = 2;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", context))
- if matchingError == nil {
- x.Oneof = &ParametersItem_JsonReference{JsonReference: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- if matched {
- // since the oneof matched one of its possibilities, discard any matching errors
- errors = make([]error, 0)
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewPathItem creates an object of type PathItem if possible, returning an error if not.
-func NewPathItem(in interface{}, context *compiler.Context) (*PathItem, error) {
- errors := make([]error, 0)
- x := &PathItem{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"$ref", "delete", "get", "head", "options", "parameters", "patch", "post", "put"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string _ref = 1;
- v1 := compiler.MapValueForKey(m, "$ref")
- if v1 != nil {
- x.XRef, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for $ref: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Operation get = 2;
- v2 := compiler.MapValueForKey(m, "get")
- if v2 != nil {
- var err error
- x.Get, err = NewOperation(v2, compiler.NewContext("get", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Operation put = 3;
- v3 := compiler.MapValueForKey(m, "put")
- if v3 != nil {
- var err error
- x.Put, err = NewOperation(v3, compiler.NewContext("put", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Operation post = 4;
- v4 := compiler.MapValueForKey(m, "post")
- if v4 != nil {
- var err error
- x.Post, err = NewOperation(v4, compiler.NewContext("post", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Operation delete = 5;
- v5 := compiler.MapValueForKey(m, "delete")
- if v5 != nil {
- var err error
- x.Delete, err = NewOperation(v5, compiler.NewContext("delete", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Operation options = 6;
- v6 := compiler.MapValueForKey(m, "options")
- if v6 != nil {
- var err error
- x.Options, err = NewOperation(v6, compiler.NewContext("options", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Operation head = 7;
- v7 := compiler.MapValueForKey(m, "head")
- if v7 != nil {
- var err error
- x.Head, err = NewOperation(v7, compiler.NewContext("head", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Operation patch = 8;
- v8 := compiler.MapValueForKey(m, "patch")
- if v8 != nil {
- var err error
- x.Patch, err = NewOperation(v8, compiler.NewContext("patch", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // repeated ParametersItem parameters = 9;
- v9 := compiler.MapValueForKey(m, "parameters")
- if v9 != nil {
- // repeated ParametersItem
- x.Parameters = make([]*ParametersItem, 0)
- a, ok := v9.([]interface{})
- if ok {
- for _, item := range a {
- y, err := NewParametersItem(item, compiler.NewContext("parameters", context))
- if err != nil {
- errors = append(errors, err)
- }
- x.Parameters = append(x.Parameters, y)
- }
- }
- }
- // repeated NamedAny vendor_extension = 10;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewPathParameterSubSchema creates an object of type PathParameterSubSchema if possible, returning an error if not.
-func NewPathParameterSubSchema(in interface{}, context *compiler.Context) (*PathParameterSubSchema, error) {
- errors := make([]error, 0)
- x := &PathParameterSubSchema{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"required"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // bool required = 1;
- v1 := compiler.MapValueForKey(m, "required")
- if v1 != nil {
- x.Required, ok = v1.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for required: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string in = 2;
- v2 := compiler.MapValueForKey(m, "in")
- if v2 != nil {
- x.In, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for in: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [path]
- if ok && !compiler.StringArrayContainsValue([]string{"path"}, x.In) {
- message := fmt.Sprintf("has unexpected value for in: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 3;
- v3 := compiler.MapValueForKey(m, "description")
- if v3 != nil {
- x.Description, ok = v3.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v3, v3)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string name = 4;
- v4 := compiler.MapValueForKey(m, "name")
- if v4 != nil {
- x.Name, ok = v4.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string type = 5;
- v5 := compiler.MapValueForKey(m, "type")
- if v5 != nil {
- x.Type, ok = v5.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [string number boolean integer array]
- if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string format = 6;
- v6 := compiler.MapValueForKey(m, "format")
- if v6 != nil {
- x.Format, ok = v6.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for format: %+v (%T)", v6, v6)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // PrimitivesItems items = 7;
- v7 := compiler.MapValueForKey(m, "items")
- if v7 != nil {
- var err error
- x.Items, err = NewPrimitivesItems(v7, compiler.NewContext("items", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string collection_format = 8;
- v8 := compiler.MapValueForKey(m, "collectionFormat")
- if v8 != nil {
- x.CollectionFormat, ok = v8.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for collectionFormat: %+v (%T)", v8, v8)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [csv ssv tsv pipes]
- if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
- message := fmt.Sprintf("has unexpected value for collectionFormat: %+v (%T)", v8, v8)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Any default = 9;
- v9 := compiler.MapValueForKey(m, "default")
- if v9 != nil {
- var err error
- x.Default, err = NewAny(v9, compiler.NewContext("default", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // float maximum = 10;
- v10 := compiler.MapValueForKey(m, "maximum")
- if v10 != nil {
- switch v10 := v10.(type) {
- case float64:
- x.Maximum = v10
- case float32:
- x.Maximum = float64(v10)
- case uint64:
- x.Maximum = float64(v10)
- case uint32:
- x.Maximum = float64(v10)
- case int64:
- x.Maximum = float64(v10)
- case int32:
- x.Maximum = float64(v10)
- case int:
- x.Maximum = float64(v10)
- default:
- message := fmt.Sprintf("has unexpected value for maximum: %+v (%T)", v10, v10)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool exclusive_maximum = 11;
- v11 := compiler.MapValueForKey(m, "exclusiveMaximum")
- if v11 != nil {
- x.ExclusiveMaximum, ok = v11.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %+v (%T)", v11, v11)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // float minimum = 12;
- v12 := compiler.MapValueForKey(m, "minimum")
- if v12 != nil {
- switch v12 := v12.(type) {
- case float64:
- x.Minimum = v12
- case float32:
- x.Minimum = float64(v12)
- case uint64:
- x.Minimum = float64(v12)
- case uint32:
- x.Minimum = float64(v12)
- case int64:
- x.Minimum = float64(v12)
- case int32:
- x.Minimum = float64(v12)
- case int:
- x.Minimum = float64(v12)
- default:
- message := fmt.Sprintf("has unexpected value for minimum: %+v (%T)", v12, v12)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool exclusive_minimum = 13;
- v13 := compiler.MapValueForKey(m, "exclusiveMinimum")
- if v13 != nil {
- x.ExclusiveMinimum, ok = v13.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %+v (%T)", v13, v13)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_length = 14;
- v14 := compiler.MapValueForKey(m, "maxLength")
- if v14 != nil {
- t, ok := v14.(int)
- if ok {
- x.MaxLength = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxLength: %+v (%T)", v14, v14)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_length = 15;
- v15 := compiler.MapValueForKey(m, "minLength")
- if v15 != nil {
- t, ok := v15.(int)
- if ok {
- x.MinLength = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minLength: %+v (%T)", v15, v15)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string pattern = 16;
- v16 := compiler.MapValueForKey(m, "pattern")
- if v16 != nil {
- x.Pattern, ok = v16.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for pattern: %+v (%T)", v16, v16)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_items = 17;
- v17 := compiler.MapValueForKey(m, "maxItems")
- if v17 != nil {
- t, ok := v17.(int)
- if ok {
- x.MaxItems = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxItems: %+v (%T)", v17, v17)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_items = 18;
- v18 := compiler.MapValueForKey(m, "minItems")
- if v18 != nil {
- t, ok := v18.(int)
- if ok {
- x.MinItems = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minItems: %+v (%T)", v18, v18)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool unique_items = 19;
- v19 := compiler.MapValueForKey(m, "uniqueItems")
- if v19 != nil {
- x.UniqueItems, ok = v19.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for uniqueItems: %+v (%T)", v19, v19)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated Any enum = 20;
- v20 := compiler.MapValueForKey(m, "enum")
- if v20 != nil {
- // repeated Any
- x.Enum = make([]*Any, 0)
- a, ok := v20.([]interface{})
- if ok {
- for _, item := range a {
- y, err := NewAny(item, compiler.NewContext("enum", context))
- if err != nil {
- errors = append(errors, err)
- }
- x.Enum = append(x.Enum, y)
- }
- }
- }
- // float multiple_of = 21;
- v21 := compiler.MapValueForKey(m, "multipleOf")
- if v21 != nil {
- switch v21 := v21.(type) {
- case float64:
- x.MultipleOf = v21
- case float32:
- x.MultipleOf = float64(v21)
- case uint64:
- x.MultipleOf = float64(v21)
- case uint32:
- x.MultipleOf = float64(v21)
- case int64:
- x.MultipleOf = float64(v21)
- case int32:
- x.MultipleOf = float64(v21)
- case int:
- x.MultipleOf = float64(v21)
- default:
- message := fmt.Sprintf("has unexpected value for multipleOf: %+v (%T)", v21, v21)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 22;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewPaths creates an object of type Paths if possible, returning an error if not.
-func NewPaths(in interface{}, context *compiler.Context) (*Paths, error) {
- errors := make([]error, 0)
- x := &Paths{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{}
- allowedPatterns := []*regexp.Regexp{pattern0, pattern1}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // repeated NamedAny vendor_extension = 1;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- // repeated NamedPathItem path = 2;
- // MAP: PathItem ^/
- x.Path = make([]*NamedPathItem, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "/") {
- pair := &NamedPathItem{}
- pair.Name = k
- var err error
- pair.Value, err = NewPathItem(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- x.Path = append(x.Path, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewPrimitivesItems creates an object of type PrimitivesItems if possible, returning an error if not.
-func NewPrimitivesItems(in interface{}, context *compiler.Context) (*PrimitivesItems, error) {
- errors := make([]error, 0)
- x := &PrimitivesItems{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"collectionFormat", "default", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "pattern", "type", "uniqueItems"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string type = 1;
- v1 := compiler.MapValueForKey(m, "type")
- if v1 != nil {
- x.Type, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [string number integer boolean array]
- if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "integer", "boolean", "array"}, x.Type) {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string format = 2;
- v2 := compiler.MapValueForKey(m, "format")
- if v2 != nil {
- x.Format, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for format: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // PrimitivesItems items = 3;
- v3 := compiler.MapValueForKey(m, "items")
- if v3 != nil {
- var err error
- x.Items, err = NewPrimitivesItems(v3, compiler.NewContext("items", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string collection_format = 4;
- v4 := compiler.MapValueForKey(m, "collectionFormat")
- if v4 != nil {
- x.CollectionFormat, ok = v4.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for collectionFormat: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [csv ssv tsv pipes]
- if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes"}, x.CollectionFormat) {
- message := fmt.Sprintf("has unexpected value for collectionFormat: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Any default = 5;
- v5 := compiler.MapValueForKey(m, "default")
- if v5 != nil {
- var err error
- x.Default, err = NewAny(v5, compiler.NewContext("default", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // float maximum = 6;
- v6 := compiler.MapValueForKey(m, "maximum")
- if v6 != nil {
- switch v6 := v6.(type) {
- case float64:
- x.Maximum = v6
- case float32:
- x.Maximum = float64(v6)
- case uint64:
- x.Maximum = float64(v6)
- case uint32:
- x.Maximum = float64(v6)
- case int64:
- x.Maximum = float64(v6)
- case int32:
- x.Maximum = float64(v6)
- case int:
- x.Maximum = float64(v6)
- default:
- message := fmt.Sprintf("has unexpected value for maximum: %+v (%T)", v6, v6)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool exclusive_maximum = 7;
- v7 := compiler.MapValueForKey(m, "exclusiveMaximum")
- if v7 != nil {
- x.ExclusiveMaximum, ok = v7.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %+v (%T)", v7, v7)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // float minimum = 8;
- v8 := compiler.MapValueForKey(m, "minimum")
- if v8 != nil {
- switch v8 := v8.(type) {
- case float64:
- x.Minimum = v8
- case float32:
- x.Minimum = float64(v8)
- case uint64:
- x.Minimum = float64(v8)
- case uint32:
- x.Minimum = float64(v8)
- case int64:
- x.Minimum = float64(v8)
- case int32:
- x.Minimum = float64(v8)
- case int:
- x.Minimum = float64(v8)
- default:
- message := fmt.Sprintf("has unexpected value for minimum: %+v (%T)", v8, v8)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool exclusive_minimum = 9;
- v9 := compiler.MapValueForKey(m, "exclusiveMinimum")
- if v9 != nil {
- x.ExclusiveMinimum, ok = v9.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %+v (%T)", v9, v9)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_length = 10;
- v10 := compiler.MapValueForKey(m, "maxLength")
- if v10 != nil {
- t, ok := v10.(int)
- if ok {
- x.MaxLength = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxLength: %+v (%T)", v10, v10)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_length = 11;
- v11 := compiler.MapValueForKey(m, "minLength")
- if v11 != nil {
- t, ok := v11.(int)
- if ok {
- x.MinLength = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minLength: %+v (%T)", v11, v11)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string pattern = 12;
- v12 := compiler.MapValueForKey(m, "pattern")
- if v12 != nil {
- x.Pattern, ok = v12.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for pattern: %+v (%T)", v12, v12)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_items = 13;
- v13 := compiler.MapValueForKey(m, "maxItems")
- if v13 != nil {
- t, ok := v13.(int)
- if ok {
- x.MaxItems = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxItems: %+v (%T)", v13, v13)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_items = 14;
- v14 := compiler.MapValueForKey(m, "minItems")
- if v14 != nil {
- t, ok := v14.(int)
- if ok {
- x.MinItems = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minItems: %+v (%T)", v14, v14)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool unique_items = 15;
- v15 := compiler.MapValueForKey(m, "uniqueItems")
- if v15 != nil {
- x.UniqueItems, ok = v15.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for uniqueItems: %+v (%T)", v15, v15)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated Any enum = 16;
- v16 := compiler.MapValueForKey(m, "enum")
- if v16 != nil {
- // repeated Any
- x.Enum = make([]*Any, 0)
- a, ok := v16.([]interface{})
- if ok {
- for _, item := range a {
- y, err := NewAny(item, compiler.NewContext("enum", context))
- if err != nil {
- errors = append(errors, err)
- }
- x.Enum = append(x.Enum, y)
- }
- }
- }
- // float multiple_of = 17;
- v17 := compiler.MapValueForKey(m, "multipleOf")
- if v17 != nil {
- switch v17 := v17.(type) {
- case float64:
- x.MultipleOf = v17
- case float32:
- x.MultipleOf = float64(v17)
- case uint64:
- x.MultipleOf = float64(v17)
- case uint32:
- x.MultipleOf = float64(v17)
- case int64:
- x.MultipleOf = float64(v17)
- case int32:
- x.MultipleOf = float64(v17)
- case int:
- x.MultipleOf = float64(v17)
- default:
- message := fmt.Sprintf("has unexpected value for multipleOf: %+v (%T)", v17, v17)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 18;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewProperties creates an object of type Properties if possible, returning an error if not.
-func NewProperties(in interface{}, context *compiler.Context) (*Properties, error) {
- errors := make([]error, 0)
- x := &Properties{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- // repeated NamedSchema additional_properties = 1;
- // MAP: Schema
- x.AdditionalProperties = make([]*NamedSchema, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- pair := &NamedSchema{}
- pair.Name = k
- var err error
- pair.Value, err = NewSchema(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- x.AdditionalProperties = append(x.AdditionalProperties, pair)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewQueryParameterSubSchema creates an object of type QueryParameterSubSchema if possible, returning an error if not.
-func NewQueryParameterSubSchema(in interface{}, context *compiler.Context) (*QueryParameterSubSchema, error) {
- errors := make([]error, 0)
- x := &QueryParameterSubSchema{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"allowEmptyValue", "collectionFormat", "default", "description", "enum", "exclusiveMaximum", "exclusiveMinimum", "format", "in", "items", "maxItems", "maxLength", "maximum", "minItems", "minLength", "minimum", "multipleOf", "name", "pattern", "required", "type", "uniqueItems"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // bool required = 1;
- v1 := compiler.MapValueForKey(m, "required")
- if v1 != nil {
- x.Required, ok = v1.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for required: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string in = 2;
- v2 := compiler.MapValueForKey(m, "in")
- if v2 != nil {
- x.In, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for in: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [query]
- if ok && !compiler.StringArrayContainsValue([]string{"query"}, x.In) {
- message := fmt.Sprintf("has unexpected value for in: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 3;
- v3 := compiler.MapValueForKey(m, "description")
- if v3 != nil {
- x.Description, ok = v3.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v3, v3)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string name = 4;
- v4 := compiler.MapValueForKey(m, "name")
- if v4 != nil {
- x.Name, ok = v4.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool allow_empty_value = 5;
- v5 := compiler.MapValueForKey(m, "allowEmptyValue")
- if v5 != nil {
- x.AllowEmptyValue, ok = v5.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for allowEmptyValue: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string type = 6;
- v6 := compiler.MapValueForKey(m, "type")
- if v6 != nil {
- x.Type, ok = v6.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v6, v6)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [string number boolean integer array]
- if ok && !compiler.StringArrayContainsValue([]string{"string", "number", "boolean", "integer", "array"}, x.Type) {
- message := fmt.Sprintf("has unexpected value for type: %+v (%T)", v6, v6)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string format = 7;
- v7 := compiler.MapValueForKey(m, "format")
- if v7 != nil {
- x.Format, ok = v7.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for format: %+v (%T)", v7, v7)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // PrimitivesItems items = 8;
- v8 := compiler.MapValueForKey(m, "items")
- if v8 != nil {
- var err error
- x.Items, err = NewPrimitivesItems(v8, compiler.NewContext("items", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string collection_format = 9;
- v9 := compiler.MapValueForKey(m, "collectionFormat")
- if v9 != nil {
- x.CollectionFormat, ok = v9.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for collectionFormat: %+v (%T)", v9, v9)
- errors = append(errors, compiler.NewError(context, message))
- }
- // check for valid enum values
- // [csv ssv tsv pipes multi]
- if ok && !compiler.StringArrayContainsValue([]string{"csv", "ssv", "tsv", "pipes", "multi"}, x.CollectionFormat) {
- message := fmt.Sprintf("has unexpected value for collectionFormat: %+v (%T)", v9, v9)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Any default = 10;
- v10 := compiler.MapValueForKey(m, "default")
- if v10 != nil {
- var err error
- x.Default, err = NewAny(v10, compiler.NewContext("default", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // float maximum = 11;
- v11 := compiler.MapValueForKey(m, "maximum")
- if v11 != nil {
- switch v11 := v11.(type) {
- case float64:
- x.Maximum = v11
- case float32:
- x.Maximum = float64(v11)
- case uint64:
- x.Maximum = float64(v11)
- case uint32:
- x.Maximum = float64(v11)
- case int64:
- x.Maximum = float64(v11)
- case int32:
- x.Maximum = float64(v11)
- case int:
- x.Maximum = float64(v11)
- default:
- message := fmt.Sprintf("has unexpected value for maximum: %+v (%T)", v11, v11)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool exclusive_maximum = 12;
- v12 := compiler.MapValueForKey(m, "exclusiveMaximum")
- if v12 != nil {
- x.ExclusiveMaximum, ok = v12.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %+v (%T)", v12, v12)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // float minimum = 13;
- v13 := compiler.MapValueForKey(m, "minimum")
- if v13 != nil {
- switch v13 := v13.(type) {
- case float64:
- x.Minimum = v13
- case float32:
- x.Minimum = float64(v13)
- case uint64:
- x.Minimum = float64(v13)
- case uint32:
- x.Minimum = float64(v13)
- case int64:
- x.Minimum = float64(v13)
- case int32:
- x.Minimum = float64(v13)
- case int:
- x.Minimum = float64(v13)
- default:
- message := fmt.Sprintf("has unexpected value for minimum: %+v (%T)", v13, v13)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool exclusive_minimum = 14;
- v14 := compiler.MapValueForKey(m, "exclusiveMinimum")
- if v14 != nil {
- x.ExclusiveMinimum, ok = v14.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %+v (%T)", v14, v14)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_length = 15;
- v15 := compiler.MapValueForKey(m, "maxLength")
- if v15 != nil {
- t, ok := v15.(int)
- if ok {
- x.MaxLength = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxLength: %+v (%T)", v15, v15)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_length = 16;
- v16 := compiler.MapValueForKey(m, "minLength")
- if v16 != nil {
- t, ok := v16.(int)
- if ok {
- x.MinLength = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minLength: %+v (%T)", v16, v16)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string pattern = 17;
- v17 := compiler.MapValueForKey(m, "pattern")
- if v17 != nil {
- x.Pattern, ok = v17.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for pattern: %+v (%T)", v17, v17)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_items = 18;
- v18 := compiler.MapValueForKey(m, "maxItems")
- if v18 != nil {
- t, ok := v18.(int)
- if ok {
- x.MaxItems = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxItems: %+v (%T)", v18, v18)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_items = 19;
- v19 := compiler.MapValueForKey(m, "minItems")
- if v19 != nil {
- t, ok := v19.(int)
- if ok {
- x.MinItems = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minItems: %+v (%T)", v19, v19)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool unique_items = 20;
- v20 := compiler.MapValueForKey(m, "uniqueItems")
- if v20 != nil {
- x.UniqueItems, ok = v20.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for uniqueItems: %+v (%T)", v20, v20)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated Any enum = 21;
- v21 := compiler.MapValueForKey(m, "enum")
- if v21 != nil {
- // repeated Any
- x.Enum = make([]*Any, 0)
- a, ok := v21.([]interface{})
- if ok {
- for _, item := range a {
- y, err := NewAny(item, compiler.NewContext("enum", context))
- if err != nil {
- errors = append(errors, err)
- }
- x.Enum = append(x.Enum, y)
- }
- }
- }
- // float multiple_of = 22;
- v22 := compiler.MapValueForKey(m, "multipleOf")
- if v22 != nil {
- switch v22 := v22.(type) {
- case float64:
- x.MultipleOf = v22
- case float32:
- x.MultipleOf = float64(v22)
- case uint64:
- x.MultipleOf = float64(v22)
- case uint32:
- x.MultipleOf = float64(v22)
- case int64:
- x.MultipleOf = float64(v22)
- case int32:
- x.MultipleOf = float64(v22)
- case int:
- x.MultipleOf = float64(v22)
- default:
- message := fmt.Sprintf("has unexpected value for multipleOf: %+v (%T)", v22, v22)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 23;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewResponse creates an object of type Response if possible, returning an error if not.
-func NewResponse(in interface{}, context *compiler.Context) (*Response, error) {
- errors := make([]error, 0)
- x := &Response{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"description"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"description", "examples", "headers", "schema"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string description = 1;
- v1 := compiler.MapValueForKey(m, "description")
- if v1 != nil {
- x.Description, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // SchemaItem schema = 2;
- v2 := compiler.MapValueForKey(m, "schema")
- if v2 != nil {
- var err error
- x.Schema, err = NewSchemaItem(v2, compiler.NewContext("schema", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Headers headers = 3;
- v3 := compiler.MapValueForKey(m, "headers")
- if v3 != nil {
- var err error
- x.Headers, err = NewHeaders(v3, compiler.NewContext("headers", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Examples examples = 4;
- v4 := compiler.MapValueForKey(m, "examples")
- if v4 != nil {
- var err error
- x.Examples, err = NewExamples(v4, compiler.NewContext("examples", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // repeated NamedAny vendor_extension = 5;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewResponseDefinitions creates an object of type ResponseDefinitions if possible, returning an error if not.
-func NewResponseDefinitions(in interface{}, context *compiler.Context) (*ResponseDefinitions, error) {
- errors := make([]error, 0)
- x := &ResponseDefinitions{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- // repeated NamedResponse additional_properties = 1;
- // MAP: Response
- x.AdditionalProperties = make([]*NamedResponse, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- pair := &NamedResponse{}
- pair.Name = k
- var err error
- pair.Value, err = NewResponse(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- x.AdditionalProperties = append(x.AdditionalProperties, pair)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewResponseValue creates an object of type ResponseValue if possible, returning an error if not.
-func NewResponseValue(in interface{}, context *compiler.Context) (*ResponseValue, error) {
- errors := make([]error, 0)
- x := &ResponseValue{}
- matched := false
- // Response response = 1;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewResponse(m, compiler.NewContext("response", context))
- if matchingError == nil {
- x.Oneof = &ResponseValue_Response{Response: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // JsonReference json_reference = 2;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewJsonReference(m, compiler.NewContext("jsonReference", context))
- if matchingError == nil {
- x.Oneof = &ResponseValue_JsonReference{JsonReference: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- if matched {
- // since the oneof matched one of its possibilities, discard any matching errors
- errors = make([]error, 0)
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewResponses creates an object of type Responses if possible, returning an error if not.
-func NewResponses(in interface{}, context *compiler.Context) (*Responses, error) {
- errors := make([]error, 0)
- x := &Responses{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{}
- allowedPatterns := []*regexp.Regexp{pattern2, pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // repeated NamedResponseValue response_code = 1;
- // MAP: ResponseValue ^([0-9]{3})$|^(default)$
- x.ResponseCode = make([]*NamedResponseValue, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if pattern2.MatchString(k) {
- pair := &NamedResponseValue{}
- pair.Name = k
- var err error
- pair.Value, err = NewResponseValue(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- x.ResponseCode = append(x.ResponseCode, pair)
- }
- }
- }
- // repeated NamedAny vendor_extension = 2;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewSchema creates an object of type Schema if possible, returning an error if not.
-func NewSchema(in interface{}, context *compiler.Context) (*Schema, error) {
- errors := make([]error, 0)
- x := &Schema{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"$ref", "additionalProperties", "allOf", "default", "description", "discriminator", "enum", "example", "exclusiveMaximum", "exclusiveMinimum", "externalDocs", "format", "items", "maxItems", "maxLength", "maxProperties", "maximum", "minItems", "minLength", "minProperties", "minimum", "multipleOf", "pattern", "properties", "readOnly", "required", "title", "type", "uniqueItems", "xml"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string _ref = 1;
- v1 := compiler.MapValueForKey(m, "$ref")
- if v1 != nil {
- x.XRef, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for $ref: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string format = 2;
- v2 := compiler.MapValueForKey(m, "format")
- if v2 != nil {
- x.Format, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for format: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string title = 3;
- v3 := compiler.MapValueForKey(m, "title")
- if v3 != nil {
- x.Title, ok = v3.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for title: %+v (%T)", v3, v3)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 4;
- v4 := compiler.MapValueForKey(m, "description")
- if v4 != nil {
- x.Description, ok = v4.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Any default = 5;
- v5 := compiler.MapValueForKey(m, "default")
- if v5 != nil {
- var err error
- x.Default, err = NewAny(v5, compiler.NewContext("default", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // float multiple_of = 6;
- v6 := compiler.MapValueForKey(m, "multipleOf")
- if v6 != nil {
- switch v6 := v6.(type) {
- case float64:
- x.MultipleOf = v6
- case float32:
- x.MultipleOf = float64(v6)
- case uint64:
- x.MultipleOf = float64(v6)
- case uint32:
- x.MultipleOf = float64(v6)
- case int64:
- x.MultipleOf = float64(v6)
- case int32:
- x.MultipleOf = float64(v6)
- case int:
- x.MultipleOf = float64(v6)
- default:
- message := fmt.Sprintf("has unexpected value for multipleOf: %+v (%T)", v6, v6)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // float maximum = 7;
- v7 := compiler.MapValueForKey(m, "maximum")
- if v7 != nil {
- switch v7 := v7.(type) {
- case float64:
- x.Maximum = v7
- case float32:
- x.Maximum = float64(v7)
- case uint64:
- x.Maximum = float64(v7)
- case uint32:
- x.Maximum = float64(v7)
- case int64:
- x.Maximum = float64(v7)
- case int32:
- x.Maximum = float64(v7)
- case int:
- x.Maximum = float64(v7)
- default:
- message := fmt.Sprintf("has unexpected value for maximum: %+v (%T)", v7, v7)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool exclusive_maximum = 8;
- v8 := compiler.MapValueForKey(m, "exclusiveMaximum")
- if v8 != nil {
- x.ExclusiveMaximum, ok = v8.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for exclusiveMaximum: %+v (%T)", v8, v8)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // float minimum = 9;
- v9 := compiler.MapValueForKey(m, "minimum")
- if v9 != nil {
- switch v9 := v9.(type) {
- case float64:
- x.Minimum = v9
- case float32:
- x.Minimum = float64(v9)
- case uint64:
- x.Minimum = float64(v9)
- case uint32:
- x.Minimum = float64(v9)
- case int64:
- x.Minimum = float64(v9)
- case int32:
- x.Minimum = float64(v9)
- case int:
- x.Minimum = float64(v9)
- default:
- message := fmt.Sprintf("has unexpected value for minimum: %+v (%T)", v9, v9)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool exclusive_minimum = 10;
- v10 := compiler.MapValueForKey(m, "exclusiveMinimum")
- if v10 != nil {
- x.ExclusiveMinimum, ok = v10.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for exclusiveMinimum: %+v (%T)", v10, v10)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_length = 11;
- v11 := compiler.MapValueForKey(m, "maxLength")
- if v11 != nil {
- t, ok := v11.(int)
- if ok {
- x.MaxLength = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxLength: %+v (%T)", v11, v11)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_length = 12;
- v12 := compiler.MapValueForKey(m, "minLength")
- if v12 != nil {
- t, ok := v12.(int)
- if ok {
- x.MinLength = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minLength: %+v (%T)", v12, v12)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string pattern = 13;
- v13 := compiler.MapValueForKey(m, "pattern")
- if v13 != nil {
- x.Pattern, ok = v13.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for pattern: %+v (%T)", v13, v13)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_items = 14;
- v14 := compiler.MapValueForKey(m, "maxItems")
- if v14 != nil {
- t, ok := v14.(int)
- if ok {
- x.MaxItems = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxItems: %+v (%T)", v14, v14)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_items = 15;
- v15 := compiler.MapValueForKey(m, "minItems")
- if v15 != nil {
- t, ok := v15.(int)
- if ok {
- x.MinItems = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minItems: %+v (%T)", v15, v15)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool unique_items = 16;
- v16 := compiler.MapValueForKey(m, "uniqueItems")
- if v16 != nil {
- x.UniqueItems, ok = v16.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for uniqueItems: %+v (%T)", v16, v16)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 max_properties = 17;
- v17 := compiler.MapValueForKey(m, "maxProperties")
- if v17 != nil {
- t, ok := v17.(int)
- if ok {
- x.MaxProperties = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for maxProperties: %+v (%T)", v17, v17)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // int64 min_properties = 18;
- v18 := compiler.MapValueForKey(m, "minProperties")
- if v18 != nil {
- t, ok := v18.(int)
- if ok {
- x.MinProperties = int64(t)
- } else {
- message := fmt.Sprintf("has unexpected value for minProperties: %+v (%T)", v18, v18)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated string required = 19;
- v19 := compiler.MapValueForKey(m, "required")
- if v19 != nil {
- v, ok := v19.([]interface{})
- if ok {
- x.Required = compiler.ConvertInterfaceArrayToStringArray(v)
- } else {
- message := fmt.Sprintf("has unexpected value for required: %+v (%T)", v19, v19)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated Any enum = 20;
- v20 := compiler.MapValueForKey(m, "enum")
- if v20 != nil {
- // repeated Any
- x.Enum = make([]*Any, 0)
- a, ok := v20.([]interface{})
- if ok {
- for _, item := range a {
- y, err := NewAny(item, compiler.NewContext("enum", context))
- if err != nil {
- errors = append(errors, err)
- }
- x.Enum = append(x.Enum, y)
- }
- }
- }
- // AdditionalPropertiesItem additional_properties = 21;
- v21 := compiler.MapValueForKey(m, "additionalProperties")
- if v21 != nil {
- var err error
- x.AdditionalProperties, err = NewAdditionalPropertiesItem(v21, compiler.NewContext("additionalProperties", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // TypeItem type = 22;
- v22 := compiler.MapValueForKey(m, "type")
- if v22 != nil {
- var err error
- x.Type, err = NewTypeItem(v22, compiler.NewContext("type", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // ItemsItem items = 23;
- v23 := compiler.MapValueForKey(m, "items")
- if v23 != nil {
- var err error
- x.Items, err = NewItemsItem(v23, compiler.NewContext("items", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // repeated Schema all_of = 24;
- v24 := compiler.MapValueForKey(m, "allOf")
- if v24 != nil {
- // repeated Schema
- x.AllOf = make([]*Schema, 0)
- a, ok := v24.([]interface{})
- if ok {
- for _, item := range a {
- y, err := NewSchema(item, compiler.NewContext("allOf", context))
- if err != nil {
- errors = append(errors, err)
- }
- x.AllOf = append(x.AllOf, y)
- }
- }
- }
- // Properties properties = 25;
- v25 := compiler.MapValueForKey(m, "properties")
- if v25 != nil {
- var err error
- x.Properties, err = NewProperties(v25, compiler.NewContext("properties", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // string discriminator = 26;
- v26 := compiler.MapValueForKey(m, "discriminator")
- if v26 != nil {
- x.Discriminator, ok = v26.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for discriminator: %+v (%T)", v26, v26)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool read_only = 27;
- v27 := compiler.MapValueForKey(m, "readOnly")
- if v27 != nil {
- x.ReadOnly, ok = v27.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for readOnly: %+v (%T)", v27, v27)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // Xml xml = 28;
- v28 := compiler.MapValueForKey(m, "xml")
- if v28 != nil {
- var err error
- x.Xml, err = NewXml(v28, compiler.NewContext("xml", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // ExternalDocs external_docs = 29;
- v29 := compiler.MapValueForKey(m, "externalDocs")
- if v29 != nil {
- var err error
- x.ExternalDocs, err = NewExternalDocs(v29, compiler.NewContext("externalDocs", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // Any example = 30;
- v30 := compiler.MapValueForKey(m, "example")
- if v30 != nil {
- var err error
- x.Example, err = NewAny(v30, compiler.NewContext("example", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // repeated NamedAny vendor_extension = 31;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewSchemaItem creates an object of type SchemaItem if possible, returning an error if not.
-func NewSchemaItem(in interface{}, context *compiler.Context) (*SchemaItem, error) {
- errors := make([]error, 0)
- x := &SchemaItem{}
- matched := false
- // Schema schema = 1;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewSchema(m, compiler.NewContext("schema", context))
- if matchingError == nil {
- x.Oneof = &SchemaItem_Schema{Schema: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // FileSchema file_schema = 2;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewFileSchema(m, compiler.NewContext("fileSchema", context))
- if matchingError == nil {
- x.Oneof = &SchemaItem_FileSchema{FileSchema: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- if matched {
- // since the oneof matched one of its possibilities, discard any matching errors
- errors = make([]error, 0)
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewSecurityDefinitions creates an object of type SecurityDefinitions if possible, returning an error if not.
-func NewSecurityDefinitions(in interface{}, context *compiler.Context) (*SecurityDefinitions, error) {
- errors := make([]error, 0)
- x := &SecurityDefinitions{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- // repeated NamedSecurityDefinitionsItem additional_properties = 1;
- // MAP: SecurityDefinitionsItem
- x.AdditionalProperties = make([]*NamedSecurityDefinitionsItem, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- pair := &NamedSecurityDefinitionsItem{}
- pair.Name = k
- var err error
- pair.Value, err = NewSecurityDefinitionsItem(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- x.AdditionalProperties = append(x.AdditionalProperties, pair)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewSecurityDefinitionsItem creates an object of type SecurityDefinitionsItem if possible, returning an error if not.
-func NewSecurityDefinitionsItem(in interface{}, context *compiler.Context) (*SecurityDefinitionsItem, error) {
- errors := make([]error, 0)
- x := &SecurityDefinitionsItem{}
- matched := false
- // BasicAuthenticationSecurity basic_authentication_security = 1;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewBasicAuthenticationSecurity(m, compiler.NewContext("basicAuthenticationSecurity", context))
- if matchingError == nil {
- x.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{BasicAuthenticationSecurity: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // ApiKeySecurity api_key_security = 2;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewApiKeySecurity(m, compiler.NewContext("apiKeySecurity", context))
- if matchingError == nil {
- x.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{ApiKeySecurity: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // Oauth2ImplicitSecurity oauth2_implicit_security = 3;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewOauth2ImplicitSecurity(m, compiler.NewContext("oauth2ImplicitSecurity", context))
- if matchingError == nil {
- x.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{Oauth2ImplicitSecurity: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // Oauth2PasswordSecurity oauth2_password_security = 4;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewOauth2PasswordSecurity(m, compiler.NewContext("oauth2PasswordSecurity", context))
- if matchingError == nil {
- x.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{Oauth2PasswordSecurity: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // Oauth2ApplicationSecurity oauth2_application_security = 5;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewOauth2ApplicationSecurity(m, compiler.NewContext("oauth2ApplicationSecurity", context))
- if matchingError == nil {
- x.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{Oauth2ApplicationSecurity: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- // Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
- {
- m, ok := compiler.UnpackMap(in)
- if ok {
- // errors might be ok here, they mean we just don't have the right subtype
- t, matchingError := NewOauth2AccessCodeSecurity(m, compiler.NewContext("oauth2AccessCodeSecurity", context))
- if matchingError == nil {
- x.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{Oauth2AccessCodeSecurity: t}
- matched = true
- } else {
- errors = append(errors, matchingError)
- }
- }
- }
- if matched {
- // since the oneof matched one of its possibilities, discard any matching errors
- errors = make([]error, 0)
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewSecurityRequirement creates an object of type SecurityRequirement if possible, returning an error if not.
-func NewSecurityRequirement(in interface{}, context *compiler.Context) (*SecurityRequirement, error) {
- errors := make([]error, 0)
- x := &SecurityRequirement{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- // repeated NamedStringArray additional_properties = 1;
- // MAP: StringArray
- x.AdditionalProperties = make([]*NamedStringArray, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- pair := &NamedStringArray{}
- pair.Name = k
- var err error
- pair.Value, err = NewStringArray(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- x.AdditionalProperties = append(x.AdditionalProperties, pair)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewStringArray creates an object of type StringArray if possible, returning an error if not.
-func NewStringArray(in interface{}, context *compiler.Context) (*StringArray, error) {
- errors := make([]error, 0)
- x := &StringArray{}
- a, ok := in.([]interface{})
- if !ok {
- message := fmt.Sprintf("has unexpected value for StringArray: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- x.Value = make([]string, 0)
- for _, s := range a {
- x.Value = append(x.Value, s.(string))
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewTag creates an object of type Tag if possible, returning an error if not.
-func NewTag(in interface{}, context *compiler.Context) (*Tag, error) {
- errors := make([]error, 0)
- x := &Tag{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- requiredKeys := []string{"name"}
- missingKeys := compiler.MissingKeysInMap(m, requiredKeys)
- if len(missingKeys) > 0 {
- message := fmt.Sprintf("is missing required %s: %+v", compiler.PluralProperties(len(missingKeys)), strings.Join(missingKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- allowedKeys := []string{"description", "externalDocs", "name"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string description = 2;
- v2 := compiler.MapValueForKey(m, "description")
- if v2 != nil {
- x.Description, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for description: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // ExternalDocs external_docs = 3;
- v3 := compiler.MapValueForKey(m, "externalDocs")
- if v3 != nil {
- var err error
- x.ExternalDocs, err = NewExternalDocs(v3, compiler.NewContext("externalDocs", context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- // repeated NamedAny vendor_extension = 4;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewTypeItem creates an object of type TypeItem if possible, returning an error if not.
-func NewTypeItem(in interface{}, context *compiler.Context) (*TypeItem, error) {
- errors := make([]error, 0)
- x := &TypeItem{}
- switch in := in.(type) {
- case string:
- x.Value = make([]string, 0)
- x.Value = append(x.Value, in)
- case []interface{}:
- x.Value = make([]string, 0)
- for _, v := range in {
- value, ok := v.(string)
- if ok {
- x.Value = append(x.Value, value)
- } else {
- message := fmt.Sprintf("has unexpected value for string array element: %+v (%T)", value, value)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- default:
- message := fmt.Sprintf("has unexpected value for string array: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewVendorExtension creates an object of type VendorExtension if possible, returning an error if not.
-func NewVendorExtension(in interface{}, context *compiler.Context) (*VendorExtension, error) {
- errors := make([]error, 0)
- x := &VendorExtension{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- // repeated NamedAny additional_properties = 1;
- // MAP: Any
- x.AdditionalProperties = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.AdditionalProperties = append(x.AdditionalProperties, pair)
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// NewXml creates an object of type Xml if possible, returning an error if not.
-func NewXml(in interface{}, context *compiler.Context) (*Xml, error) {
- errors := make([]error, 0)
- x := &Xml{}
- m, ok := compiler.UnpackMap(in)
- if !ok {
- message := fmt.Sprintf("has unexpected value: %+v (%T)", in, in)
- errors = append(errors, compiler.NewError(context, message))
- } else {
- allowedKeys := []string{"attribute", "name", "namespace", "prefix", "wrapped"}
- allowedPatterns := []*regexp.Regexp{pattern0}
- invalidKeys := compiler.InvalidKeysInMap(m, allowedKeys, allowedPatterns)
- if len(invalidKeys) > 0 {
- message := fmt.Sprintf("has invalid %s: %+v", compiler.PluralProperties(len(invalidKeys)), strings.Join(invalidKeys, ", "))
- errors = append(errors, compiler.NewError(context, message))
- }
- // string name = 1;
- v1 := compiler.MapValueForKey(m, "name")
- if v1 != nil {
- x.Name, ok = v1.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for name: %+v (%T)", v1, v1)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string namespace = 2;
- v2 := compiler.MapValueForKey(m, "namespace")
- if v2 != nil {
- x.Namespace, ok = v2.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for namespace: %+v (%T)", v2, v2)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // string prefix = 3;
- v3 := compiler.MapValueForKey(m, "prefix")
- if v3 != nil {
- x.Prefix, ok = v3.(string)
- if !ok {
- message := fmt.Sprintf("has unexpected value for prefix: %+v (%T)", v3, v3)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool attribute = 4;
- v4 := compiler.MapValueForKey(m, "attribute")
- if v4 != nil {
- x.Attribute, ok = v4.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for attribute: %+v (%T)", v4, v4)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // bool wrapped = 5;
- v5 := compiler.MapValueForKey(m, "wrapped")
- if v5 != nil {
- x.Wrapped, ok = v5.(bool)
- if !ok {
- message := fmt.Sprintf("has unexpected value for wrapped: %+v (%T)", v5, v5)
- errors = append(errors, compiler.NewError(context, message))
- }
- }
- // repeated NamedAny vendor_extension = 6;
- // MAP: Any ^x-
- x.VendorExtension = make([]*NamedAny, 0)
- for _, item := range m {
- k, ok := compiler.StringValue(item.Key)
- if ok {
- v := item.Value
- if strings.HasPrefix(k, "x-") {
- pair := &NamedAny{}
- pair.Name = k
- result := &Any{}
- handled, resultFromExt, err := compiler.HandleExtension(context, v, k)
- if handled {
- if err != nil {
- errors = append(errors, err)
- } else {
- bytes, _ := yaml.Marshal(v)
- result.Yaml = string(bytes)
- result.Value = resultFromExt
- pair.Value = result
- }
- } else {
- pair.Value, err = NewAny(v, compiler.NewContext(k, context))
- if err != nil {
- errors = append(errors, err)
- }
- }
- x.VendorExtension = append(x.VendorExtension, pair)
- }
- }
- }
- }
- return x, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside AdditionalPropertiesItem objects.
-func (m *AdditionalPropertiesItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- {
- p, ok := m.Oneof.(*AdditionalPropertiesItem_Schema)
- if ok {
- _, err := p.Schema.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Any objects.
-func (m *Any) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside ApiKeySecurity objects.
-func (m *ApiKeySecurity) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside BasicAuthenticationSecurity objects.
-func (m *BasicAuthenticationSecurity) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside BodyParameter objects.
-func (m *BodyParameter) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Schema != nil {
- _, err := m.Schema.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Contact objects.
-func (m *Contact) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Default objects.
-func (m *Default) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Definitions objects.
-func (m *Definitions) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Document objects.
-func (m *Document) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Info != nil {
- _, err := m.Info.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Paths != nil {
- _, err := m.Paths.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Definitions != nil {
- _, err := m.Definitions.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Parameters != nil {
- _, err := m.Parameters.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Responses != nil {
- _, err := m.Responses.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Security {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- if m.SecurityDefinitions != nil {
- _, err := m.SecurityDefinitions.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Tags {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- if m.ExternalDocs != nil {
- _, err := m.ExternalDocs.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Examples objects.
-func (m *Examples) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside ExternalDocs objects.
-func (m *ExternalDocs) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside FileSchema objects.
-func (m *FileSchema) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Default != nil {
- _, err := m.Default.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.ExternalDocs != nil {
- _, err := m.ExternalDocs.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Example != nil {
- _, err := m.Example.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside FormDataParameterSubSchema objects.
-func (m *FormDataParameterSubSchema) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Items != nil {
- _, err := m.Items.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Default != nil {
- _, err := m.Default.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Enum {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Header objects.
-func (m *Header) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Items != nil {
- _, err := m.Items.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Default != nil {
- _, err := m.Default.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Enum {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside HeaderParameterSubSchema objects.
-func (m *HeaderParameterSubSchema) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Items != nil {
- _, err := m.Items.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Default != nil {
- _, err := m.Default.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Enum {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Headers objects.
-func (m *Headers) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Info objects.
-func (m *Info) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Contact != nil {
- _, err := m.Contact.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.License != nil {
- _, err := m.License.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside ItemsItem objects.
-func (m *ItemsItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.Schema {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside JsonReference objects.
-func (m *JsonReference) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.XRef != "" {
- info, err := compiler.ReadInfoForRef(root, m.XRef)
- if err != nil {
- return nil, err
- }
- if info != nil {
- replacement, err := NewJsonReference(info, nil)
- if err == nil {
- *m = *replacement
- return m.ResolveReferences(root)
- }
- }
- return info, nil
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside License objects.
-func (m *License) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedAny objects.
-func (m *NamedAny) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedHeader objects.
-func (m *NamedHeader) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedParameter objects.
-func (m *NamedParameter) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedPathItem objects.
-func (m *NamedPathItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedResponse objects.
-func (m *NamedResponse) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedResponseValue objects.
-func (m *NamedResponseValue) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedSchema objects.
-func (m *NamedSchema) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedSecurityDefinitionsItem objects.
-func (m *NamedSecurityDefinitionsItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedString objects.
-func (m *NamedString) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NamedStringArray objects.
-func (m *NamedStringArray) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Value != nil {
- _, err := m.Value.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside NonBodyParameter objects.
-func (m *NonBodyParameter) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- {
- p, ok := m.Oneof.(*NonBodyParameter_HeaderParameterSubSchema)
- if ok {
- _, err := p.HeaderParameterSubSchema.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*NonBodyParameter_FormDataParameterSubSchema)
- if ok {
- _, err := p.FormDataParameterSubSchema.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*NonBodyParameter_QueryParameterSubSchema)
- if ok {
- _, err := p.QueryParameterSubSchema.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*NonBodyParameter_PathParameterSubSchema)
- if ok {
- _, err := p.PathParameterSubSchema.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Oauth2AccessCodeSecurity objects.
-func (m *Oauth2AccessCodeSecurity) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Scopes != nil {
- _, err := m.Scopes.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Oauth2ApplicationSecurity objects.
-func (m *Oauth2ApplicationSecurity) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Scopes != nil {
- _, err := m.Scopes.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Oauth2ImplicitSecurity objects.
-func (m *Oauth2ImplicitSecurity) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Scopes != nil {
- _, err := m.Scopes.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Oauth2PasswordSecurity objects.
-func (m *Oauth2PasswordSecurity) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Scopes != nil {
- _, err := m.Scopes.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Oauth2Scopes objects.
-func (m *Oauth2Scopes) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Operation objects.
-func (m *Operation) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.ExternalDocs != nil {
- _, err := m.ExternalDocs.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Parameters {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- if m.Responses != nil {
- _, err := m.Responses.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Security {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Parameter objects.
-func (m *Parameter) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- {
- p, ok := m.Oneof.(*Parameter_BodyParameter)
- if ok {
- _, err := p.BodyParameter.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*Parameter_NonBodyParameter)
- if ok {
- _, err := p.NonBodyParameter.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside ParameterDefinitions objects.
-func (m *ParameterDefinitions) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside ParametersItem objects.
-func (m *ParametersItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- {
- p, ok := m.Oneof.(*ParametersItem_Parameter)
- if ok {
- _, err := p.Parameter.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*ParametersItem_JsonReference)
- if ok {
- info, err := p.JsonReference.ResolveReferences(root)
- if err != nil {
- return nil, err
- } else if info != nil {
- n, err := NewParametersItem(info, nil)
- if err != nil {
- return nil, err
- } else if n != nil {
- *m = *n
- return nil, nil
- }
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside PathItem objects.
-func (m *PathItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.XRef != "" {
- info, err := compiler.ReadInfoForRef(root, m.XRef)
- if err != nil {
- return nil, err
- }
- if info != nil {
- replacement, err := NewPathItem(info, nil)
- if err == nil {
- *m = *replacement
- return m.ResolveReferences(root)
- }
- }
- return info, nil
- }
- if m.Get != nil {
- _, err := m.Get.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Put != nil {
- _, err := m.Put.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Post != nil {
- _, err := m.Post.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Delete != nil {
- _, err := m.Delete.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Options != nil {
- _, err := m.Options.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Head != nil {
- _, err := m.Head.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Patch != nil {
- _, err := m.Patch.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Parameters {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside PathParameterSubSchema objects.
-func (m *PathParameterSubSchema) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Items != nil {
- _, err := m.Items.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Default != nil {
- _, err := m.Default.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Enum {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Paths objects.
-func (m *Paths) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.Path {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside PrimitivesItems objects.
-func (m *PrimitivesItems) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Items != nil {
- _, err := m.Items.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Default != nil {
- _, err := m.Default.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Enum {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Properties objects.
-func (m *Properties) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside QueryParameterSubSchema objects.
-func (m *QueryParameterSubSchema) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Items != nil {
- _, err := m.Items.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Default != nil {
- _, err := m.Default.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Enum {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Response objects.
-func (m *Response) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.Schema != nil {
- _, err := m.Schema.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Headers != nil {
- _, err := m.Headers.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Examples != nil {
- _, err := m.Examples.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside ResponseDefinitions objects.
-func (m *ResponseDefinitions) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside ResponseValue objects.
-func (m *ResponseValue) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- {
- p, ok := m.Oneof.(*ResponseValue_Response)
- if ok {
- _, err := p.Response.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*ResponseValue_JsonReference)
- if ok {
- info, err := p.JsonReference.ResolveReferences(root)
- if err != nil {
- return nil, err
- } else if info != nil {
- n, err := NewResponseValue(info, nil)
- if err != nil {
- return nil, err
- } else if n != nil {
- *m = *n
- return nil, nil
- }
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Responses objects.
-func (m *Responses) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.ResponseCode {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Schema objects.
-func (m *Schema) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.XRef != "" {
- info, err := compiler.ReadInfoForRef(root, m.XRef)
- if err != nil {
- return nil, err
- }
- if info != nil {
- replacement, err := NewSchema(info, nil)
- if err == nil {
- *m = *replacement
- return m.ResolveReferences(root)
- }
- }
- return info, nil
- }
- if m.Default != nil {
- _, err := m.Default.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.Enum {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- if m.AdditionalProperties != nil {
- _, err := m.AdditionalProperties.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Type != nil {
- _, err := m.Type.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Items != nil {
- _, err := m.Items.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.AllOf {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- if m.Properties != nil {
- _, err := m.Properties.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Xml != nil {
- _, err := m.Xml.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.ExternalDocs != nil {
- _, err := m.ExternalDocs.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- if m.Example != nil {
- _, err := m.Example.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside SchemaItem objects.
-func (m *SchemaItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- {
- p, ok := m.Oneof.(*SchemaItem_Schema)
- if ok {
- _, err := p.Schema.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*SchemaItem_FileSchema)
- if ok {
- _, err := p.FileSchema.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside SecurityDefinitions objects.
-func (m *SecurityDefinitions) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside SecurityDefinitionsItem objects.
-func (m *SecurityDefinitionsItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- {
- p, ok := m.Oneof.(*SecurityDefinitionsItem_BasicAuthenticationSecurity)
- if ok {
- _, err := p.BasicAuthenticationSecurity.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*SecurityDefinitionsItem_ApiKeySecurity)
- if ok {
- _, err := p.ApiKeySecurity.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ImplicitSecurity)
- if ok {
- _, err := p.Oauth2ImplicitSecurity.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2PasswordSecurity)
- if ok {
- _, err := p.Oauth2PasswordSecurity.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2ApplicationSecurity)
- if ok {
- _, err := p.Oauth2ApplicationSecurity.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- {
- p, ok := m.Oneof.(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)
- if ok {
- _, err := p.Oauth2AccessCodeSecurity.ResolveReferences(root)
- if err != nil {
- return nil, err
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside SecurityRequirement objects.
-func (m *SecurityRequirement) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside StringArray objects.
-func (m *StringArray) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Tag objects.
-func (m *Tag) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- if m.ExternalDocs != nil {
- _, err := m.ExternalDocs.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside TypeItem objects.
-func (m *TypeItem) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside VendorExtension objects.
-func (m *VendorExtension) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.AdditionalProperties {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ResolveReferences resolves references found inside Xml objects.
-func (m *Xml) ResolveReferences(root string) (interface{}, error) {
- errors := make([]error, 0)
- for _, item := range m.VendorExtension {
- if item != nil {
- _, err := item.ResolveReferences(root)
- if err != nil {
- errors = append(errors, err)
- }
- }
- }
- return nil, compiler.NewErrorGroupOrNil(errors)
-}
-
-// ToRawInfo returns a description of AdditionalPropertiesItem suitable for JSON or YAML export.
-func (m *AdditionalPropertiesItem) ToRawInfo() interface{} {
- // ONE OF WRAPPER
- // AdditionalPropertiesItem
- // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v0 := m.GetSchema()
- if v0 != nil {
- return v0.ToRawInfo()
- }
- // {Name:boolean Type:bool StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if v1, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
- return v1.Boolean
- }
- return nil
-}
-
-// ToRawInfo returns a description of Any suitable for JSON or YAML export.
-func (m *Any) ToRawInfo() interface{} {
- var err error
- var info1 []yaml.MapSlice
- err = yaml.Unmarshal([]byte(m.Yaml), &info1)
- if err == nil {
- return info1
- }
- var info2 yaml.MapSlice
- err = yaml.Unmarshal([]byte(m.Yaml), &info2)
- if err == nil {
- return info2
- }
- var info3 interface{}
- err = yaml.Unmarshal([]byte(m.Yaml), &info3)
- if err == nil {
- return info3
- }
- return nil
-}
-
-// ToRawInfo returns a description of ApiKeySecurity suitable for JSON or YAML export.
-func (m *ApiKeySecurity) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.In != "" {
- info = append(info, yaml.MapItem{Key: "in", Value: m.In})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of BasicAuthenticationSecurity suitable for JSON or YAML export.
-func (m *BasicAuthenticationSecurity) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of BodyParameter suitable for JSON or YAML export.
-func (m *BodyParameter) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.In != "" {
- info = append(info, yaml.MapItem{Key: "in", Value: m.In})
- }
- if m.Required != false {
- info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
- }
- if m.Schema != nil {
- info = append(info, yaml.MapItem{Key: "schema", Value: m.Schema.ToRawInfo()})
- }
- // &{Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Contact suitable for JSON or YAML export.
-func (m *Contact) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.Url != "" {
- info = append(info, yaml.MapItem{Key: "url", Value: m.Url})
- }
- if m.Email != "" {
- info = append(info, yaml.MapItem{Key: "email", Value: m.Email})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Default suitable for JSON or YAML export.
-func (m *Default) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern: Implicit:false Description:}
- return info
-}
-
-// ToRawInfo returns a description of Definitions suitable for JSON or YAML export.
-func (m *Definitions) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedSchema StringEnumValues:[] MapType:Schema Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Document suitable for JSON or YAML export.
-func (m *Document) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Swagger != "" {
- info = append(info, yaml.MapItem{Key: "swagger", Value: m.Swagger})
- }
- if m.Info != nil {
- info = append(info, yaml.MapItem{Key: "info", Value: m.Info.ToRawInfo()})
- }
- // &{Name:info Type:Info StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Host != "" {
- info = append(info, yaml.MapItem{Key: "host", Value: m.Host})
- }
- if m.BasePath != "" {
- info = append(info, yaml.MapItem{Key: "basePath", Value: m.BasePath})
- }
- if len(m.Schemes) != 0 {
- info = append(info, yaml.MapItem{Key: "schemes", Value: m.Schemes})
- }
- if len(m.Consumes) != 0 {
- info = append(info, yaml.MapItem{Key: "consumes", Value: m.Consumes})
- }
- if len(m.Produces) != 0 {
- info = append(info, yaml.MapItem{Key: "produces", Value: m.Produces})
- }
- if m.Paths != nil {
- info = append(info, yaml.MapItem{Key: "paths", Value: m.Paths.ToRawInfo()})
- }
- // &{Name:paths Type:Paths StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Definitions != nil {
- info = append(info, yaml.MapItem{Key: "definitions", Value: m.Definitions.ToRawInfo()})
- }
- // &{Name:definitions Type:Definitions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Parameters != nil {
- info = append(info, yaml.MapItem{Key: "parameters", Value: m.Parameters.ToRawInfo()})
- }
- // &{Name:parameters Type:ParameterDefinitions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Responses != nil {
- info = append(info, yaml.MapItem{Key: "responses", Value: m.Responses.ToRawInfo()})
- }
- // &{Name:responses Type:ResponseDefinitions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if len(m.Security) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Security {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "security", Value: items})
- }
- // &{Name:security Type:SecurityRequirement StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.SecurityDefinitions != nil {
- info = append(info, yaml.MapItem{Key: "securityDefinitions", Value: m.SecurityDefinitions.ToRawInfo()})
- }
- // &{Name:securityDefinitions Type:SecurityDefinitions StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if len(m.Tags) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Tags {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "tags", Value: items})
- }
- // &{Name:tags Type:Tag StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.ExternalDocs != nil {
- info = append(info, yaml.MapItem{Key: "externalDocs", Value: m.ExternalDocs.ToRawInfo()})
- }
- // &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Examples suitable for JSON or YAML export.
-func (m *Examples) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of ExternalDocs suitable for JSON or YAML export.
-func (m *ExternalDocs) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Url != "" {
- info = append(info, yaml.MapItem{Key: "url", Value: m.Url})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of FileSchema suitable for JSON or YAML export.
-func (m *FileSchema) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Format != "" {
- info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
- }
- if m.Title != "" {
- info = append(info, yaml.MapItem{Key: "title", Value: m.Title})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Default != nil {
- info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
- }
- // &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if len(m.Required) != 0 {
- info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
- }
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.ReadOnly != false {
- info = append(info, yaml.MapItem{Key: "readOnly", Value: m.ReadOnly})
- }
- if m.ExternalDocs != nil {
- info = append(info, yaml.MapItem{Key: "externalDocs", Value: m.ExternalDocs.ToRawInfo()})
- }
- // &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Example != nil {
- info = append(info, yaml.MapItem{Key: "example", Value: m.Example.ToRawInfo()})
- }
- // &{Name:example Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of FormDataParameterSubSchema suitable for JSON or YAML export.
-func (m *FormDataParameterSubSchema) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Required != false {
- info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
- }
- if m.In != "" {
- info = append(info, yaml.MapItem{Key: "in", Value: m.In})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.AllowEmptyValue != false {
- info = append(info, yaml.MapItem{Key: "allowEmptyValue", Value: m.AllowEmptyValue})
- }
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Format != "" {
- info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
- }
- if m.Items != nil {
- info = append(info, yaml.MapItem{Key: "items", Value: m.Items.ToRawInfo()})
- }
- // &{Name:items Type:PrimitivesItems StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.CollectionFormat != "" {
- info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
- }
- if m.Default != nil {
- info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
- }
- // &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Maximum != 0.0 {
- info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
- }
- if m.ExclusiveMaximum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMaximum", Value: m.ExclusiveMaximum})
- }
- if m.Minimum != 0.0 {
- info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
- }
- if m.ExclusiveMinimum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMinimum", Value: m.ExclusiveMinimum})
- }
- if m.MaxLength != 0 {
- info = append(info, yaml.MapItem{Key: "maxLength", Value: m.MaxLength})
- }
- if m.MinLength != 0 {
- info = append(info, yaml.MapItem{Key: "minLength", Value: m.MinLength})
- }
- if m.Pattern != "" {
- info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
- }
- if m.MaxItems != 0 {
- info = append(info, yaml.MapItem{Key: "maxItems", Value: m.MaxItems})
- }
- if m.MinItems != 0 {
- info = append(info, yaml.MapItem{Key: "minItems", Value: m.MinItems})
- }
- if m.UniqueItems != false {
- info = append(info, yaml.MapItem{Key: "uniqueItems", Value: m.UniqueItems})
- }
- if len(m.Enum) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Enum {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "enum", Value: items})
- }
- // &{Name:enum Type:Any StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.MultipleOf != 0.0 {
- info = append(info, yaml.MapItem{Key: "multipleOf", Value: m.MultipleOf})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Header suitable for JSON or YAML export.
-func (m *Header) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Format != "" {
- info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
- }
- if m.Items != nil {
- info = append(info, yaml.MapItem{Key: "items", Value: m.Items.ToRawInfo()})
- }
- // &{Name:items Type:PrimitivesItems StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.CollectionFormat != "" {
- info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
- }
- if m.Default != nil {
- info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
- }
- // &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Maximum != 0.0 {
- info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
- }
- if m.ExclusiveMaximum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMaximum", Value: m.ExclusiveMaximum})
- }
- if m.Minimum != 0.0 {
- info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
- }
- if m.ExclusiveMinimum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMinimum", Value: m.ExclusiveMinimum})
- }
- if m.MaxLength != 0 {
- info = append(info, yaml.MapItem{Key: "maxLength", Value: m.MaxLength})
- }
- if m.MinLength != 0 {
- info = append(info, yaml.MapItem{Key: "minLength", Value: m.MinLength})
- }
- if m.Pattern != "" {
- info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
- }
- if m.MaxItems != 0 {
- info = append(info, yaml.MapItem{Key: "maxItems", Value: m.MaxItems})
- }
- if m.MinItems != 0 {
- info = append(info, yaml.MapItem{Key: "minItems", Value: m.MinItems})
- }
- if m.UniqueItems != false {
- info = append(info, yaml.MapItem{Key: "uniqueItems", Value: m.UniqueItems})
- }
- if len(m.Enum) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Enum {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "enum", Value: items})
- }
- // &{Name:enum Type:Any StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.MultipleOf != 0.0 {
- info = append(info, yaml.MapItem{Key: "multipleOf", Value: m.MultipleOf})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of HeaderParameterSubSchema suitable for JSON or YAML export.
-func (m *HeaderParameterSubSchema) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Required != false {
- info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
- }
- if m.In != "" {
- info = append(info, yaml.MapItem{Key: "in", Value: m.In})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Format != "" {
- info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
- }
- if m.Items != nil {
- info = append(info, yaml.MapItem{Key: "items", Value: m.Items.ToRawInfo()})
- }
- // &{Name:items Type:PrimitivesItems StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.CollectionFormat != "" {
- info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
- }
- if m.Default != nil {
- info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
- }
- // &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Maximum != 0.0 {
- info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
- }
- if m.ExclusiveMaximum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMaximum", Value: m.ExclusiveMaximum})
- }
- if m.Minimum != 0.0 {
- info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
- }
- if m.ExclusiveMinimum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMinimum", Value: m.ExclusiveMinimum})
- }
- if m.MaxLength != 0 {
- info = append(info, yaml.MapItem{Key: "maxLength", Value: m.MaxLength})
- }
- if m.MinLength != 0 {
- info = append(info, yaml.MapItem{Key: "minLength", Value: m.MinLength})
- }
- if m.Pattern != "" {
- info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
- }
- if m.MaxItems != 0 {
- info = append(info, yaml.MapItem{Key: "maxItems", Value: m.MaxItems})
- }
- if m.MinItems != 0 {
- info = append(info, yaml.MapItem{Key: "minItems", Value: m.MinItems})
- }
- if m.UniqueItems != false {
- info = append(info, yaml.MapItem{Key: "uniqueItems", Value: m.UniqueItems})
- }
- if len(m.Enum) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Enum {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "enum", Value: items})
- }
- // &{Name:enum Type:Any StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.MultipleOf != 0.0 {
- info = append(info, yaml.MapItem{Key: "multipleOf", Value: m.MultipleOf})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Headers suitable for JSON or YAML export.
-func (m *Headers) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedHeader StringEnumValues:[] MapType:Header Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Info suitable for JSON or YAML export.
-func (m *Info) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Title != "" {
- info = append(info, yaml.MapItem{Key: "title", Value: m.Title})
- }
- if m.Version != "" {
- info = append(info, yaml.MapItem{Key: "version", Value: m.Version})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.TermsOfService != "" {
- info = append(info, yaml.MapItem{Key: "termsOfService", Value: m.TermsOfService})
- }
- if m.Contact != nil {
- info = append(info, yaml.MapItem{Key: "contact", Value: m.Contact.ToRawInfo()})
- }
- // &{Name:contact Type:Contact StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.License != nil {
- info = append(info, yaml.MapItem{Key: "license", Value: m.License.ToRawInfo()})
- }
- // &{Name:license Type:License StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of ItemsItem suitable for JSON or YAML export.
-func (m *ItemsItem) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if len(m.Schema) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Schema {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "schema", Value: items})
- }
- // &{Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- return info
-}
-
-// ToRawInfo returns a description of JsonReference suitable for JSON or YAML export.
-func (m *JsonReference) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.XRef != "" {
- info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- return info
-}
-
-// ToRawInfo returns a description of License suitable for JSON or YAML export.
-func (m *License) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.Url != "" {
- info = append(info, yaml.MapItem{Key: "url", Value: m.Url})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of NamedAny suitable for JSON or YAML export.
-func (m *NamedAny) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NamedHeader suitable for JSON or YAML export.
-func (m *NamedHeader) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:Header StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NamedParameter suitable for JSON or YAML export.
-func (m *NamedParameter) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NamedPathItem suitable for JSON or YAML export.
-func (m *NamedPathItem) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:PathItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NamedResponse suitable for JSON or YAML export.
-func (m *NamedResponse) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NamedResponseValue suitable for JSON or YAML export.
-func (m *NamedResponseValue) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:ResponseValue StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NamedSchema suitable for JSON or YAML export.
-func (m *NamedSchema) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NamedSecurityDefinitionsItem suitable for JSON or YAML export.
-func (m *NamedSecurityDefinitionsItem) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:SecurityDefinitionsItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NamedString suitable for JSON or YAML export.
-func (m *NamedString) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.Value != "" {
- info = append(info, yaml.MapItem{Key: "value", Value: m.Value})
- }
- return info
-}
-
-// ToRawInfo returns a description of NamedStringArray suitable for JSON or YAML export.
-func (m *NamedStringArray) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- // &{Name:value Type:StringArray StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:Mapped value}
- return info
-}
-
-// ToRawInfo returns a description of NonBodyParameter suitable for JSON or YAML export.
-func (m *NonBodyParameter) ToRawInfo() interface{} {
- // ONE OF WRAPPER
- // NonBodyParameter
- // {Name:headerParameterSubSchema Type:HeaderParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v0 := m.GetHeaderParameterSubSchema()
- if v0 != nil {
- return v0.ToRawInfo()
- }
- // {Name:formDataParameterSubSchema Type:FormDataParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v1 := m.GetFormDataParameterSubSchema()
- if v1 != nil {
- return v1.ToRawInfo()
- }
- // {Name:queryParameterSubSchema Type:QueryParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v2 := m.GetQueryParameterSubSchema()
- if v2 != nil {
- return v2.ToRawInfo()
- }
- // {Name:pathParameterSubSchema Type:PathParameterSubSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v3 := m.GetPathParameterSubSchema()
- if v3 != nil {
- return v3.ToRawInfo()
- }
- return nil
-}
-
-// ToRawInfo returns a description of Oauth2AccessCodeSecurity suitable for JSON or YAML export.
-func (m *Oauth2AccessCodeSecurity) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Flow != "" {
- info = append(info, yaml.MapItem{Key: "flow", Value: m.Flow})
- }
- if m.Scopes != nil {
- info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes.ToRawInfo()})
- }
- // &{Name:scopes Type:Oauth2Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.AuthorizationUrl != "" {
- info = append(info, yaml.MapItem{Key: "authorizationUrl", Value: m.AuthorizationUrl})
- }
- if m.TokenUrl != "" {
- info = append(info, yaml.MapItem{Key: "tokenUrl", Value: m.TokenUrl})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Oauth2ApplicationSecurity suitable for JSON or YAML export.
-func (m *Oauth2ApplicationSecurity) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Flow != "" {
- info = append(info, yaml.MapItem{Key: "flow", Value: m.Flow})
- }
- if m.Scopes != nil {
- info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes.ToRawInfo()})
- }
- // &{Name:scopes Type:Oauth2Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.TokenUrl != "" {
- info = append(info, yaml.MapItem{Key: "tokenUrl", Value: m.TokenUrl})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Oauth2ImplicitSecurity suitable for JSON or YAML export.
-func (m *Oauth2ImplicitSecurity) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Flow != "" {
- info = append(info, yaml.MapItem{Key: "flow", Value: m.Flow})
- }
- if m.Scopes != nil {
- info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes.ToRawInfo()})
- }
- // &{Name:scopes Type:Oauth2Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.AuthorizationUrl != "" {
- info = append(info, yaml.MapItem{Key: "authorizationUrl", Value: m.AuthorizationUrl})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Oauth2PasswordSecurity suitable for JSON or YAML export.
-func (m *Oauth2PasswordSecurity) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Flow != "" {
- info = append(info, yaml.MapItem{Key: "flow", Value: m.Flow})
- }
- if m.Scopes != nil {
- info = append(info, yaml.MapItem{Key: "scopes", Value: m.Scopes.ToRawInfo()})
- }
- // &{Name:scopes Type:Oauth2Scopes StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.TokenUrl != "" {
- info = append(info, yaml.MapItem{Key: "tokenUrl", Value: m.TokenUrl})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Oauth2Scopes suitable for JSON or YAML export.
-func (m *Oauth2Scopes) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- // &{Name:additionalProperties Type:NamedString StringEnumValues:[] MapType:string Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Operation suitable for JSON or YAML export.
-func (m *Operation) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if len(m.Tags) != 0 {
- info = append(info, yaml.MapItem{Key: "tags", Value: m.Tags})
- }
- if m.Summary != "" {
- info = append(info, yaml.MapItem{Key: "summary", Value: m.Summary})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.ExternalDocs != nil {
- info = append(info, yaml.MapItem{Key: "externalDocs", Value: m.ExternalDocs.ToRawInfo()})
- }
- // &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.OperationId != "" {
- info = append(info, yaml.MapItem{Key: "operationId", Value: m.OperationId})
- }
- if len(m.Produces) != 0 {
- info = append(info, yaml.MapItem{Key: "produces", Value: m.Produces})
- }
- if len(m.Consumes) != 0 {
- info = append(info, yaml.MapItem{Key: "consumes", Value: m.Consumes})
- }
- if len(m.Parameters) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Parameters {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "parameters", Value: items})
- }
- // &{Name:parameters Type:ParametersItem StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:The parameters needed to send a valid API call.}
- if m.Responses != nil {
- info = append(info, yaml.MapItem{Key: "responses", Value: m.Responses.ToRawInfo()})
- }
- // &{Name:responses Type:Responses StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if len(m.Schemes) != 0 {
- info = append(info, yaml.MapItem{Key: "schemes", Value: m.Schemes})
- }
- if m.Deprecated != false {
- info = append(info, yaml.MapItem{Key: "deprecated", Value: m.Deprecated})
- }
- if len(m.Security) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Security {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "security", Value: items})
- }
- // &{Name:security Type:SecurityRequirement StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Parameter suitable for JSON or YAML export.
-func (m *Parameter) ToRawInfo() interface{} {
- // ONE OF WRAPPER
- // Parameter
- // {Name:bodyParameter Type:BodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v0 := m.GetBodyParameter()
- if v0 != nil {
- return v0.ToRawInfo()
- }
- // {Name:nonBodyParameter Type:NonBodyParameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v1 := m.GetNonBodyParameter()
- if v1 != nil {
- return v1.ToRawInfo()
- }
- return nil
-}
-
-// ToRawInfo returns a description of ParameterDefinitions suitable for JSON or YAML export.
-func (m *ParameterDefinitions) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedParameter StringEnumValues:[] MapType:Parameter Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of ParametersItem suitable for JSON or YAML export.
-func (m *ParametersItem) ToRawInfo() interface{} {
- // ONE OF WRAPPER
- // ParametersItem
- // {Name:parameter Type:Parameter StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v0 := m.GetParameter()
- if v0 != nil {
- return v0.ToRawInfo()
- }
- // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v1 := m.GetJsonReference()
- if v1 != nil {
- return v1.ToRawInfo()
- }
- return nil
-}
-
-// ToRawInfo returns a description of PathItem suitable for JSON or YAML export.
-func (m *PathItem) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.XRef != "" {
- info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef})
- }
- if m.Get != nil {
- info = append(info, yaml.MapItem{Key: "get", Value: m.Get.ToRawInfo()})
- }
- // &{Name:get Type:Operation StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Put != nil {
- info = append(info, yaml.MapItem{Key: "put", Value: m.Put.ToRawInfo()})
- }
- // &{Name:put Type:Operation StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Post != nil {
- info = append(info, yaml.MapItem{Key: "post", Value: m.Post.ToRawInfo()})
- }
- // &{Name:post Type:Operation StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Delete != nil {
- info = append(info, yaml.MapItem{Key: "delete", Value: m.Delete.ToRawInfo()})
- }
- // &{Name:delete Type:Operation StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Options != nil {
- info = append(info, yaml.MapItem{Key: "options", Value: m.Options.ToRawInfo()})
- }
- // &{Name:options Type:Operation StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Head != nil {
- info = append(info, yaml.MapItem{Key: "head", Value: m.Head.ToRawInfo()})
- }
- // &{Name:head Type:Operation StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Patch != nil {
- info = append(info, yaml.MapItem{Key: "patch", Value: m.Patch.ToRawInfo()})
- }
- // &{Name:patch Type:Operation StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if len(m.Parameters) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Parameters {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "parameters", Value: items})
- }
- // &{Name:parameters Type:ParametersItem StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:The parameters needed to send a valid API call.}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of PathParameterSubSchema suitable for JSON or YAML export.
-func (m *PathParameterSubSchema) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Required != false {
- info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
- }
- if m.In != "" {
- info = append(info, yaml.MapItem{Key: "in", Value: m.In})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Format != "" {
- info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
- }
- if m.Items != nil {
- info = append(info, yaml.MapItem{Key: "items", Value: m.Items.ToRawInfo()})
- }
- // &{Name:items Type:PrimitivesItems StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.CollectionFormat != "" {
- info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
- }
- if m.Default != nil {
- info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
- }
- // &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Maximum != 0.0 {
- info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
- }
- if m.ExclusiveMaximum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMaximum", Value: m.ExclusiveMaximum})
- }
- if m.Minimum != 0.0 {
- info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
- }
- if m.ExclusiveMinimum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMinimum", Value: m.ExclusiveMinimum})
- }
- if m.MaxLength != 0 {
- info = append(info, yaml.MapItem{Key: "maxLength", Value: m.MaxLength})
- }
- if m.MinLength != 0 {
- info = append(info, yaml.MapItem{Key: "minLength", Value: m.MinLength})
- }
- if m.Pattern != "" {
- info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
- }
- if m.MaxItems != 0 {
- info = append(info, yaml.MapItem{Key: "maxItems", Value: m.MaxItems})
- }
- if m.MinItems != 0 {
- info = append(info, yaml.MapItem{Key: "minItems", Value: m.MinItems})
- }
- if m.UniqueItems != false {
- info = append(info, yaml.MapItem{Key: "uniqueItems", Value: m.UniqueItems})
- }
- if len(m.Enum) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Enum {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "enum", Value: items})
- }
- // &{Name:enum Type:Any StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.MultipleOf != 0.0 {
- info = append(info, yaml.MapItem{Key: "multipleOf", Value: m.MultipleOf})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Paths suitable for JSON or YAML export.
-func (m *Paths) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- if m.Path != nil {
- for _, item := range m.Path {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:Path Type:NamedPathItem StringEnumValues:[] MapType:PathItem Repeated:true Pattern:^/ Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of PrimitivesItems suitable for JSON or YAML export.
-func (m *PrimitivesItems) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Format != "" {
- info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
- }
- if m.Items != nil {
- info = append(info, yaml.MapItem{Key: "items", Value: m.Items.ToRawInfo()})
- }
- // &{Name:items Type:PrimitivesItems StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.CollectionFormat != "" {
- info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
- }
- if m.Default != nil {
- info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
- }
- // &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Maximum != 0.0 {
- info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
- }
- if m.ExclusiveMaximum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMaximum", Value: m.ExclusiveMaximum})
- }
- if m.Minimum != 0.0 {
- info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
- }
- if m.ExclusiveMinimum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMinimum", Value: m.ExclusiveMinimum})
- }
- if m.MaxLength != 0 {
- info = append(info, yaml.MapItem{Key: "maxLength", Value: m.MaxLength})
- }
- if m.MinLength != 0 {
- info = append(info, yaml.MapItem{Key: "minLength", Value: m.MinLength})
- }
- if m.Pattern != "" {
- info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
- }
- if m.MaxItems != 0 {
- info = append(info, yaml.MapItem{Key: "maxItems", Value: m.MaxItems})
- }
- if m.MinItems != 0 {
- info = append(info, yaml.MapItem{Key: "minItems", Value: m.MinItems})
- }
- if m.UniqueItems != false {
- info = append(info, yaml.MapItem{Key: "uniqueItems", Value: m.UniqueItems})
- }
- if len(m.Enum) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Enum {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "enum", Value: items})
- }
- // &{Name:enum Type:Any StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.MultipleOf != 0.0 {
- info = append(info, yaml.MapItem{Key: "multipleOf", Value: m.MultipleOf})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Properties suitable for JSON or YAML export.
-func (m *Properties) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedSchema StringEnumValues:[] MapType:Schema Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of QueryParameterSubSchema suitable for JSON or YAML export.
-func (m *QueryParameterSubSchema) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Required != false {
- info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
- }
- if m.In != "" {
- info = append(info, yaml.MapItem{Key: "in", Value: m.In})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.AllowEmptyValue != false {
- info = append(info, yaml.MapItem{Key: "allowEmptyValue", Value: m.AllowEmptyValue})
- }
- if m.Type != "" {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type})
- }
- if m.Format != "" {
- info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
- }
- if m.Items != nil {
- info = append(info, yaml.MapItem{Key: "items", Value: m.Items.ToRawInfo()})
- }
- // &{Name:items Type:PrimitivesItems StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.CollectionFormat != "" {
- info = append(info, yaml.MapItem{Key: "collectionFormat", Value: m.CollectionFormat})
- }
- if m.Default != nil {
- info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
- }
- // &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Maximum != 0.0 {
- info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
- }
- if m.ExclusiveMaximum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMaximum", Value: m.ExclusiveMaximum})
- }
- if m.Minimum != 0.0 {
- info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
- }
- if m.ExclusiveMinimum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMinimum", Value: m.ExclusiveMinimum})
- }
- if m.MaxLength != 0 {
- info = append(info, yaml.MapItem{Key: "maxLength", Value: m.MaxLength})
- }
- if m.MinLength != 0 {
- info = append(info, yaml.MapItem{Key: "minLength", Value: m.MinLength})
- }
- if m.Pattern != "" {
- info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
- }
- if m.MaxItems != 0 {
- info = append(info, yaml.MapItem{Key: "maxItems", Value: m.MaxItems})
- }
- if m.MinItems != 0 {
- info = append(info, yaml.MapItem{Key: "minItems", Value: m.MinItems})
- }
- if m.UniqueItems != false {
- info = append(info, yaml.MapItem{Key: "uniqueItems", Value: m.UniqueItems})
- }
- if len(m.Enum) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Enum {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "enum", Value: items})
- }
- // &{Name:enum Type:Any StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.MultipleOf != 0.0 {
- info = append(info, yaml.MapItem{Key: "multipleOf", Value: m.MultipleOf})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Response suitable for JSON or YAML export.
-func (m *Response) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Schema != nil {
- info = append(info, yaml.MapItem{Key: "schema", Value: m.Schema.ToRawInfo()})
- }
- // &{Name:schema Type:SchemaItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Headers != nil {
- info = append(info, yaml.MapItem{Key: "headers", Value: m.Headers.ToRawInfo()})
- }
- // &{Name:headers Type:Headers StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Examples != nil {
- info = append(info, yaml.MapItem{Key: "examples", Value: m.Examples.ToRawInfo()})
- }
- // &{Name:examples Type:Examples StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of ResponseDefinitions suitable for JSON or YAML export.
-func (m *ResponseDefinitions) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedResponse StringEnumValues:[] MapType:Response Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of ResponseValue suitable for JSON or YAML export.
-func (m *ResponseValue) ToRawInfo() interface{} {
- // ONE OF WRAPPER
- // ResponseValue
- // {Name:response Type:Response StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v0 := m.GetResponse()
- if v0 != nil {
- return v0.ToRawInfo()
- }
- // {Name:jsonReference Type:JsonReference StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v1 := m.GetJsonReference()
- if v1 != nil {
- return v1.ToRawInfo()
- }
- return nil
-}
-
-// ToRawInfo returns a description of Responses suitable for JSON or YAML export.
-func (m *Responses) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.ResponseCode != nil {
- for _, item := range m.ResponseCode {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:ResponseCode Type:NamedResponseValue StringEnumValues:[] MapType:ResponseValue Repeated:true Pattern:^([0-9]{3})$|^(default)$ Implicit:true Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Schema suitable for JSON or YAML export.
-func (m *Schema) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.XRef != "" {
- info = append(info, yaml.MapItem{Key: "$ref", Value: m.XRef})
- }
- if m.Format != "" {
- info = append(info, yaml.MapItem{Key: "format", Value: m.Format})
- }
- if m.Title != "" {
- info = append(info, yaml.MapItem{Key: "title", Value: m.Title})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.Default != nil {
- info = append(info, yaml.MapItem{Key: "default", Value: m.Default.ToRawInfo()})
- }
- // &{Name:default Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.MultipleOf != 0.0 {
- info = append(info, yaml.MapItem{Key: "multipleOf", Value: m.MultipleOf})
- }
- if m.Maximum != 0.0 {
- info = append(info, yaml.MapItem{Key: "maximum", Value: m.Maximum})
- }
- if m.ExclusiveMaximum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMaximum", Value: m.ExclusiveMaximum})
- }
- if m.Minimum != 0.0 {
- info = append(info, yaml.MapItem{Key: "minimum", Value: m.Minimum})
- }
- if m.ExclusiveMinimum != false {
- info = append(info, yaml.MapItem{Key: "exclusiveMinimum", Value: m.ExclusiveMinimum})
- }
- if m.MaxLength != 0 {
- info = append(info, yaml.MapItem{Key: "maxLength", Value: m.MaxLength})
- }
- if m.MinLength != 0 {
- info = append(info, yaml.MapItem{Key: "minLength", Value: m.MinLength})
- }
- if m.Pattern != "" {
- info = append(info, yaml.MapItem{Key: "pattern", Value: m.Pattern})
- }
- if m.MaxItems != 0 {
- info = append(info, yaml.MapItem{Key: "maxItems", Value: m.MaxItems})
- }
- if m.MinItems != 0 {
- info = append(info, yaml.MapItem{Key: "minItems", Value: m.MinItems})
- }
- if m.UniqueItems != false {
- info = append(info, yaml.MapItem{Key: "uniqueItems", Value: m.UniqueItems})
- }
- if m.MaxProperties != 0 {
- info = append(info, yaml.MapItem{Key: "maxProperties", Value: m.MaxProperties})
- }
- if m.MinProperties != 0 {
- info = append(info, yaml.MapItem{Key: "minProperties", Value: m.MinProperties})
- }
- if len(m.Required) != 0 {
- info = append(info, yaml.MapItem{Key: "required", Value: m.Required})
- }
- if len(m.Enum) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.Enum {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "enum", Value: items})
- }
- // &{Name:enum Type:Any StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.AdditionalProperties != nil {
- info = append(info, yaml.MapItem{Key: "additionalProperties", Value: m.AdditionalProperties.ToRawInfo()})
- }
- // &{Name:additionalProperties Type:AdditionalPropertiesItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Type != nil {
- if len(m.Type.Value) == 1 {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type.Value[0]})
- } else {
- info = append(info, yaml.MapItem{Key: "type", Value: m.Type.Value})
- }
- }
- // &{Name:type Type:TypeItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Items != nil {
- items := make([]interface{}, 0)
- for _, item := range m.Items.Schema {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "items", Value: items[0]})
- }
- // &{Name:items Type:ItemsItem StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if len(m.AllOf) != 0 {
- items := make([]interface{}, 0)
- for _, item := range m.AllOf {
- items = append(items, item.ToRawInfo())
- }
- info = append(info, yaml.MapItem{Key: "allOf", Value: items})
- }
- // &{Name:allOf Type:Schema StringEnumValues:[] MapType: Repeated:true Pattern: Implicit:false Description:}
- if m.Properties != nil {
- info = append(info, yaml.MapItem{Key: "properties", Value: m.Properties.ToRawInfo()})
- }
- // &{Name:properties Type:Properties StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Discriminator != "" {
- info = append(info, yaml.MapItem{Key: "discriminator", Value: m.Discriminator})
- }
- if m.ReadOnly != false {
- info = append(info, yaml.MapItem{Key: "readOnly", Value: m.ReadOnly})
- }
- if m.Xml != nil {
- info = append(info, yaml.MapItem{Key: "xml", Value: m.Xml.ToRawInfo()})
- }
- // &{Name:xml Type:Xml StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.ExternalDocs != nil {
- info = append(info, yaml.MapItem{Key: "externalDocs", Value: m.ExternalDocs.ToRawInfo()})
- }
- // &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.Example != nil {
- info = append(info, yaml.MapItem{Key: "example", Value: m.Example.ToRawInfo()})
- }
- // &{Name:example Type:Any StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of SchemaItem suitable for JSON or YAML export.
-func (m *SchemaItem) ToRawInfo() interface{} {
- // ONE OF WRAPPER
- // SchemaItem
- // {Name:schema Type:Schema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v0 := m.GetSchema()
- if v0 != nil {
- return v0.ToRawInfo()
- }
- // {Name:fileSchema Type:FileSchema StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v1 := m.GetFileSchema()
- if v1 != nil {
- return v1.ToRawInfo()
- }
- return nil
-}
-
-// ToRawInfo returns a description of SecurityDefinitions suitable for JSON or YAML export.
-func (m *SecurityDefinitions) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedSecurityDefinitionsItem StringEnumValues:[] MapType:SecurityDefinitionsItem Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of SecurityDefinitionsItem suitable for JSON or YAML export.
-func (m *SecurityDefinitionsItem) ToRawInfo() interface{} {
- // ONE OF WRAPPER
- // SecurityDefinitionsItem
- // {Name:basicAuthenticationSecurity Type:BasicAuthenticationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v0 := m.GetBasicAuthenticationSecurity()
- if v0 != nil {
- return v0.ToRawInfo()
- }
- // {Name:apiKeySecurity Type:ApiKeySecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v1 := m.GetApiKeySecurity()
- if v1 != nil {
- return v1.ToRawInfo()
- }
- // {Name:oauth2ImplicitSecurity Type:Oauth2ImplicitSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v2 := m.GetOauth2ImplicitSecurity()
- if v2 != nil {
- return v2.ToRawInfo()
- }
- // {Name:oauth2PasswordSecurity Type:Oauth2PasswordSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v3 := m.GetOauth2PasswordSecurity()
- if v3 != nil {
- return v3.ToRawInfo()
- }
- // {Name:oauth2ApplicationSecurity Type:Oauth2ApplicationSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v4 := m.GetOauth2ApplicationSecurity()
- if v4 != nil {
- return v4.ToRawInfo()
- }
- // {Name:oauth2AccessCodeSecurity Type:Oauth2AccessCodeSecurity StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- v5 := m.GetOauth2AccessCodeSecurity()
- if v5 != nil {
- return v5.ToRawInfo()
- }
- return nil
-}
-
-// ToRawInfo returns a description of SecurityRequirement suitable for JSON or YAML export.
-func (m *SecurityRequirement) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedStringArray StringEnumValues:[] MapType:StringArray Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of StringArray suitable for JSON or YAML export.
-func (m *StringArray) ToRawInfo() interface{} {
- return m.Value
-}
-
-// ToRawInfo returns a description of Tag suitable for JSON or YAML export.
-func (m *Tag) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.Description != "" {
- info = append(info, yaml.MapItem{Key: "description", Value: m.Description})
- }
- if m.ExternalDocs != nil {
- info = append(info, yaml.MapItem{Key: "externalDocs", Value: m.ExternalDocs.ToRawInfo()})
- }
- // &{Name:externalDocs Type:ExternalDocs StringEnumValues:[] MapType: Repeated:false Pattern: Implicit:false Description:}
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of TypeItem suitable for JSON or YAML export.
-func (m *TypeItem) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if len(m.Value) != 0 {
- info = append(info, yaml.MapItem{Key: "value", Value: m.Value})
- }
- return info
-}
-
-// ToRawInfo returns a description of VendorExtension suitable for JSON or YAML export.
-func (m *VendorExtension) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.AdditionalProperties != nil {
- for _, item := range m.AdditionalProperties {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:additionalProperties Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern: Implicit:true Description:}
- return info
-}
-
-// ToRawInfo returns a description of Xml suitable for JSON or YAML export.
-func (m *Xml) ToRawInfo() interface{} {
- info := yaml.MapSlice{}
- if m.Name != "" {
- info = append(info, yaml.MapItem{Key: "name", Value: m.Name})
- }
- if m.Namespace != "" {
- info = append(info, yaml.MapItem{Key: "namespace", Value: m.Namespace})
- }
- if m.Prefix != "" {
- info = append(info, yaml.MapItem{Key: "prefix", Value: m.Prefix})
- }
- if m.Attribute != false {
- info = append(info, yaml.MapItem{Key: "attribute", Value: m.Attribute})
- }
- if m.Wrapped != false {
- info = append(info, yaml.MapItem{Key: "wrapped", Value: m.Wrapped})
- }
- if m.VendorExtension != nil {
- for _, item := range m.VendorExtension {
- info = append(info, yaml.MapItem{Key: item.Name, Value: item.Value.ToRawInfo()})
- }
- }
- // &{Name:VendorExtension Type:NamedAny StringEnumValues:[] MapType:Any Repeated:true Pattern:^x- Implicit:true Description:}
- return info
-}
-
-var (
- pattern0 = regexp.MustCompile("^x-")
- pattern1 = regexp.MustCompile("^/")
- pattern2 = regexp.MustCompile("^([0-9]{3})$|^(default)$")
-)
diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.pb.go b/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.pb.go
deleted file mode 100644
index a030fa67..00000000
--- a/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.pb.go
+++ /dev/null
@@ -1,4455 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: OpenAPIv2/OpenAPIv2.proto
-
-/*
-Package openapi_v2 is a generated protocol buffer package.
-
-It is generated from these files:
- OpenAPIv2/OpenAPIv2.proto
-
-It has these top-level messages:
- AdditionalPropertiesItem
- Any
- ApiKeySecurity
- BasicAuthenticationSecurity
- BodyParameter
- Contact
- Default
- Definitions
- Document
- Examples
- ExternalDocs
- FileSchema
- FormDataParameterSubSchema
- Header
- HeaderParameterSubSchema
- Headers
- Info
- ItemsItem
- JsonReference
- License
- NamedAny
- NamedHeader
- NamedParameter
- NamedPathItem
- NamedResponse
- NamedResponseValue
- NamedSchema
- NamedSecurityDefinitionsItem
- NamedString
- NamedStringArray
- NonBodyParameter
- Oauth2AccessCodeSecurity
- Oauth2ApplicationSecurity
- Oauth2ImplicitSecurity
- Oauth2PasswordSecurity
- Oauth2Scopes
- Operation
- Parameter
- ParameterDefinitions
- ParametersItem
- PathItem
- PathParameterSubSchema
- Paths
- PrimitivesItems
- Properties
- QueryParameterSubSchema
- Response
- ResponseDefinitions
- ResponseValue
- Responses
- Schema
- SchemaItem
- SecurityDefinitions
- SecurityDefinitionsItem
- SecurityRequirement
- StringArray
- Tag
- TypeItem
- VendorExtension
- Xml
-*/
-package openapi_v2
-
-import proto "github.com/golang/protobuf/proto"
-import fmt "fmt"
-import math "math"
-import google_protobuf "github.com/golang/protobuf/ptypes/any"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
-
-type AdditionalPropertiesItem struct {
- // Types that are valid to be assigned to Oneof:
- // *AdditionalPropertiesItem_Schema
- // *AdditionalPropertiesItem_Boolean
- Oneof isAdditionalPropertiesItem_Oneof `protobuf_oneof:"oneof"`
-}
-
-func (m *AdditionalPropertiesItem) Reset() { *m = AdditionalPropertiesItem{} }
-func (m *AdditionalPropertiesItem) String() string { return proto.CompactTextString(m) }
-func (*AdditionalPropertiesItem) ProtoMessage() {}
-func (*AdditionalPropertiesItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
-
-type isAdditionalPropertiesItem_Oneof interface {
- isAdditionalPropertiesItem_Oneof()
-}
-
-type AdditionalPropertiesItem_Schema struct {
- Schema *Schema `protobuf:"bytes,1,opt,name=schema,oneof"`
-}
-type AdditionalPropertiesItem_Boolean struct {
- Boolean bool `protobuf:"varint,2,opt,name=boolean,oneof"`
-}
-
-func (*AdditionalPropertiesItem_Schema) isAdditionalPropertiesItem_Oneof() {}
-func (*AdditionalPropertiesItem_Boolean) isAdditionalPropertiesItem_Oneof() {}
-
-func (m *AdditionalPropertiesItem) GetOneof() isAdditionalPropertiesItem_Oneof {
- if m != nil {
- return m.Oneof
- }
- return nil
-}
-
-func (m *AdditionalPropertiesItem) GetSchema() *Schema {
- if x, ok := m.GetOneof().(*AdditionalPropertiesItem_Schema); ok {
- return x.Schema
- }
- return nil
-}
-
-func (m *AdditionalPropertiesItem) GetBoolean() bool {
- if x, ok := m.GetOneof().(*AdditionalPropertiesItem_Boolean); ok {
- return x.Boolean
- }
- return false
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*AdditionalPropertiesItem) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
- return _AdditionalPropertiesItem_OneofMarshaler, _AdditionalPropertiesItem_OneofUnmarshaler, _AdditionalPropertiesItem_OneofSizer, []interface{}{
- (*AdditionalPropertiesItem_Schema)(nil),
- (*AdditionalPropertiesItem_Boolean)(nil),
- }
-}
-
-func _AdditionalPropertiesItem_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*AdditionalPropertiesItem)
- // oneof
- switch x := m.Oneof.(type) {
- case *AdditionalPropertiesItem_Schema:
- b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.Schema); err != nil {
- return err
- }
- case *AdditionalPropertiesItem_Boolean:
- t := uint64(0)
- if x.Boolean {
- t = 1
- }
- b.EncodeVarint(2<<3 | proto.WireVarint)
- b.EncodeVarint(t)
- case nil:
- default:
- return fmt.Errorf("AdditionalPropertiesItem.Oneof has unexpected type %T", x)
- }
- return nil
-}
-
-func _AdditionalPropertiesItem_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*AdditionalPropertiesItem)
- switch tag {
- case 1: // oneof.schema
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(Schema)
- err := b.DecodeMessage(msg)
- m.Oneof = &AdditionalPropertiesItem_Schema{msg}
- return true, err
- case 2: // oneof.boolean
- if wire != proto.WireVarint {
- return true, proto.ErrInternalBadWireType
- }
- x, err := b.DecodeVarint()
- m.Oneof = &AdditionalPropertiesItem_Boolean{x != 0}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _AdditionalPropertiesItem_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*AdditionalPropertiesItem)
- // oneof
- switch x := m.Oneof.(type) {
- case *AdditionalPropertiesItem_Schema:
- s := proto.Size(x.Schema)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *AdditionalPropertiesItem_Boolean:
- n += proto.SizeVarint(2<<3 | proto.WireVarint)
- n += 1
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-type Any struct {
- Value *google_protobuf.Any `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
- Yaml string `protobuf:"bytes,2,opt,name=yaml" json:"yaml,omitempty"`
-}
-
-func (m *Any) Reset() { *m = Any{} }
-func (m *Any) String() string { return proto.CompactTextString(m) }
-func (*Any) ProtoMessage() {}
-func (*Any) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
-
-func (m *Any) GetValue() *google_protobuf.Any {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-func (m *Any) GetYaml() string {
- if m != nil {
- return m.Yaml
- }
- return ""
-}
-
-type ApiKeySecurity struct {
- Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
- Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
- In string `protobuf:"bytes,3,opt,name=in" json:"in,omitempty"`
- Description string `protobuf:"bytes,4,opt,name=description" json:"description,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *ApiKeySecurity) Reset() { *m = ApiKeySecurity{} }
-func (m *ApiKeySecurity) String() string { return proto.CompactTextString(m) }
-func (*ApiKeySecurity) ProtoMessage() {}
-func (*ApiKeySecurity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
-
-func (m *ApiKeySecurity) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *ApiKeySecurity) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *ApiKeySecurity) GetIn() string {
- if m != nil {
- return m.In
- }
- return ""
-}
-
-func (m *ApiKeySecurity) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *ApiKeySecurity) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type BasicAuthenticationSecurity struct {
- Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
- Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *BasicAuthenticationSecurity) Reset() { *m = BasicAuthenticationSecurity{} }
-func (m *BasicAuthenticationSecurity) String() string { return proto.CompactTextString(m) }
-func (*BasicAuthenticationSecurity) ProtoMessage() {}
-func (*BasicAuthenticationSecurity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
-
-func (m *BasicAuthenticationSecurity) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *BasicAuthenticationSecurity) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *BasicAuthenticationSecurity) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type BodyParameter struct {
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"`
- // The name of the parameter.
- Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
- // Determines the location of the parameter.
- In string `protobuf:"bytes,3,opt,name=in" json:"in,omitempty"`
- // Determines whether or not this parameter is required or optional.
- Required bool `protobuf:"varint,4,opt,name=required" json:"required,omitempty"`
- Schema *Schema `protobuf:"bytes,5,opt,name=schema" json:"schema,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *BodyParameter) Reset() { *m = BodyParameter{} }
-func (m *BodyParameter) String() string { return proto.CompactTextString(m) }
-func (*BodyParameter) ProtoMessage() {}
-func (*BodyParameter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
-
-func (m *BodyParameter) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *BodyParameter) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *BodyParameter) GetIn() string {
- if m != nil {
- return m.In
- }
- return ""
-}
-
-func (m *BodyParameter) GetRequired() bool {
- if m != nil {
- return m.Required
- }
- return false
-}
-
-func (m *BodyParameter) GetSchema() *Schema {
- if m != nil {
- return m.Schema
- }
- return nil
-}
-
-func (m *BodyParameter) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-// Contact information for the owners of the API.
-type Contact struct {
- // The identifying name of the contact person/organization.
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // The URL pointing to the contact information.
- Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"`
- // The email address of the contact person/organization.
- Email string `protobuf:"bytes,3,opt,name=email" json:"email,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Contact) Reset() { *m = Contact{} }
-func (m *Contact) String() string { return proto.CompactTextString(m) }
-func (*Contact) ProtoMessage() {}
-func (*Contact) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
-
-func (m *Contact) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *Contact) GetUrl() string {
- if m != nil {
- return m.Url
- }
- return ""
-}
-
-func (m *Contact) GetEmail() string {
- if m != nil {
- return m.Email
- }
- return ""
-}
-
-func (m *Contact) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Default struct {
- AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *Default) Reset() { *m = Default{} }
-func (m *Default) String() string { return proto.CompactTextString(m) }
-func (*Default) ProtoMessage() {}
-func (*Default) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
-
-func (m *Default) GetAdditionalProperties() []*NamedAny {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-// One or more JSON objects describing the schemas being consumed and produced by the API.
-type Definitions struct {
- AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *Definitions) Reset() { *m = Definitions{} }
-func (m *Definitions) String() string { return proto.CompactTextString(m) }
-func (*Definitions) ProtoMessage() {}
-func (*Definitions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
-
-func (m *Definitions) GetAdditionalProperties() []*NamedSchema {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-type Document struct {
- // The Swagger version of this document.
- Swagger string `protobuf:"bytes,1,opt,name=swagger" json:"swagger,omitempty"`
- Info *Info `protobuf:"bytes,2,opt,name=info" json:"info,omitempty"`
- // The host (name or ip) of the API. Example: 'swagger.io'
- Host string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"`
- // The base path to the API. Example: '/api'.
- BasePath string `protobuf:"bytes,4,opt,name=base_path,json=basePath" json:"base_path,omitempty"`
- // The transfer protocol of the API.
- Schemes []string `protobuf:"bytes,5,rep,name=schemes" json:"schemes,omitempty"`
- // A list of MIME types accepted by the API.
- Consumes []string `protobuf:"bytes,6,rep,name=consumes" json:"consumes,omitempty"`
- // A list of MIME types the API can produce.
- Produces []string `protobuf:"bytes,7,rep,name=produces" json:"produces,omitempty"`
- Paths *Paths `protobuf:"bytes,8,opt,name=paths" json:"paths,omitempty"`
- Definitions *Definitions `protobuf:"bytes,9,opt,name=definitions" json:"definitions,omitempty"`
- Parameters *ParameterDefinitions `protobuf:"bytes,10,opt,name=parameters" json:"parameters,omitempty"`
- Responses *ResponseDefinitions `protobuf:"bytes,11,opt,name=responses" json:"responses,omitempty"`
- Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"`
- SecurityDefinitions *SecurityDefinitions `protobuf:"bytes,13,opt,name=security_definitions,json=securityDefinitions" json:"security_definitions,omitempty"`
- Tags []*Tag `protobuf:"bytes,14,rep,name=tags" json:"tags,omitempty"`
- ExternalDocs *ExternalDocs `protobuf:"bytes,15,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,16,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Document) Reset() { *m = Document{} }
-func (m *Document) String() string { return proto.CompactTextString(m) }
-func (*Document) ProtoMessage() {}
-func (*Document) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
-
-func (m *Document) GetSwagger() string {
- if m != nil {
- return m.Swagger
- }
- return ""
-}
-
-func (m *Document) GetInfo() *Info {
- if m != nil {
- return m.Info
- }
- return nil
-}
-
-func (m *Document) GetHost() string {
- if m != nil {
- return m.Host
- }
- return ""
-}
-
-func (m *Document) GetBasePath() string {
- if m != nil {
- return m.BasePath
- }
- return ""
-}
-
-func (m *Document) GetSchemes() []string {
- if m != nil {
- return m.Schemes
- }
- return nil
-}
-
-func (m *Document) GetConsumes() []string {
- if m != nil {
- return m.Consumes
- }
- return nil
-}
-
-func (m *Document) GetProduces() []string {
- if m != nil {
- return m.Produces
- }
- return nil
-}
-
-func (m *Document) GetPaths() *Paths {
- if m != nil {
- return m.Paths
- }
- return nil
-}
-
-func (m *Document) GetDefinitions() *Definitions {
- if m != nil {
- return m.Definitions
- }
- return nil
-}
-
-func (m *Document) GetParameters() *ParameterDefinitions {
- if m != nil {
- return m.Parameters
- }
- return nil
-}
-
-func (m *Document) GetResponses() *ResponseDefinitions {
- if m != nil {
- return m.Responses
- }
- return nil
-}
-
-func (m *Document) GetSecurity() []*SecurityRequirement {
- if m != nil {
- return m.Security
- }
- return nil
-}
-
-func (m *Document) GetSecurityDefinitions() *SecurityDefinitions {
- if m != nil {
- return m.SecurityDefinitions
- }
- return nil
-}
-
-func (m *Document) GetTags() []*Tag {
- if m != nil {
- return m.Tags
- }
- return nil
-}
-
-func (m *Document) GetExternalDocs() *ExternalDocs {
- if m != nil {
- return m.ExternalDocs
- }
- return nil
-}
-
-func (m *Document) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Examples struct {
- AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *Examples) Reset() { *m = Examples{} }
-func (m *Examples) String() string { return proto.CompactTextString(m) }
-func (*Examples) ProtoMessage() {}
-func (*Examples) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
-
-func (m *Examples) GetAdditionalProperties() []*NamedAny {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-// information about external documentation
-type ExternalDocs struct {
- Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"`
- Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *ExternalDocs) Reset() { *m = ExternalDocs{} }
-func (m *ExternalDocs) String() string { return proto.CompactTextString(m) }
-func (*ExternalDocs) ProtoMessage() {}
-func (*ExternalDocs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
-
-func (m *ExternalDocs) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *ExternalDocs) GetUrl() string {
- if m != nil {
- return m.Url
- }
- return ""
-}
-
-func (m *ExternalDocs) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-// A deterministic version of a JSON Schema object.
-type FileSchema struct {
- Format string `protobuf:"bytes,1,opt,name=format" json:"format,omitempty"`
- Title string `protobuf:"bytes,2,opt,name=title" json:"title,omitempty"`
- Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
- Default *Any `protobuf:"bytes,4,opt,name=default" json:"default,omitempty"`
- Required []string `protobuf:"bytes,5,rep,name=required" json:"required,omitempty"`
- Type string `protobuf:"bytes,6,opt,name=type" json:"type,omitempty"`
- ReadOnly bool `protobuf:"varint,7,opt,name=read_only,json=readOnly" json:"read_only,omitempty"`
- ExternalDocs *ExternalDocs `protobuf:"bytes,8,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"`
- Example *Any `protobuf:"bytes,9,opt,name=example" json:"example,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *FileSchema) Reset() { *m = FileSchema{} }
-func (m *FileSchema) String() string { return proto.CompactTextString(m) }
-func (*FileSchema) ProtoMessage() {}
-func (*FileSchema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
-
-func (m *FileSchema) GetFormat() string {
- if m != nil {
- return m.Format
- }
- return ""
-}
-
-func (m *FileSchema) GetTitle() string {
- if m != nil {
- return m.Title
- }
- return ""
-}
-
-func (m *FileSchema) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *FileSchema) GetDefault() *Any {
- if m != nil {
- return m.Default
- }
- return nil
-}
-
-func (m *FileSchema) GetRequired() []string {
- if m != nil {
- return m.Required
- }
- return nil
-}
-
-func (m *FileSchema) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *FileSchema) GetReadOnly() bool {
- if m != nil {
- return m.ReadOnly
- }
- return false
-}
-
-func (m *FileSchema) GetExternalDocs() *ExternalDocs {
- if m != nil {
- return m.ExternalDocs
- }
- return nil
-}
-
-func (m *FileSchema) GetExample() *Any {
- if m != nil {
- return m.Example
- }
- return nil
-}
-
-func (m *FileSchema) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type FormDataParameterSubSchema struct {
- // Determines whether or not this parameter is required or optional.
- Required bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"`
- // Determines the location of the parameter.
- In string `protobuf:"bytes,2,opt,name=in" json:"in,omitempty"`
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
- // The name of the parameter.
- Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"`
- // allows sending a parameter by name only or with an empty value.
- AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue" json:"allow_empty_value,omitempty"`
- Type string `protobuf:"bytes,6,opt,name=type" json:"type,omitempty"`
- Format string `protobuf:"bytes,7,opt,name=format" json:"format,omitempty"`
- Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items" json:"items,omitempty"`
- CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat" json:"collection_format,omitempty"`
- Default *Any `protobuf:"bytes,10,opt,name=default" json:"default,omitempty"`
- Maximum float64 `protobuf:"fixed64,11,opt,name=maximum" json:"maximum,omitempty"`
- ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"`
- Minimum float64 `protobuf:"fixed64,13,opt,name=minimum" json:"minimum,omitempty"`
- ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"`
- MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength" json:"max_length,omitempty"`
- MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength" json:"min_length,omitempty"`
- Pattern string `protobuf:"bytes,17,opt,name=pattern" json:"pattern,omitempty"`
- MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems" json:"max_items,omitempty"`
- MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems" json:"min_items,omitempty"`
- UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"`
- Enum []*Any `protobuf:"bytes,21,rep,name=enum" json:"enum,omitempty"`
- MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *FormDataParameterSubSchema) Reset() { *m = FormDataParameterSubSchema{} }
-func (m *FormDataParameterSubSchema) String() string { return proto.CompactTextString(m) }
-func (*FormDataParameterSubSchema) ProtoMessage() {}
-func (*FormDataParameterSubSchema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
-
-func (m *FormDataParameterSubSchema) GetRequired() bool {
- if m != nil {
- return m.Required
- }
- return false
-}
-
-func (m *FormDataParameterSubSchema) GetIn() string {
- if m != nil {
- return m.In
- }
- return ""
-}
-
-func (m *FormDataParameterSubSchema) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *FormDataParameterSubSchema) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *FormDataParameterSubSchema) GetAllowEmptyValue() bool {
- if m != nil {
- return m.AllowEmptyValue
- }
- return false
-}
-
-func (m *FormDataParameterSubSchema) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *FormDataParameterSubSchema) GetFormat() string {
- if m != nil {
- return m.Format
- }
- return ""
-}
-
-func (m *FormDataParameterSubSchema) GetItems() *PrimitivesItems {
- if m != nil {
- return m.Items
- }
- return nil
-}
-
-func (m *FormDataParameterSubSchema) GetCollectionFormat() string {
- if m != nil {
- return m.CollectionFormat
- }
- return ""
-}
-
-func (m *FormDataParameterSubSchema) GetDefault() *Any {
- if m != nil {
- return m.Default
- }
- return nil
-}
-
-func (m *FormDataParameterSubSchema) GetMaximum() float64 {
- if m != nil {
- return m.Maximum
- }
- return 0
-}
-
-func (m *FormDataParameterSubSchema) GetExclusiveMaximum() bool {
- if m != nil {
- return m.ExclusiveMaximum
- }
- return false
-}
-
-func (m *FormDataParameterSubSchema) GetMinimum() float64 {
- if m != nil {
- return m.Minimum
- }
- return 0
-}
-
-func (m *FormDataParameterSubSchema) GetExclusiveMinimum() bool {
- if m != nil {
- return m.ExclusiveMinimum
- }
- return false
-}
-
-func (m *FormDataParameterSubSchema) GetMaxLength() int64 {
- if m != nil {
- return m.MaxLength
- }
- return 0
-}
-
-func (m *FormDataParameterSubSchema) GetMinLength() int64 {
- if m != nil {
- return m.MinLength
- }
- return 0
-}
-
-func (m *FormDataParameterSubSchema) GetPattern() string {
- if m != nil {
- return m.Pattern
- }
- return ""
-}
-
-func (m *FormDataParameterSubSchema) GetMaxItems() int64 {
- if m != nil {
- return m.MaxItems
- }
- return 0
-}
-
-func (m *FormDataParameterSubSchema) GetMinItems() int64 {
- if m != nil {
- return m.MinItems
- }
- return 0
-}
-
-func (m *FormDataParameterSubSchema) GetUniqueItems() bool {
- if m != nil {
- return m.UniqueItems
- }
- return false
-}
-
-func (m *FormDataParameterSubSchema) GetEnum() []*Any {
- if m != nil {
- return m.Enum
- }
- return nil
-}
-
-func (m *FormDataParameterSubSchema) GetMultipleOf() float64 {
- if m != nil {
- return m.MultipleOf
- }
- return 0
-}
-
-func (m *FormDataParameterSubSchema) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Header struct {
- Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
- Format string `protobuf:"bytes,2,opt,name=format" json:"format,omitempty"`
- Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items" json:"items,omitempty"`
- CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat" json:"collection_format,omitempty"`
- Default *Any `protobuf:"bytes,5,opt,name=default" json:"default,omitempty"`
- Maximum float64 `protobuf:"fixed64,6,opt,name=maximum" json:"maximum,omitempty"`
- ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"`
- Minimum float64 `protobuf:"fixed64,8,opt,name=minimum" json:"minimum,omitempty"`
- ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"`
- MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength" json:"max_length,omitempty"`
- MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength" json:"min_length,omitempty"`
- Pattern string `protobuf:"bytes,12,opt,name=pattern" json:"pattern,omitempty"`
- MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems" json:"max_items,omitempty"`
- MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems" json:"min_items,omitempty"`
- UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"`
- Enum []*Any `protobuf:"bytes,16,rep,name=enum" json:"enum,omitempty"`
- MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"`
- Description string `protobuf:"bytes,18,opt,name=description" json:"description,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,19,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Header) Reset() { *m = Header{} }
-func (m *Header) String() string { return proto.CompactTextString(m) }
-func (*Header) ProtoMessage() {}
-func (*Header) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
-
-func (m *Header) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *Header) GetFormat() string {
- if m != nil {
- return m.Format
- }
- return ""
-}
-
-func (m *Header) GetItems() *PrimitivesItems {
- if m != nil {
- return m.Items
- }
- return nil
-}
-
-func (m *Header) GetCollectionFormat() string {
- if m != nil {
- return m.CollectionFormat
- }
- return ""
-}
-
-func (m *Header) GetDefault() *Any {
- if m != nil {
- return m.Default
- }
- return nil
-}
-
-func (m *Header) GetMaximum() float64 {
- if m != nil {
- return m.Maximum
- }
- return 0
-}
-
-func (m *Header) GetExclusiveMaximum() bool {
- if m != nil {
- return m.ExclusiveMaximum
- }
- return false
-}
-
-func (m *Header) GetMinimum() float64 {
- if m != nil {
- return m.Minimum
- }
- return 0
-}
-
-func (m *Header) GetExclusiveMinimum() bool {
- if m != nil {
- return m.ExclusiveMinimum
- }
- return false
-}
-
-func (m *Header) GetMaxLength() int64 {
- if m != nil {
- return m.MaxLength
- }
- return 0
-}
-
-func (m *Header) GetMinLength() int64 {
- if m != nil {
- return m.MinLength
- }
- return 0
-}
-
-func (m *Header) GetPattern() string {
- if m != nil {
- return m.Pattern
- }
- return ""
-}
-
-func (m *Header) GetMaxItems() int64 {
- if m != nil {
- return m.MaxItems
- }
- return 0
-}
-
-func (m *Header) GetMinItems() int64 {
- if m != nil {
- return m.MinItems
- }
- return 0
-}
-
-func (m *Header) GetUniqueItems() bool {
- if m != nil {
- return m.UniqueItems
- }
- return false
-}
-
-func (m *Header) GetEnum() []*Any {
- if m != nil {
- return m.Enum
- }
- return nil
-}
-
-func (m *Header) GetMultipleOf() float64 {
- if m != nil {
- return m.MultipleOf
- }
- return 0
-}
-
-func (m *Header) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Header) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type HeaderParameterSubSchema struct {
- // Determines whether or not this parameter is required or optional.
- Required bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"`
- // Determines the location of the parameter.
- In string `protobuf:"bytes,2,opt,name=in" json:"in,omitempty"`
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
- // The name of the parameter.
- Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"`
- Type string `protobuf:"bytes,5,opt,name=type" json:"type,omitempty"`
- Format string `protobuf:"bytes,6,opt,name=format" json:"format,omitempty"`
- Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items" json:"items,omitempty"`
- CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat" json:"collection_format,omitempty"`
- Default *Any `protobuf:"bytes,9,opt,name=default" json:"default,omitempty"`
- Maximum float64 `protobuf:"fixed64,10,opt,name=maximum" json:"maximum,omitempty"`
- ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"`
- Minimum float64 `protobuf:"fixed64,12,opt,name=minimum" json:"minimum,omitempty"`
- ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"`
- MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength" json:"max_length,omitempty"`
- MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength" json:"min_length,omitempty"`
- Pattern string `protobuf:"bytes,16,opt,name=pattern" json:"pattern,omitempty"`
- MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems" json:"max_items,omitempty"`
- MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems" json:"min_items,omitempty"`
- UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"`
- Enum []*Any `protobuf:"bytes,20,rep,name=enum" json:"enum,omitempty"`
- MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *HeaderParameterSubSchema) Reset() { *m = HeaderParameterSubSchema{} }
-func (m *HeaderParameterSubSchema) String() string { return proto.CompactTextString(m) }
-func (*HeaderParameterSubSchema) ProtoMessage() {}
-func (*HeaderParameterSubSchema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
-
-func (m *HeaderParameterSubSchema) GetRequired() bool {
- if m != nil {
- return m.Required
- }
- return false
-}
-
-func (m *HeaderParameterSubSchema) GetIn() string {
- if m != nil {
- return m.In
- }
- return ""
-}
-
-func (m *HeaderParameterSubSchema) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *HeaderParameterSubSchema) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *HeaderParameterSubSchema) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *HeaderParameterSubSchema) GetFormat() string {
- if m != nil {
- return m.Format
- }
- return ""
-}
-
-func (m *HeaderParameterSubSchema) GetItems() *PrimitivesItems {
- if m != nil {
- return m.Items
- }
- return nil
-}
-
-func (m *HeaderParameterSubSchema) GetCollectionFormat() string {
- if m != nil {
- return m.CollectionFormat
- }
- return ""
-}
-
-func (m *HeaderParameterSubSchema) GetDefault() *Any {
- if m != nil {
- return m.Default
- }
- return nil
-}
-
-func (m *HeaderParameterSubSchema) GetMaximum() float64 {
- if m != nil {
- return m.Maximum
- }
- return 0
-}
-
-func (m *HeaderParameterSubSchema) GetExclusiveMaximum() bool {
- if m != nil {
- return m.ExclusiveMaximum
- }
- return false
-}
-
-func (m *HeaderParameterSubSchema) GetMinimum() float64 {
- if m != nil {
- return m.Minimum
- }
- return 0
-}
-
-func (m *HeaderParameterSubSchema) GetExclusiveMinimum() bool {
- if m != nil {
- return m.ExclusiveMinimum
- }
- return false
-}
-
-func (m *HeaderParameterSubSchema) GetMaxLength() int64 {
- if m != nil {
- return m.MaxLength
- }
- return 0
-}
-
-func (m *HeaderParameterSubSchema) GetMinLength() int64 {
- if m != nil {
- return m.MinLength
- }
- return 0
-}
-
-func (m *HeaderParameterSubSchema) GetPattern() string {
- if m != nil {
- return m.Pattern
- }
- return ""
-}
-
-func (m *HeaderParameterSubSchema) GetMaxItems() int64 {
- if m != nil {
- return m.MaxItems
- }
- return 0
-}
-
-func (m *HeaderParameterSubSchema) GetMinItems() int64 {
- if m != nil {
- return m.MinItems
- }
- return 0
-}
-
-func (m *HeaderParameterSubSchema) GetUniqueItems() bool {
- if m != nil {
- return m.UniqueItems
- }
- return false
-}
-
-func (m *HeaderParameterSubSchema) GetEnum() []*Any {
- if m != nil {
- return m.Enum
- }
- return nil
-}
-
-func (m *HeaderParameterSubSchema) GetMultipleOf() float64 {
- if m != nil {
- return m.MultipleOf
- }
- return 0
-}
-
-func (m *HeaderParameterSubSchema) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Headers struct {
- AdditionalProperties []*NamedHeader `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *Headers) Reset() { *m = Headers{} }
-func (m *Headers) String() string { return proto.CompactTextString(m) }
-func (*Headers) ProtoMessage() {}
-func (*Headers) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
-
-func (m *Headers) GetAdditionalProperties() []*NamedHeader {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-// General information about the API.
-type Info struct {
- // A unique and precise title of the API.
- Title string `protobuf:"bytes,1,opt,name=title" json:"title,omitempty"`
- // A semantic version number of the API.
- Version string `protobuf:"bytes,2,opt,name=version" json:"version,omitempty"`
- // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.
- Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
- // The terms of service for the API.
- TermsOfService string `protobuf:"bytes,4,opt,name=terms_of_service,json=termsOfService" json:"terms_of_service,omitempty"`
- Contact *Contact `protobuf:"bytes,5,opt,name=contact" json:"contact,omitempty"`
- License *License `protobuf:"bytes,6,opt,name=license" json:"license,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Info) Reset() { *m = Info{} }
-func (m *Info) String() string { return proto.CompactTextString(m) }
-func (*Info) ProtoMessage() {}
-func (*Info) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
-
-func (m *Info) GetTitle() string {
- if m != nil {
- return m.Title
- }
- return ""
-}
-
-func (m *Info) GetVersion() string {
- if m != nil {
- return m.Version
- }
- return ""
-}
-
-func (m *Info) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Info) GetTermsOfService() string {
- if m != nil {
- return m.TermsOfService
- }
- return ""
-}
-
-func (m *Info) GetContact() *Contact {
- if m != nil {
- return m.Contact
- }
- return nil
-}
-
-func (m *Info) GetLicense() *License {
- if m != nil {
- return m.License
- }
- return nil
-}
-
-func (m *Info) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type ItemsItem struct {
- Schema []*Schema `protobuf:"bytes,1,rep,name=schema" json:"schema,omitempty"`
-}
-
-func (m *ItemsItem) Reset() { *m = ItemsItem{} }
-func (m *ItemsItem) String() string { return proto.CompactTextString(m) }
-func (*ItemsItem) ProtoMessage() {}
-func (*ItemsItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
-
-func (m *ItemsItem) GetSchema() []*Schema {
- if m != nil {
- return m.Schema
- }
- return nil
-}
-
-type JsonReference struct {
- XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref" json:"_ref,omitempty"`
- Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"`
-}
-
-func (m *JsonReference) Reset() { *m = JsonReference{} }
-func (m *JsonReference) String() string { return proto.CompactTextString(m) }
-func (*JsonReference) ProtoMessage() {}
-func (*JsonReference) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
-
-func (m *JsonReference) GetXRef() string {
- if m != nil {
- return m.XRef
- }
- return ""
-}
-
-func (m *JsonReference) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-type License struct {
- // The name of the license type. It's encouraged to use an OSI compatible license.
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // The URL pointing to the license.
- Url string `protobuf:"bytes,2,opt,name=url" json:"url,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,3,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *License) Reset() { *m = License{} }
-func (m *License) String() string { return proto.CompactTextString(m) }
-func (*License) ProtoMessage() {}
-func (*License) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
-
-func (m *License) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *License) GetUrl() string {
- if m != nil {
- return m.Url
- }
- return ""
-}
-
-func (m *License) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
-type NamedAny struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *Any `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedAny) Reset() { *m = NamedAny{} }
-func (m *NamedAny) String() string { return proto.CompactTextString(m) }
-func (*NamedAny) ProtoMessage() {}
-func (*NamedAny) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
-
-func (m *NamedAny) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedAny) GetValue() *Any {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs.
-type NamedHeader struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *Header `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedHeader) Reset() { *m = NamedHeader{} }
-func (m *NamedHeader) String() string { return proto.CompactTextString(m) }
-func (*NamedHeader) ProtoMessage() {}
-func (*NamedHeader) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
-
-func (m *NamedHeader) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedHeader) GetValue() *Header {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs.
-type NamedParameter struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *Parameter `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedParameter) Reset() { *m = NamedParameter{} }
-func (m *NamedParameter) String() string { return proto.CompactTextString(m) }
-func (*NamedParameter) ProtoMessage() {}
-func (*NamedParameter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
-
-func (m *NamedParameter) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedParameter) GetValue() *Parameter {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
-type NamedPathItem struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *PathItem `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedPathItem) Reset() { *m = NamedPathItem{} }
-func (m *NamedPathItem) String() string { return proto.CompactTextString(m) }
-func (*NamedPathItem) ProtoMessage() {}
-func (*NamedPathItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
-
-func (m *NamedPathItem) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedPathItem) GetValue() *PathItem {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs.
-type NamedResponse struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *Response `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedResponse) Reset() { *m = NamedResponse{} }
-func (m *NamedResponse) String() string { return proto.CompactTextString(m) }
-func (*NamedResponse) ProtoMessage() {}
-func (*NamedResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
-
-func (m *NamedResponse) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedResponse) GetValue() *Response {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs.
-type NamedResponseValue struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *ResponseValue `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedResponseValue) Reset() { *m = NamedResponseValue{} }
-func (m *NamedResponseValue) String() string { return proto.CompactTextString(m) }
-func (*NamedResponseValue) ProtoMessage() {}
-func (*NamedResponseValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
-
-func (m *NamedResponseValue) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedResponseValue) GetValue() *ResponseValue {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs.
-type NamedSchema struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *Schema `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedSchema) Reset() { *m = NamedSchema{} }
-func (m *NamedSchema) String() string { return proto.CompactTextString(m) }
-func (*NamedSchema) ProtoMessage() {}
-func (*NamedSchema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
-
-func (m *NamedSchema) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedSchema) GetValue() *Schema {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs.
-type NamedSecurityDefinitionsItem struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *SecurityDefinitionsItem `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedSecurityDefinitionsItem) Reset() { *m = NamedSecurityDefinitionsItem{} }
-func (m *NamedSecurityDefinitionsItem) String() string { return proto.CompactTextString(m) }
-func (*NamedSecurityDefinitionsItem) ProtoMessage() {}
-func (*NamedSecurityDefinitionsItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
-
-func (m *NamedSecurityDefinitionsItem) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedSecurityDefinitionsItem) GetValue() *SecurityDefinitionsItem {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
-type NamedString struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value string `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedString) Reset() { *m = NamedString{} }
-func (m *NamedString) String() string { return proto.CompactTextString(m) }
-func (*NamedString) ProtoMessage() {}
-func (*NamedString) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
-
-func (m *NamedString) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedString) GetValue() string {
- if m != nil {
- return m.Value
- }
- return ""
-}
-
-// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
-type NamedStringArray struct {
- // Map key
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- // Mapped value
- Value *StringArray `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *NamedStringArray) Reset() { *m = NamedStringArray{} }
-func (m *NamedStringArray) String() string { return proto.CompactTextString(m) }
-func (*NamedStringArray) ProtoMessage() {}
-func (*NamedStringArray) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
-
-func (m *NamedStringArray) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *NamedStringArray) GetValue() *StringArray {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-type NonBodyParameter struct {
- // Types that are valid to be assigned to Oneof:
- // *NonBodyParameter_HeaderParameterSubSchema
- // *NonBodyParameter_FormDataParameterSubSchema
- // *NonBodyParameter_QueryParameterSubSchema
- // *NonBodyParameter_PathParameterSubSchema
- Oneof isNonBodyParameter_Oneof `protobuf_oneof:"oneof"`
-}
-
-func (m *NonBodyParameter) Reset() { *m = NonBodyParameter{} }
-func (m *NonBodyParameter) String() string { return proto.CompactTextString(m) }
-func (*NonBodyParameter) ProtoMessage() {}
-func (*NonBodyParameter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
-
-type isNonBodyParameter_Oneof interface {
- isNonBodyParameter_Oneof()
-}
-
-type NonBodyParameter_HeaderParameterSubSchema struct {
- HeaderParameterSubSchema *HeaderParameterSubSchema `protobuf:"bytes,1,opt,name=header_parameter_sub_schema,json=headerParameterSubSchema,oneof"`
-}
-type NonBodyParameter_FormDataParameterSubSchema struct {
- FormDataParameterSubSchema *FormDataParameterSubSchema `protobuf:"bytes,2,opt,name=form_data_parameter_sub_schema,json=formDataParameterSubSchema,oneof"`
-}
-type NonBodyParameter_QueryParameterSubSchema struct {
- QueryParameterSubSchema *QueryParameterSubSchema `protobuf:"bytes,3,opt,name=query_parameter_sub_schema,json=queryParameterSubSchema,oneof"`
-}
-type NonBodyParameter_PathParameterSubSchema struct {
- PathParameterSubSchema *PathParameterSubSchema `protobuf:"bytes,4,opt,name=path_parameter_sub_schema,json=pathParameterSubSchema,oneof"`
-}
-
-func (*NonBodyParameter_HeaderParameterSubSchema) isNonBodyParameter_Oneof() {}
-func (*NonBodyParameter_FormDataParameterSubSchema) isNonBodyParameter_Oneof() {}
-func (*NonBodyParameter_QueryParameterSubSchema) isNonBodyParameter_Oneof() {}
-func (*NonBodyParameter_PathParameterSubSchema) isNonBodyParameter_Oneof() {}
-
-func (m *NonBodyParameter) GetOneof() isNonBodyParameter_Oneof {
- if m != nil {
- return m.Oneof
- }
- return nil
-}
-
-func (m *NonBodyParameter) GetHeaderParameterSubSchema() *HeaderParameterSubSchema {
- if x, ok := m.GetOneof().(*NonBodyParameter_HeaderParameterSubSchema); ok {
- return x.HeaderParameterSubSchema
- }
- return nil
-}
-
-func (m *NonBodyParameter) GetFormDataParameterSubSchema() *FormDataParameterSubSchema {
- if x, ok := m.GetOneof().(*NonBodyParameter_FormDataParameterSubSchema); ok {
- return x.FormDataParameterSubSchema
- }
- return nil
-}
-
-func (m *NonBodyParameter) GetQueryParameterSubSchema() *QueryParameterSubSchema {
- if x, ok := m.GetOneof().(*NonBodyParameter_QueryParameterSubSchema); ok {
- return x.QueryParameterSubSchema
- }
- return nil
-}
-
-func (m *NonBodyParameter) GetPathParameterSubSchema() *PathParameterSubSchema {
- if x, ok := m.GetOneof().(*NonBodyParameter_PathParameterSubSchema); ok {
- return x.PathParameterSubSchema
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*NonBodyParameter) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
- return _NonBodyParameter_OneofMarshaler, _NonBodyParameter_OneofUnmarshaler, _NonBodyParameter_OneofSizer, []interface{}{
- (*NonBodyParameter_HeaderParameterSubSchema)(nil),
- (*NonBodyParameter_FormDataParameterSubSchema)(nil),
- (*NonBodyParameter_QueryParameterSubSchema)(nil),
- (*NonBodyParameter_PathParameterSubSchema)(nil),
- }
-}
-
-func _NonBodyParameter_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*NonBodyParameter)
- // oneof
- switch x := m.Oneof.(type) {
- case *NonBodyParameter_HeaderParameterSubSchema:
- b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.HeaderParameterSubSchema); err != nil {
- return err
- }
- case *NonBodyParameter_FormDataParameterSubSchema:
- b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.FormDataParameterSubSchema); err != nil {
- return err
- }
- case *NonBodyParameter_QueryParameterSubSchema:
- b.EncodeVarint(3<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.QueryParameterSubSchema); err != nil {
- return err
- }
- case *NonBodyParameter_PathParameterSubSchema:
- b.EncodeVarint(4<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.PathParameterSubSchema); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("NonBodyParameter.Oneof has unexpected type %T", x)
- }
- return nil
-}
-
-func _NonBodyParameter_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*NonBodyParameter)
- switch tag {
- case 1: // oneof.header_parameter_sub_schema
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(HeaderParameterSubSchema)
- err := b.DecodeMessage(msg)
- m.Oneof = &NonBodyParameter_HeaderParameterSubSchema{msg}
- return true, err
- case 2: // oneof.form_data_parameter_sub_schema
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(FormDataParameterSubSchema)
- err := b.DecodeMessage(msg)
- m.Oneof = &NonBodyParameter_FormDataParameterSubSchema{msg}
- return true, err
- case 3: // oneof.query_parameter_sub_schema
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(QueryParameterSubSchema)
- err := b.DecodeMessage(msg)
- m.Oneof = &NonBodyParameter_QueryParameterSubSchema{msg}
- return true, err
- case 4: // oneof.path_parameter_sub_schema
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(PathParameterSubSchema)
- err := b.DecodeMessage(msg)
- m.Oneof = &NonBodyParameter_PathParameterSubSchema{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _NonBodyParameter_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*NonBodyParameter)
- // oneof
- switch x := m.Oneof.(type) {
- case *NonBodyParameter_HeaderParameterSubSchema:
- s := proto.Size(x.HeaderParameterSubSchema)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *NonBodyParameter_FormDataParameterSubSchema:
- s := proto.Size(x.FormDataParameterSubSchema)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *NonBodyParameter_QueryParameterSubSchema:
- s := proto.Size(x.QueryParameterSubSchema)
- n += proto.SizeVarint(3<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *NonBodyParameter_PathParameterSubSchema:
- s := proto.Size(x.PathParameterSubSchema)
- n += proto.SizeVarint(4<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-type Oauth2AccessCodeSecurity struct {
- Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
- Flow string `protobuf:"bytes,2,opt,name=flow" json:"flow,omitempty"`
- Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes" json:"scopes,omitempty"`
- AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl" json:"authorization_url,omitempty"`
- TokenUrl string `protobuf:"bytes,5,opt,name=token_url,json=tokenUrl" json:"token_url,omitempty"`
- Description string `protobuf:"bytes,6,opt,name=description" json:"description,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,7,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Oauth2AccessCodeSecurity) Reset() { *m = Oauth2AccessCodeSecurity{} }
-func (m *Oauth2AccessCodeSecurity) String() string { return proto.CompactTextString(m) }
-func (*Oauth2AccessCodeSecurity) ProtoMessage() {}
-func (*Oauth2AccessCodeSecurity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
-
-func (m *Oauth2AccessCodeSecurity) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *Oauth2AccessCodeSecurity) GetFlow() string {
- if m != nil {
- return m.Flow
- }
- return ""
-}
-
-func (m *Oauth2AccessCodeSecurity) GetScopes() *Oauth2Scopes {
- if m != nil {
- return m.Scopes
- }
- return nil
-}
-
-func (m *Oauth2AccessCodeSecurity) GetAuthorizationUrl() string {
- if m != nil {
- return m.AuthorizationUrl
- }
- return ""
-}
-
-func (m *Oauth2AccessCodeSecurity) GetTokenUrl() string {
- if m != nil {
- return m.TokenUrl
- }
- return ""
-}
-
-func (m *Oauth2AccessCodeSecurity) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Oauth2AccessCodeSecurity) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Oauth2ApplicationSecurity struct {
- Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
- Flow string `protobuf:"bytes,2,opt,name=flow" json:"flow,omitempty"`
- Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes" json:"scopes,omitempty"`
- TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl" json:"token_url,omitempty"`
- Description string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Oauth2ApplicationSecurity) Reset() { *m = Oauth2ApplicationSecurity{} }
-func (m *Oauth2ApplicationSecurity) String() string { return proto.CompactTextString(m) }
-func (*Oauth2ApplicationSecurity) ProtoMessage() {}
-func (*Oauth2ApplicationSecurity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
-
-func (m *Oauth2ApplicationSecurity) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *Oauth2ApplicationSecurity) GetFlow() string {
- if m != nil {
- return m.Flow
- }
- return ""
-}
-
-func (m *Oauth2ApplicationSecurity) GetScopes() *Oauth2Scopes {
- if m != nil {
- return m.Scopes
- }
- return nil
-}
-
-func (m *Oauth2ApplicationSecurity) GetTokenUrl() string {
- if m != nil {
- return m.TokenUrl
- }
- return ""
-}
-
-func (m *Oauth2ApplicationSecurity) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Oauth2ApplicationSecurity) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Oauth2ImplicitSecurity struct {
- Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
- Flow string `protobuf:"bytes,2,opt,name=flow" json:"flow,omitempty"`
- Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes" json:"scopes,omitempty"`
- AuthorizationUrl string `protobuf:"bytes,4,opt,name=authorization_url,json=authorizationUrl" json:"authorization_url,omitempty"`
- Description string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Oauth2ImplicitSecurity) Reset() { *m = Oauth2ImplicitSecurity{} }
-func (m *Oauth2ImplicitSecurity) String() string { return proto.CompactTextString(m) }
-func (*Oauth2ImplicitSecurity) ProtoMessage() {}
-func (*Oauth2ImplicitSecurity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
-
-func (m *Oauth2ImplicitSecurity) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *Oauth2ImplicitSecurity) GetFlow() string {
- if m != nil {
- return m.Flow
- }
- return ""
-}
-
-func (m *Oauth2ImplicitSecurity) GetScopes() *Oauth2Scopes {
- if m != nil {
- return m.Scopes
- }
- return nil
-}
-
-func (m *Oauth2ImplicitSecurity) GetAuthorizationUrl() string {
- if m != nil {
- return m.AuthorizationUrl
- }
- return ""
-}
-
-func (m *Oauth2ImplicitSecurity) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Oauth2ImplicitSecurity) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Oauth2PasswordSecurity struct {
- Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
- Flow string `protobuf:"bytes,2,opt,name=flow" json:"flow,omitempty"`
- Scopes *Oauth2Scopes `protobuf:"bytes,3,opt,name=scopes" json:"scopes,omitempty"`
- TokenUrl string `protobuf:"bytes,4,opt,name=token_url,json=tokenUrl" json:"token_url,omitempty"`
- Description string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Oauth2PasswordSecurity) Reset() { *m = Oauth2PasswordSecurity{} }
-func (m *Oauth2PasswordSecurity) String() string { return proto.CompactTextString(m) }
-func (*Oauth2PasswordSecurity) ProtoMessage() {}
-func (*Oauth2PasswordSecurity) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} }
-
-func (m *Oauth2PasswordSecurity) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *Oauth2PasswordSecurity) GetFlow() string {
- if m != nil {
- return m.Flow
- }
- return ""
-}
-
-func (m *Oauth2PasswordSecurity) GetScopes() *Oauth2Scopes {
- if m != nil {
- return m.Scopes
- }
- return nil
-}
-
-func (m *Oauth2PasswordSecurity) GetTokenUrl() string {
- if m != nil {
- return m.TokenUrl
- }
- return ""
-}
-
-func (m *Oauth2PasswordSecurity) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Oauth2PasswordSecurity) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Oauth2Scopes struct {
- AdditionalProperties []*NamedString `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *Oauth2Scopes) Reset() { *m = Oauth2Scopes{} }
-func (m *Oauth2Scopes) String() string { return proto.CompactTextString(m) }
-func (*Oauth2Scopes) ProtoMessage() {}
-func (*Oauth2Scopes) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} }
-
-func (m *Oauth2Scopes) GetAdditionalProperties() []*NamedString {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-type Operation struct {
- Tags []string `protobuf:"bytes,1,rep,name=tags" json:"tags,omitempty"`
- // A brief summary of the operation.
- Summary string `protobuf:"bytes,2,opt,name=summary" json:"summary,omitempty"`
- // A longer description of the operation, GitHub Flavored Markdown is allowed.
- Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
- ExternalDocs *ExternalDocs `protobuf:"bytes,4,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"`
- // A unique identifier of the operation.
- OperationId string `protobuf:"bytes,5,opt,name=operation_id,json=operationId" json:"operation_id,omitempty"`
- // A list of MIME types the API can produce.
- Produces []string `protobuf:"bytes,6,rep,name=produces" json:"produces,omitempty"`
- // A list of MIME types the API can consume.
- Consumes []string `protobuf:"bytes,7,rep,name=consumes" json:"consumes,omitempty"`
- // The parameters needed to send a valid API call.
- Parameters []*ParametersItem `protobuf:"bytes,8,rep,name=parameters" json:"parameters,omitempty"`
- Responses *Responses `protobuf:"bytes,9,opt,name=responses" json:"responses,omitempty"`
- // The transfer protocol of the API.
- Schemes []string `protobuf:"bytes,10,rep,name=schemes" json:"schemes,omitempty"`
- Deprecated bool `protobuf:"varint,11,opt,name=deprecated" json:"deprecated,omitempty"`
- Security []*SecurityRequirement `protobuf:"bytes,12,rep,name=security" json:"security,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,13,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Operation) Reset() { *m = Operation{} }
-func (m *Operation) String() string { return proto.CompactTextString(m) }
-func (*Operation) ProtoMessage() {}
-func (*Operation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{36} }
-
-func (m *Operation) GetTags() []string {
- if m != nil {
- return m.Tags
- }
- return nil
-}
-
-func (m *Operation) GetSummary() string {
- if m != nil {
- return m.Summary
- }
- return ""
-}
-
-func (m *Operation) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Operation) GetExternalDocs() *ExternalDocs {
- if m != nil {
- return m.ExternalDocs
- }
- return nil
-}
-
-func (m *Operation) GetOperationId() string {
- if m != nil {
- return m.OperationId
- }
- return ""
-}
-
-func (m *Operation) GetProduces() []string {
- if m != nil {
- return m.Produces
- }
- return nil
-}
-
-func (m *Operation) GetConsumes() []string {
- if m != nil {
- return m.Consumes
- }
- return nil
-}
-
-func (m *Operation) GetParameters() []*ParametersItem {
- if m != nil {
- return m.Parameters
- }
- return nil
-}
-
-func (m *Operation) GetResponses() *Responses {
- if m != nil {
- return m.Responses
- }
- return nil
-}
-
-func (m *Operation) GetSchemes() []string {
- if m != nil {
- return m.Schemes
- }
- return nil
-}
-
-func (m *Operation) GetDeprecated() bool {
- if m != nil {
- return m.Deprecated
- }
- return false
-}
-
-func (m *Operation) GetSecurity() []*SecurityRequirement {
- if m != nil {
- return m.Security
- }
- return nil
-}
-
-func (m *Operation) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Parameter struct {
- // Types that are valid to be assigned to Oneof:
- // *Parameter_BodyParameter
- // *Parameter_NonBodyParameter
- Oneof isParameter_Oneof `protobuf_oneof:"oneof"`
-}
-
-func (m *Parameter) Reset() { *m = Parameter{} }
-func (m *Parameter) String() string { return proto.CompactTextString(m) }
-func (*Parameter) ProtoMessage() {}
-func (*Parameter) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{37} }
-
-type isParameter_Oneof interface {
- isParameter_Oneof()
-}
-
-type Parameter_BodyParameter struct {
- BodyParameter *BodyParameter `protobuf:"bytes,1,opt,name=body_parameter,json=bodyParameter,oneof"`
-}
-type Parameter_NonBodyParameter struct {
- NonBodyParameter *NonBodyParameter `protobuf:"bytes,2,opt,name=non_body_parameter,json=nonBodyParameter,oneof"`
-}
-
-func (*Parameter_BodyParameter) isParameter_Oneof() {}
-func (*Parameter_NonBodyParameter) isParameter_Oneof() {}
-
-func (m *Parameter) GetOneof() isParameter_Oneof {
- if m != nil {
- return m.Oneof
- }
- return nil
-}
-
-func (m *Parameter) GetBodyParameter() *BodyParameter {
- if x, ok := m.GetOneof().(*Parameter_BodyParameter); ok {
- return x.BodyParameter
- }
- return nil
-}
-
-func (m *Parameter) GetNonBodyParameter() *NonBodyParameter {
- if x, ok := m.GetOneof().(*Parameter_NonBodyParameter); ok {
- return x.NonBodyParameter
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*Parameter) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
- return _Parameter_OneofMarshaler, _Parameter_OneofUnmarshaler, _Parameter_OneofSizer, []interface{}{
- (*Parameter_BodyParameter)(nil),
- (*Parameter_NonBodyParameter)(nil),
- }
-}
-
-func _Parameter_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*Parameter)
- // oneof
- switch x := m.Oneof.(type) {
- case *Parameter_BodyParameter:
- b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.BodyParameter); err != nil {
- return err
- }
- case *Parameter_NonBodyParameter:
- b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.NonBodyParameter); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("Parameter.Oneof has unexpected type %T", x)
- }
- return nil
-}
-
-func _Parameter_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*Parameter)
- switch tag {
- case 1: // oneof.body_parameter
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(BodyParameter)
- err := b.DecodeMessage(msg)
- m.Oneof = &Parameter_BodyParameter{msg}
- return true, err
- case 2: // oneof.non_body_parameter
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(NonBodyParameter)
- err := b.DecodeMessage(msg)
- m.Oneof = &Parameter_NonBodyParameter{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _Parameter_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*Parameter)
- // oneof
- switch x := m.Oneof.(type) {
- case *Parameter_BodyParameter:
- s := proto.Size(x.BodyParameter)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *Parameter_NonBodyParameter:
- s := proto.Size(x.NonBodyParameter)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-// One or more JSON representations for parameters
-type ParameterDefinitions struct {
- AdditionalProperties []*NamedParameter `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *ParameterDefinitions) Reset() { *m = ParameterDefinitions{} }
-func (m *ParameterDefinitions) String() string { return proto.CompactTextString(m) }
-func (*ParameterDefinitions) ProtoMessage() {}
-func (*ParameterDefinitions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{38} }
-
-func (m *ParameterDefinitions) GetAdditionalProperties() []*NamedParameter {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-type ParametersItem struct {
- // Types that are valid to be assigned to Oneof:
- // *ParametersItem_Parameter
- // *ParametersItem_JsonReference
- Oneof isParametersItem_Oneof `protobuf_oneof:"oneof"`
-}
-
-func (m *ParametersItem) Reset() { *m = ParametersItem{} }
-func (m *ParametersItem) String() string { return proto.CompactTextString(m) }
-func (*ParametersItem) ProtoMessage() {}
-func (*ParametersItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{39} }
-
-type isParametersItem_Oneof interface {
- isParametersItem_Oneof()
-}
-
-type ParametersItem_Parameter struct {
- Parameter *Parameter `protobuf:"bytes,1,opt,name=parameter,oneof"`
-}
-type ParametersItem_JsonReference struct {
- JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,oneof"`
-}
-
-func (*ParametersItem_Parameter) isParametersItem_Oneof() {}
-func (*ParametersItem_JsonReference) isParametersItem_Oneof() {}
-
-func (m *ParametersItem) GetOneof() isParametersItem_Oneof {
- if m != nil {
- return m.Oneof
- }
- return nil
-}
-
-func (m *ParametersItem) GetParameter() *Parameter {
- if x, ok := m.GetOneof().(*ParametersItem_Parameter); ok {
- return x.Parameter
- }
- return nil
-}
-
-func (m *ParametersItem) GetJsonReference() *JsonReference {
- if x, ok := m.GetOneof().(*ParametersItem_JsonReference); ok {
- return x.JsonReference
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*ParametersItem) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
- return _ParametersItem_OneofMarshaler, _ParametersItem_OneofUnmarshaler, _ParametersItem_OneofSizer, []interface{}{
- (*ParametersItem_Parameter)(nil),
- (*ParametersItem_JsonReference)(nil),
- }
-}
-
-func _ParametersItem_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*ParametersItem)
- // oneof
- switch x := m.Oneof.(type) {
- case *ParametersItem_Parameter:
- b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.Parameter); err != nil {
- return err
- }
- case *ParametersItem_JsonReference:
- b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.JsonReference); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("ParametersItem.Oneof has unexpected type %T", x)
- }
- return nil
-}
-
-func _ParametersItem_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*ParametersItem)
- switch tag {
- case 1: // oneof.parameter
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(Parameter)
- err := b.DecodeMessage(msg)
- m.Oneof = &ParametersItem_Parameter{msg}
- return true, err
- case 2: // oneof.json_reference
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(JsonReference)
- err := b.DecodeMessage(msg)
- m.Oneof = &ParametersItem_JsonReference{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _ParametersItem_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*ParametersItem)
- // oneof
- switch x := m.Oneof.(type) {
- case *ParametersItem_Parameter:
- s := proto.Size(x.Parameter)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *ParametersItem_JsonReference:
- s := proto.Size(x.JsonReference)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-type PathItem struct {
- XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref" json:"_ref,omitempty"`
- Get *Operation `protobuf:"bytes,2,opt,name=get" json:"get,omitempty"`
- Put *Operation `protobuf:"bytes,3,opt,name=put" json:"put,omitempty"`
- Post *Operation `protobuf:"bytes,4,opt,name=post" json:"post,omitempty"`
- Delete *Operation `protobuf:"bytes,5,opt,name=delete" json:"delete,omitempty"`
- Options *Operation `protobuf:"bytes,6,opt,name=options" json:"options,omitempty"`
- Head *Operation `protobuf:"bytes,7,opt,name=head" json:"head,omitempty"`
- Patch *Operation `protobuf:"bytes,8,opt,name=patch" json:"patch,omitempty"`
- // The parameters needed to send a valid API call.
- Parameters []*ParametersItem `protobuf:"bytes,9,rep,name=parameters" json:"parameters,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,10,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *PathItem) Reset() { *m = PathItem{} }
-func (m *PathItem) String() string { return proto.CompactTextString(m) }
-func (*PathItem) ProtoMessage() {}
-func (*PathItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{40} }
-
-func (m *PathItem) GetXRef() string {
- if m != nil {
- return m.XRef
- }
- return ""
-}
-
-func (m *PathItem) GetGet() *Operation {
- if m != nil {
- return m.Get
- }
- return nil
-}
-
-func (m *PathItem) GetPut() *Operation {
- if m != nil {
- return m.Put
- }
- return nil
-}
-
-func (m *PathItem) GetPost() *Operation {
- if m != nil {
- return m.Post
- }
- return nil
-}
-
-func (m *PathItem) GetDelete() *Operation {
- if m != nil {
- return m.Delete
- }
- return nil
-}
-
-func (m *PathItem) GetOptions() *Operation {
- if m != nil {
- return m.Options
- }
- return nil
-}
-
-func (m *PathItem) GetHead() *Operation {
- if m != nil {
- return m.Head
- }
- return nil
-}
-
-func (m *PathItem) GetPatch() *Operation {
- if m != nil {
- return m.Patch
- }
- return nil
-}
-
-func (m *PathItem) GetParameters() []*ParametersItem {
- if m != nil {
- return m.Parameters
- }
- return nil
-}
-
-func (m *PathItem) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type PathParameterSubSchema struct {
- // Determines whether or not this parameter is required or optional.
- Required bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"`
- // Determines the location of the parameter.
- In string `protobuf:"bytes,2,opt,name=in" json:"in,omitempty"`
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
- // The name of the parameter.
- Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"`
- Type string `protobuf:"bytes,5,opt,name=type" json:"type,omitempty"`
- Format string `protobuf:"bytes,6,opt,name=format" json:"format,omitempty"`
- Items *PrimitivesItems `protobuf:"bytes,7,opt,name=items" json:"items,omitempty"`
- CollectionFormat string `protobuf:"bytes,8,opt,name=collection_format,json=collectionFormat" json:"collection_format,omitempty"`
- Default *Any `protobuf:"bytes,9,opt,name=default" json:"default,omitempty"`
- Maximum float64 `protobuf:"fixed64,10,opt,name=maximum" json:"maximum,omitempty"`
- ExclusiveMaximum bool `protobuf:"varint,11,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"`
- Minimum float64 `protobuf:"fixed64,12,opt,name=minimum" json:"minimum,omitempty"`
- ExclusiveMinimum bool `protobuf:"varint,13,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"`
- MaxLength int64 `protobuf:"varint,14,opt,name=max_length,json=maxLength" json:"max_length,omitempty"`
- MinLength int64 `protobuf:"varint,15,opt,name=min_length,json=minLength" json:"min_length,omitempty"`
- Pattern string `protobuf:"bytes,16,opt,name=pattern" json:"pattern,omitempty"`
- MaxItems int64 `protobuf:"varint,17,opt,name=max_items,json=maxItems" json:"max_items,omitempty"`
- MinItems int64 `protobuf:"varint,18,opt,name=min_items,json=minItems" json:"min_items,omitempty"`
- UniqueItems bool `protobuf:"varint,19,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"`
- Enum []*Any `protobuf:"bytes,20,rep,name=enum" json:"enum,omitempty"`
- MultipleOf float64 `protobuf:"fixed64,21,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,22,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *PathParameterSubSchema) Reset() { *m = PathParameterSubSchema{} }
-func (m *PathParameterSubSchema) String() string { return proto.CompactTextString(m) }
-func (*PathParameterSubSchema) ProtoMessage() {}
-func (*PathParameterSubSchema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{41} }
-
-func (m *PathParameterSubSchema) GetRequired() bool {
- if m != nil {
- return m.Required
- }
- return false
-}
-
-func (m *PathParameterSubSchema) GetIn() string {
- if m != nil {
- return m.In
- }
- return ""
-}
-
-func (m *PathParameterSubSchema) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *PathParameterSubSchema) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *PathParameterSubSchema) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *PathParameterSubSchema) GetFormat() string {
- if m != nil {
- return m.Format
- }
- return ""
-}
-
-func (m *PathParameterSubSchema) GetItems() *PrimitivesItems {
- if m != nil {
- return m.Items
- }
- return nil
-}
-
-func (m *PathParameterSubSchema) GetCollectionFormat() string {
- if m != nil {
- return m.CollectionFormat
- }
- return ""
-}
-
-func (m *PathParameterSubSchema) GetDefault() *Any {
- if m != nil {
- return m.Default
- }
- return nil
-}
-
-func (m *PathParameterSubSchema) GetMaximum() float64 {
- if m != nil {
- return m.Maximum
- }
- return 0
-}
-
-func (m *PathParameterSubSchema) GetExclusiveMaximum() bool {
- if m != nil {
- return m.ExclusiveMaximum
- }
- return false
-}
-
-func (m *PathParameterSubSchema) GetMinimum() float64 {
- if m != nil {
- return m.Minimum
- }
- return 0
-}
-
-func (m *PathParameterSubSchema) GetExclusiveMinimum() bool {
- if m != nil {
- return m.ExclusiveMinimum
- }
- return false
-}
-
-func (m *PathParameterSubSchema) GetMaxLength() int64 {
- if m != nil {
- return m.MaxLength
- }
- return 0
-}
-
-func (m *PathParameterSubSchema) GetMinLength() int64 {
- if m != nil {
- return m.MinLength
- }
- return 0
-}
-
-func (m *PathParameterSubSchema) GetPattern() string {
- if m != nil {
- return m.Pattern
- }
- return ""
-}
-
-func (m *PathParameterSubSchema) GetMaxItems() int64 {
- if m != nil {
- return m.MaxItems
- }
- return 0
-}
-
-func (m *PathParameterSubSchema) GetMinItems() int64 {
- if m != nil {
- return m.MinItems
- }
- return 0
-}
-
-func (m *PathParameterSubSchema) GetUniqueItems() bool {
- if m != nil {
- return m.UniqueItems
- }
- return false
-}
-
-func (m *PathParameterSubSchema) GetEnum() []*Any {
- if m != nil {
- return m.Enum
- }
- return nil
-}
-
-func (m *PathParameterSubSchema) GetMultipleOf() float64 {
- if m != nil {
- return m.MultipleOf
- }
- return 0
-}
-
-func (m *PathParameterSubSchema) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-// Relative paths to the individual endpoints. They must be relative to the 'basePath'.
-type Paths struct {
- VendorExtension []*NamedAny `protobuf:"bytes,1,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
- Path []*NamedPathItem `protobuf:"bytes,2,rep,name=path" json:"path,omitempty"`
-}
-
-func (m *Paths) Reset() { *m = Paths{} }
-func (m *Paths) String() string { return proto.CompactTextString(m) }
-func (*Paths) ProtoMessage() {}
-func (*Paths) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{42} }
-
-func (m *Paths) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-func (m *Paths) GetPath() []*NamedPathItem {
- if m != nil {
- return m.Path
- }
- return nil
-}
-
-type PrimitivesItems struct {
- Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
- Format string `protobuf:"bytes,2,opt,name=format" json:"format,omitempty"`
- Items *PrimitivesItems `protobuf:"bytes,3,opt,name=items" json:"items,omitempty"`
- CollectionFormat string `protobuf:"bytes,4,opt,name=collection_format,json=collectionFormat" json:"collection_format,omitempty"`
- Default *Any `protobuf:"bytes,5,opt,name=default" json:"default,omitempty"`
- Maximum float64 `protobuf:"fixed64,6,opt,name=maximum" json:"maximum,omitempty"`
- ExclusiveMaximum bool `protobuf:"varint,7,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"`
- Minimum float64 `protobuf:"fixed64,8,opt,name=minimum" json:"minimum,omitempty"`
- ExclusiveMinimum bool `protobuf:"varint,9,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"`
- MaxLength int64 `protobuf:"varint,10,opt,name=max_length,json=maxLength" json:"max_length,omitempty"`
- MinLength int64 `protobuf:"varint,11,opt,name=min_length,json=minLength" json:"min_length,omitempty"`
- Pattern string `protobuf:"bytes,12,opt,name=pattern" json:"pattern,omitempty"`
- MaxItems int64 `protobuf:"varint,13,opt,name=max_items,json=maxItems" json:"max_items,omitempty"`
- MinItems int64 `protobuf:"varint,14,opt,name=min_items,json=minItems" json:"min_items,omitempty"`
- UniqueItems bool `protobuf:"varint,15,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"`
- Enum []*Any `protobuf:"bytes,16,rep,name=enum" json:"enum,omitempty"`
- MultipleOf float64 `protobuf:"fixed64,17,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,18,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *PrimitivesItems) Reset() { *m = PrimitivesItems{} }
-func (m *PrimitivesItems) String() string { return proto.CompactTextString(m) }
-func (*PrimitivesItems) ProtoMessage() {}
-func (*PrimitivesItems) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{43} }
-
-func (m *PrimitivesItems) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *PrimitivesItems) GetFormat() string {
- if m != nil {
- return m.Format
- }
- return ""
-}
-
-func (m *PrimitivesItems) GetItems() *PrimitivesItems {
- if m != nil {
- return m.Items
- }
- return nil
-}
-
-func (m *PrimitivesItems) GetCollectionFormat() string {
- if m != nil {
- return m.CollectionFormat
- }
- return ""
-}
-
-func (m *PrimitivesItems) GetDefault() *Any {
- if m != nil {
- return m.Default
- }
- return nil
-}
-
-func (m *PrimitivesItems) GetMaximum() float64 {
- if m != nil {
- return m.Maximum
- }
- return 0
-}
-
-func (m *PrimitivesItems) GetExclusiveMaximum() bool {
- if m != nil {
- return m.ExclusiveMaximum
- }
- return false
-}
-
-func (m *PrimitivesItems) GetMinimum() float64 {
- if m != nil {
- return m.Minimum
- }
- return 0
-}
-
-func (m *PrimitivesItems) GetExclusiveMinimum() bool {
- if m != nil {
- return m.ExclusiveMinimum
- }
- return false
-}
-
-func (m *PrimitivesItems) GetMaxLength() int64 {
- if m != nil {
- return m.MaxLength
- }
- return 0
-}
-
-func (m *PrimitivesItems) GetMinLength() int64 {
- if m != nil {
- return m.MinLength
- }
- return 0
-}
-
-func (m *PrimitivesItems) GetPattern() string {
- if m != nil {
- return m.Pattern
- }
- return ""
-}
-
-func (m *PrimitivesItems) GetMaxItems() int64 {
- if m != nil {
- return m.MaxItems
- }
- return 0
-}
-
-func (m *PrimitivesItems) GetMinItems() int64 {
- if m != nil {
- return m.MinItems
- }
- return 0
-}
-
-func (m *PrimitivesItems) GetUniqueItems() bool {
- if m != nil {
- return m.UniqueItems
- }
- return false
-}
-
-func (m *PrimitivesItems) GetEnum() []*Any {
- if m != nil {
- return m.Enum
- }
- return nil
-}
-
-func (m *PrimitivesItems) GetMultipleOf() float64 {
- if m != nil {
- return m.MultipleOf
- }
- return 0
-}
-
-func (m *PrimitivesItems) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Properties struct {
- AdditionalProperties []*NamedSchema `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *Properties) Reset() { *m = Properties{} }
-func (m *Properties) String() string { return proto.CompactTextString(m) }
-func (*Properties) ProtoMessage() {}
-func (*Properties) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{44} }
-
-func (m *Properties) GetAdditionalProperties() []*NamedSchema {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-type QueryParameterSubSchema struct {
- // Determines whether or not this parameter is required or optional.
- Required bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"`
- // Determines the location of the parameter.
- In string `protobuf:"bytes,2,opt,name=in" json:"in,omitempty"`
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- Description string `protobuf:"bytes,3,opt,name=description" json:"description,omitempty"`
- // The name of the parameter.
- Name string `protobuf:"bytes,4,opt,name=name" json:"name,omitempty"`
- // allows sending a parameter by name only or with an empty value.
- AllowEmptyValue bool `protobuf:"varint,5,opt,name=allow_empty_value,json=allowEmptyValue" json:"allow_empty_value,omitempty"`
- Type string `protobuf:"bytes,6,opt,name=type" json:"type,omitempty"`
- Format string `protobuf:"bytes,7,opt,name=format" json:"format,omitempty"`
- Items *PrimitivesItems `protobuf:"bytes,8,opt,name=items" json:"items,omitempty"`
- CollectionFormat string `protobuf:"bytes,9,opt,name=collection_format,json=collectionFormat" json:"collection_format,omitempty"`
- Default *Any `protobuf:"bytes,10,opt,name=default" json:"default,omitempty"`
- Maximum float64 `protobuf:"fixed64,11,opt,name=maximum" json:"maximum,omitempty"`
- ExclusiveMaximum bool `protobuf:"varint,12,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"`
- Minimum float64 `protobuf:"fixed64,13,opt,name=minimum" json:"minimum,omitempty"`
- ExclusiveMinimum bool `protobuf:"varint,14,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"`
- MaxLength int64 `protobuf:"varint,15,opt,name=max_length,json=maxLength" json:"max_length,omitempty"`
- MinLength int64 `protobuf:"varint,16,opt,name=min_length,json=minLength" json:"min_length,omitempty"`
- Pattern string `protobuf:"bytes,17,opt,name=pattern" json:"pattern,omitempty"`
- MaxItems int64 `protobuf:"varint,18,opt,name=max_items,json=maxItems" json:"max_items,omitempty"`
- MinItems int64 `protobuf:"varint,19,opt,name=min_items,json=minItems" json:"min_items,omitempty"`
- UniqueItems bool `protobuf:"varint,20,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"`
- Enum []*Any `protobuf:"bytes,21,rep,name=enum" json:"enum,omitempty"`
- MultipleOf float64 `protobuf:"fixed64,22,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,23,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *QueryParameterSubSchema) Reset() { *m = QueryParameterSubSchema{} }
-func (m *QueryParameterSubSchema) String() string { return proto.CompactTextString(m) }
-func (*QueryParameterSubSchema) ProtoMessage() {}
-func (*QueryParameterSubSchema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{45} }
-
-func (m *QueryParameterSubSchema) GetRequired() bool {
- if m != nil {
- return m.Required
- }
- return false
-}
-
-func (m *QueryParameterSubSchema) GetIn() string {
- if m != nil {
- return m.In
- }
- return ""
-}
-
-func (m *QueryParameterSubSchema) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *QueryParameterSubSchema) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *QueryParameterSubSchema) GetAllowEmptyValue() bool {
- if m != nil {
- return m.AllowEmptyValue
- }
- return false
-}
-
-func (m *QueryParameterSubSchema) GetType() string {
- if m != nil {
- return m.Type
- }
- return ""
-}
-
-func (m *QueryParameterSubSchema) GetFormat() string {
- if m != nil {
- return m.Format
- }
- return ""
-}
-
-func (m *QueryParameterSubSchema) GetItems() *PrimitivesItems {
- if m != nil {
- return m.Items
- }
- return nil
-}
-
-func (m *QueryParameterSubSchema) GetCollectionFormat() string {
- if m != nil {
- return m.CollectionFormat
- }
- return ""
-}
-
-func (m *QueryParameterSubSchema) GetDefault() *Any {
- if m != nil {
- return m.Default
- }
- return nil
-}
-
-func (m *QueryParameterSubSchema) GetMaximum() float64 {
- if m != nil {
- return m.Maximum
- }
- return 0
-}
-
-func (m *QueryParameterSubSchema) GetExclusiveMaximum() bool {
- if m != nil {
- return m.ExclusiveMaximum
- }
- return false
-}
-
-func (m *QueryParameterSubSchema) GetMinimum() float64 {
- if m != nil {
- return m.Minimum
- }
- return 0
-}
-
-func (m *QueryParameterSubSchema) GetExclusiveMinimum() bool {
- if m != nil {
- return m.ExclusiveMinimum
- }
- return false
-}
-
-func (m *QueryParameterSubSchema) GetMaxLength() int64 {
- if m != nil {
- return m.MaxLength
- }
- return 0
-}
-
-func (m *QueryParameterSubSchema) GetMinLength() int64 {
- if m != nil {
- return m.MinLength
- }
- return 0
-}
-
-func (m *QueryParameterSubSchema) GetPattern() string {
- if m != nil {
- return m.Pattern
- }
- return ""
-}
-
-func (m *QueryParameterSubSchema) GetMaxItems() int64 {
- if m != nil {
- return m.MaxItems
- }
- return 0
-}
-
-func (m *QueryParameterSubSchema) GetMinItems() int64 {
- if m != nil {
- return m.MinItems
- }
- return 0
-}
-
-func (m *QueryParameterSubSchema) GetUniqueItems() bool {
- if m != nil {
- return m.UniqueItems
- }
- return false
-}
-
-func (m *QueryParameterSubSchema) GetEnum() []*Any {
- if m != nil {
- return m.Enum
- }
- return nil
-}
-
-func (m *QueryParameterSubSchema) GetMultipleOf() float64 {
- if m != nil {
- return m.MultipleOf
- }
- return 0
-}
-
-func (m *QueryParameterSubSchema) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type Response struct {
- Description string `protobuf:"bytes,1,opt,name=description" json:"description,omitempty"`
- Schema *SchemaItem `protobuf:"bytes,2,opt,name=schema" json:"schema,omitempty"`
- Headers *Headers `protobuf:"bytes,3,opt,name=headers" json:"headers,omitempty"`
- Examples *Examples `protobuf:"bytes,4,opt,name=examples" json:"examples,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,5,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Response) Reset() { *m = Response{} }
-func (m *Response) String() string { return proto.CompactTextString(m) }
-func (*Response) ProtoMessage() {}
-func (*Response) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{46} }
-
-func (m *Response) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Response) GetSchema() *SchemaItem {
- if m != nil {
- return m.Schema
- }
- return nil
-}
-
-func (m *Response) GetHeaders() *Headers {
- if m != nil {
- return m.Headers
- }
- return nil
-}
-
-func (m *Response) GetExamples() *Examples {
- if m != nil {
- return m.Examples
- }
- return nil
-}
-
-func (m *Response) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-// One or more JSON representations for parameters
-type ResponseDefinitions struct {
- AdditionalProperties []*NamedResponse `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *ResponseDefinitions) Reset() { *m = ResponseDefinitions{} }
-func (m *ResponseDefinitions) String() string { return proto.CompactTextString(m) }
-func (*ResponseDefinitions) ProtoMessage() {}
-func (*ResponseDefinitions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{47} }
-
-func (m *ResponseDefinitions) GetAdditionalProperties() []*NamedResponse {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-type ResponseValue struct {
- // Types that are valid to be assigned to Oneof:
- // *ResponseValue_Response
- // *ResponseValue_JsonReference
- Oneof isResponseValue_Oneof `protobuf_oneof:"oneof"`
-}
-
-func (m *ResponseValue) Reset() { *m = ResponseValue{} }
-func (m *ResponseValue) String() string { return proto.CompactTextString(m) }
-func (*ResponseValue) ProtoMessage() {}
-func (*ResponseValue) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{48} }
-
-type isResponseValue_Oneof interface {
- isResponseValue_Oneof()
-}
-
-type ResponseValue_Response struct {
- Response *Response `protobuf:"bytes,1,opt,name=response,oneof"`
-}
-type ResponseValue_JsonReference struct {
- JsonReference *JsonReference `protobuf:"bytes,2,opt,name=json_reference,json=jsonReference,oneof"`
-}
-
-func (*ResponseValue_Response) isResponseValue_Oneof() {}
-func (*ResponseValue_JsonReference) isResponseValue_Oneof() {}
-
-func (m *ResponseValue) GetOneof() isResponseValue_Oneof {
- if m != nil {
- return m.Oneof
- }
- return nil
-}
-
-func (m *ResponseValue) GetResponse() *Response {
- if x, ok := m.GetOneof().(*ResponseValue_Response); ok {
- return x.Response
- }
- return nil
-}
-
-func (m *ResponseValue) GetJsonReference() *JsonReference {
- if x, ok := m.GetOneof().(*ResponseValue_JsonReference); ok {
- return x.JsonReference
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*ResponseValue) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
- return _ResponseValue_OneofMarshaler, _ResponseValue_OneofUnmarshaler, _ResponseValue_OneofSizer, []interface{}{
- (*ResponseValue_Response)(nil),
- (*ResponseValue_JsonReference)(nil),
- }
-}
-
-func _ResponseValue_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*ResponseValue)
- // oneof
- switch x := m.Oneof.(type) {
- case *ResponseValue_Response:
- b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.Response); err != nil {
- return err
- }
- case *ResponseValue_JsonReference:
- b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.JsonReference); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("ResponseValue.Oneof has unexpected type %T", x)
- }
- return nil
-}
-
-func _ResponseValue_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*ResponseValue)
- switch tag {
- case 1: // oneof.response
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(Response)
- err := b.DecodeMessage(msg)
- m.Oneof = &ResponseValue_Response{msg}
- return true, err
- case 2: // oneof.json_reference
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(JsonReference)
- err := b.DecodeMessage(msg)
- m.Oneof = &ResponseValue_JsonReference{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _ResponseValue_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*ResponseValue)
- // oneof
- switch x := m.Oneof.(type) {
- case *ResponseValue_Response:
- s := proto.Size(x.Response)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *ResponseValue_JsonReference:
- s := proto.Size(x.JsonReference)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-// Response objects names can either be any valid HTTP status code or 'default'.
-type Responses struct {
- ResponseCode []*NamedResponseValue `protobuf:"bytes,1,rep,name=response_code,json=responseCode" json:"response_code,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,2,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Responses) Reset() { *m = Responses{} }
-func (m *Responses) String() string { return proto.CompactTextString(m) }
-func (*Responses) ProtoMessage() {}
-func (*Responses) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{49} }
-
-func (m *Responses) GetResponseCode() []*NamedResponseValue {
- if m != nil {
- return m.ResponseCode
- }
- return nil
-}
-
-func (m *Responses) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-// A deterministic version of a JSON Schema object.
-type Schema struct {
- XRef string `protobuf:"bytes,1,opt,name=_ref,json=Ref" json:"_ref,omitempty"`
- Format string `protobuf:"bytes,2,opt,name=format" json:"format,omitempty"`
- Title string `protobuf:"bytes,3,opt,name=title" json:"title,omitempty"`
- Description string `protobuf:"bytes,4,opt,name=description" json:"description,omitempty"`
- Default *Any `protobuf:"bytes,5,opt,name=default" json:"default,omitempty"`
- MultipleOf float64 `protobuf:"fixed64,6,opt,name=multiple_of,json=multipleOf" json:"multiple_of,omitempty"`
- Maximum float64 `protobuf:"fixed64,7,opt,name=maximum" json:"maximum,omitempty"`
- ExclusiveMaximum bool `protobuf:"varint,8,opt,name=exclusive_maximum,json=exclusiveMaximum" json:"exclusive_maximum,omitempty"`
- Minimum float64 `protobuf:"fixed64,9,opt,name=minimum" json:"minimum,omitempty"`
- ExclusiveMinimum bool `protobuf:"varint,10,opt,name=exclusive_minimum,json=exclusiveMinimum" json:"exclusive_minimum,omitempty"`
- MaxLength int64 `protobuf:"varint,11,opt,name=max_length,json=maxLength" json:"max_length,omitempty"`
- MinLength int64 `protobuf:"varint,12,opt,name=min_length,json=minLength" json:"min_length,omitempty"`
- Pattern string `protobuf:"bytes,13,opt,name=pattern" json:"pattern,omitempty"`
- MaxItems int64 `protobuf:"varint,14,opt,name=max_items,json=maxItems" json:"max_items,omitempty"`
- MinItems int64 `protobuf:"varint,15,opt,name=min_items,json=minItems" json:"min_items,omitempty"`
- UniqueItems bool `protobuf:"varint,16,opt,name=unique_items,json=uniqueItems" json:"unique_items,omitempty"`
- MaxProperties int64 `protobuf:"varint,17,opt,name=max_properties,json=maxProperties" json:"max_properties,omitempty"`
- MinProperties int64 `protobuf:"varint,18,opt,name=min_properties,json=minProperties" json:"min_properties,omitempty"`
- Required []string `protobuf:"bytes,19,rep,name=required" json:"required,omitempty"`
- Enum []*Any `protobuf:"bytes,20,rep,name=enum" json:"enum,omitempty"`
- AdditionalProperties *AdditionalPropertiesItem `protobuf:"bytes,21,opt,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
- Type *TypeItem `protobuf:"bytes,22,opt,name=type" json:"type,omitempty"`
- Items *ItemsItem `protobuf:"bytes,23,opt,name=items" json:"items,omitempty"`
- AllOf []*Schema `protobuf:"bytes,24,rep,name=all_of,json=allOf" json:"all_of,omitempty"`
- Properties *Properties `protobuf:"bytes,25,opt,name=properties" json:"properties,omitempty"`
- Discriminator string `protobuf:"bytes,26,opt,name=discriminator" json:"discriminator,omitempty"`
- ReadOnly bool `protobuf:"varint,27,opt,name=read_only,json=readOnly" json:"read_only,omitempty"`
- Xml *Xml `protobuf:"bytes,28,opt,name=xml" json:"xml,omitempty"`
- ExternalDocs *ExternalDocs `protobuf:"bytes,29,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"`
- Example *Any `protobuf:"bytes,30,opt,name=example" json:"example,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,31,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Schema) Reset() { *m = Schema{} }
-func (m *Schema) String() string { return proto.CompactTextString(m) }
-func (*Schema) ProtoMessage() {}
-func (*Schema) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{50} }
-
-func (m *Schema) GetXRef() string {
- if m != nil {
- return m.XRef
- }
- return ""
-}
-
-func (m *Schema) GetFormat() string {
- if m != nil {
- return m.Format
- }
- return ""
-}
-
-func (m *Schema) GetTitle() string {
- if m != nil {
- return m.Title
- }
- return ""
-}
-
-func (m *Schema) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Schema) GetDefault() *Any {
- if m != nil {
- return m.Default
- }
- return nil
-}
-
-func (m *Schema) GetMultipleOf() float64 {
- if m != nil {
- return m.MultipleOf
- }
- return 0
-}
-
-func (m *Schema) GetMaximum() float64 {
- if m != nil {
- return m.Maximum
- }
- return 0
-}
-
-func (m *Schema) GetExclusiveMaximum() bool {
- if m != nil {
- return m.ExclusiveMaximum
- }
- return false
-}
-
-func (m *Schema) GetMinimum() float64 {
- if m != nil {
- return m.Minimum
- }
- return 0
-}
-
-func (m *Schema) GetExclusiveMinimum() bool {
- if m != nil {
- return m.ExclusiveMinimum
- }
- return false
-}
-
-func (m *Schema) GetMaxLength() int64 {
- if m != nil {
- return m.MaxLength
- }
- return 0
-}
-
-func (m *Schema) GetMinLength() int64 {
- if m != nil {
- return m.MinLength
- }
- return 0
-}
-
-func (m *Schema) GetPattern() string {
- if m != nil {
- return m.Pattern
- }
- return ""
-}
-
-func (m *Schema) GetMaxItems() int64 {
- if m != nil {
- return m.MaxItems
- }
- return 0
-}
-
-func (m *Schema) GetMinItems() int64 {
- if m != nil {
- return m.MinItems
- }
- return 0
-}
-
-func (m *Schema) GetUniqueItems() bool {
- if m != nil {
- return m.UniqueItems
- }
- return false
-}
-
-func (m *Schema) GetMaxProperties() int64 {
- if m != nil {
- return m.MaxProperties
- }
- return 0
-}
-
-func (m *Schema) GetMinProperties() int64 {
- if m != nil {
- return m.MinProperties
- }
- return 0
-}
-
-func (m *Schema) GetRequired() []string {
- if m != nil {
- return m.Required
- }
- return nil
-}
-
-func (m *Schema) GetEnum() []*Any {
- if m != nil {
- return m.Enum
- }
- return nil
-}
-
-func (m *Schema) GetAdditionalProperties() *AdditionalPropertiesItem {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-func (m *Schema) GetType() *TypeItem {
- if m != nil {
- return m.Type
- }
- return nil
-}
-
-func (m *Schema) GetItems() *ItemsItem {
- if m != nil {
- return m.Items
- }
- return nil
-}
-
-func (m *Schema) GetAllOf() []*Schema {
- if m != nil {
- return m.AllOf
- }
- return nil
-}
-
-func (m *Schema) GetProperties() *Properties {
- if m != nil {
- return m.Properties
- }
- return nil
-}
-
-func (m *Schema) GetDiscriminator() string {
- if m != nil {
- return m.Discriminator
- }
- return ""
-}
-
-func (m *Schema) GetReadOnly() bool {
- if m != nil {
- return m.ReadOnly
- }
- return false
-}
-
-func (m *Schema) GetXml() *Xml {
- if m != nil {
- return m.Xml
- }
- return nil
-}
-
-func (m *Schema) GetExternalDocs() *ExternalDocs {
- if m != nil {
- return m.ExternalDocs
- }
- return nil
-}
-
-func (m *Schema) GetExample() *Any {
- if m != nil {
- return m.Example
- }
- return nil
-}
-
-func (m *Schema) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type SchemaItem struct {
- // Types that are valid to be assigned to Oneof:
- // *SchemaItem_Schema
- // *SchemaItem_FileSchema
- Oneof isSchemaItem_Oneof `protobuf_oneof:"oneof"`
-}
-
-func (m *SchemaItem) Reset() { *m = SchemaItem{} }
-func (m *SchemaItem) String() string { return proto.CompactTextString(m) }
-func (*SchemaItem) ProtoMessage() {}
-func (*SchemaItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{51} }
-
-type isSchemaItem_Oneof interface {
- isSchemaItem_Oneof()
-}
-
-type SchemaItem_Schema struct {
- Schema *Schema `protobuf:"bytes,1,opt,name=schema,oneof"`
-}
-type SchemaItem_FileSchema struct {
- FileSchema *FileSchema `protobuf:"bytes,2,opt,name=file_schema,json=fileSchema,oneof"`
-}
-
-func (*SchemaItem_Schema) isSchemaItem_Oneof() {}
-func (*SchemaItem_FileSchema) isSchemaItem_Oneof() {}
-
-func (m *SchemaItem) GetOneof() isSchemaItem_Oneof {
- if m != nil {
- return m.Oneof
- }
- return nil
-}
-
-func (m *SchemaItem) GetSchema() *Schema {
- if x, ok := m.GetOneof().(*SchemaItem_Schema); ok {
- return x.Schema
- }
- return nil
-}
-
-func (m *SchemaItem) GetFileSchema() *FileSchema {
- if x, ok := m.GetOneof().(*SchemaItem_FileSchema); ok {
- return x.FileSchema
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*SchemaItem) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
- return _SchemaItem_OneofMarshaler, _SchemaItem_OneofUnmarshaler, _SchemaItem_OneofSizer, []interface{}{
- (*SchemaItem_Schema)(nil),
- (*SchemaItem_FileSchema)(nil),
- }
-}
-
-func _SchemaItem_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*SchemaItem)
- // oneof
- switch x := m.Oneof.(type) {
- case *SchemaItem_Schema:
- b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.Schema); err != nil {
- return err
- }
- case *SchemaItem_FileSchema:
- b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.FileSchema); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("SchemaItem.Oneof has unexpected type %T", x)
- }
- return nil
-}
-
-func _SchemaItem_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*SchemaItem)
- switch tag {
- case 1: // oneof.schema
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(Schema)
- err := b.DecodeMessage(msg)
- m.Oneof = &SchemaItem_Schema{msg}
- return true, err
- case 2: // oneof.file_schema
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(FileSchema)
- err := b.DecodeMessage(msg)
- m.Oneof = &SchemaItem_FileSchema{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _SchemaItem_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*SchemaItem)
- // oneof
- switch x := m.Oneof.(type) {
- case *SchemaItem_Schema:
- s := proto.Size(x.Schema)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *SchemaItem_FileSchema:
- s := proto.Size(x.FileSchema)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-type SecurityDefinitions struct {
- AdditionalProperties []*NamedSecurityDefinitionsItem `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *SecurityDefinitions) Reset() { *m = SecurityDefinitions{} }
-func (m *SecurityDefinitions) String() string { return proto.CompactTextString(m) }
-func (*SecurityDefinitions) ProtoMessage() {}
-func (*SecurityDefinitions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{52} }
-
-func (m *SecurityDefinitions) GetAdditionalProperties() []*NamedSecurityDefinitionsItem {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-type SecurityDefinitionsItem struct {
- // Types that are valid to be assigned to Oneof:
- // *SecurityDefinitionsItem_BasicAuthenticationSecurity
- // *SecurityDefinitionsItem_ApiKeySecurity
- // *SecurityDefinitionsItem_Oauth2ImplicitSecurity
- // *SecurityDefinitionsItem_Oauth2PasswordSecurity
- // *SecurityDefinitionsItem_Oauth2ApplicationSecurity
- // *SecurityDefinitionsItem_Oauth2AccessCodeSecurity
- Oneof isSecurityDefinitionsItem_Oneof `protobuf_oneof:"oneof"`
-}
-
-func (m *SecurityDefinitionsItem) Reset() { *m = SecurityDefinitionsItem{} }
-func (m *SecurityDefinitionsItem) String() string { return proto.CompactTextString(m) }
-func (*SecurityDefinitionsItem) ProtoMessage() {}
-func (*SecurityDefinitionsItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{53} }
-
-type isSecurityDefinitionsItem_Oneof interface {
- isSecurityDefinitionsItem_Oneof()
-}
-
-type SecurityDefinitionsItem_BasicAuthenticationSecurity struct {
- BasicAuthenticationSecurity *BasicAuthenticationSecurity `protobuf:"bytes,1,opt,name=basic_authentication_security,json=basicAuthenticationSecurity,oneof"`
-}
-type SecurityDefinitionsItem_ApiKeySecurity struct {
- ApiKeySecurity *ApiKeySecurity `protobuf:"bytes,2,opt,name=api_key_security,json=apiKeySecurity,oneof"`
-}
-type SecurityDefinitionsItem_Oauth2ImplicitSecurity struct {
- Oauth2ImplicitSecurity *Oauth2ImplicitSecurity `protobuf:"bytes,3,opt,name=oauth2_implicit_security,json=oauth2ImplicitSecurity,oneof"`
-}
-type SecurityDefinitionsItem_Oauth2PasswordSecurity struct {
- Oauth2PasswordSecurity *Oauth2PasswordSecurity `protobuf:"bytes,4,opt,name=oauth2_password_security,json=oauth2PasswordSecurity,oneof"`
-}
-type SecurityDefinitionsItem_Oauth2ApplicationSecurity struct {
- Oauth2ApplicationSecurity *Oauth2ApplicationSecurity `protobuf:"bytes,5,opt,name=oauth2_application_security,json=oauth2ApplicationSecurity,oneof"`
-}
-type SecurityDefinitionsItem_Oauth2AccessCodeSecurity struct {
- Oauth2AccessCodeSecurity *Oauth2AccessCodeSecurity `protobuf:"bytes,6,opt,name=oauth2_access_code_security,json=oauth2AccessCodeSecurity,oneof"`
-}
-
-func (*SecurityDefinitionsItem_BasicAuthenticationSecurity) isSecurityDefinitionsItem_Oneof() {}
-func (*SecurityDefinitionsItem_ApiKeySecurity) isSecurityDefinitionsItem_Oneof() {}
-func (*SecurityDefinitionsItem_Oauth2ImplicitSecurity) isSecurityDefinitionsItem_Oneof() {}
-func (*SecurityDefinitionsItem_Oauth2PasswordSecurity) isSecurityDefinitionsItem_Oneof() {}
-func (*SecurityDefinitionsItem_Oauth2ApplicationSecurity) isSecurityDefinitionsItem_Oneof() {}
-func (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity) isSecurityDefinitionsItem_Oneof() {}
-
-func (m *SecurityDefinitionsItem) GetOneof() isSecurityDefinitionsItem_Oneof {
- if m != nil {
- return m.Oneof
- }
- return nil
-}
-
-func (m *SecurityDefinitionsItem) GetBasicAuthenticationSecurity() *BasicAuthenticationSecurity {
- if x, ok := m.GetOneof().(*SecurityDefinitionsItem_BasicAuthenticationSecurity); ok {
- return x.BasicAuthenticationSecurity
- }
- return nil
-}
-
-func (m *SecurityDefinitionsItem) GetApiKeySecurity() *ApiKeySecurity {
- if x, ok := m.GetOneof().(*SecurityDefinitionsItem_ApiKeySecurity); ok {
- return x.ApiKeySecurity
- }
- return nil
-}
-
-func (m *SecurityDefinitionsItem) GetOauth2ImplicitSecurity() *Oauth2ImplicitSecurity {
- if x, ok := m.GetOneof().(*SecurityDefinitionsItem_Oauth2ImplicitSecurity); ok {
- return x.Oauth2ImplicitSecurity
- }
- return nil
-}
-
-func (m *SecurityDefinitionsItem) GetOauth2PasswordSecurity() *Oauth2PasswordSecurity {
- if x, ok := m.GetOneof().(*SecurityDefinitionsItem_Oauth2PasswordSecurity); ok {
- return x.Oauth2PasswordSecurity
- }
- return nil
-}
-
-func (m *SecurityDefinitionsItem) GetOauth2ApplicationSecurity() *Oauth2ApplicationSecurity {
- if x, ok := m.GetOneof().(*SecurityDefinitionsItem_Oauth2ApplicationSecurity); ok {
- return x.Oauth2ApplicationSecurity
- }
- return nil
-}
-
-func (m *SecurityDefinitionsItem) GetOauth2AccessCodeSecurity() *Oauth2AccessCodeSecurity {
- if x, ok := m.GetOneof().(*SecurityDefinitionsItem_Oauth2AccessCodeSecurity); ok {
- return x.Oauth2AccessCodeSecurity
- }
- return nil
-}
-
-// XXX_OneofFuncs is for the internal use of the proto package.
-func (*SecurityDefinitionsItem) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
- return _SecurityDefinitionsItem_OneofMarshaler, _SecurityDefinitionsItem_OneofUnmarshaler, _SecurityDefinitionsItem_OneofSizer, []interface{}{
- (*SecurityDefinitionsItem_BasicAuthenticationSecurity)(nil),
- (*SecurityDefinitionsItem_ApiKeySecurity)(nil),
- (*SecurityDefinitionsItem_Oauth2ImplicitSecurity)(nil),
- (*SecurityDefinitionsItem_Oauth2PasswordSecurity)(nil),
- (*SecurityDefinitionsItem_Oauth2ApplicationSecurity)(nil),
- (*SecurityDefinitionsItem_Oauth2AccessCodeSecurity)(nil),
- }
-}
-
-func _SecurityDefinitionsItem_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
- m := msg.(*SecurityDefinitionsItem)
- // oneof
- switch x := m.Oneof.(type) {
- case *SecurityDefinitionsItem_BasicAuthenticationSecurity:
- b.EncodeVarint(1<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.BasicAuthenticationSecurity); err != nil {
- return err
- }
- case *SecurityDefinitionsItem_ApiKeySecurity:
- b.EncodeVarint(2<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.ApiKeySecurity); err != nil {
- return err
- }
- case *SecurityDefinitionsItem_Oauth2ImplicitSecurity:
- b.EncodeVarint(3<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.Oauth2ImplicitSecurity); err != nil {
- return err
- }
- case *SecurityDefinitionsItem_Oauth2PasswordSecurity:
- b.EncodeVarint(4<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.Oauth2PasswordSecurity); err != nil {
- return err
- }
- case *SecurityDefinitionsItem_Oauth2ApplicationSecurity:
- b.EncodeVarint(5<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.Oauth2ApplicationSecurity); err != nil {
- return err
- }
- case *SecurityDefinitionsItem_Oauth2AccessCodeSecurity:
- b.EncodeVarint(6<<3 | proto.WireBytes)
- if err := b.EncodeMessage(x.Oauth2AccessCodeSecurity); err != nil {
- return err
- }
- case nil:
- default:
- return fmt.Errorf("SecurityDefinitionsItem.Oneof has unexpected type %T", x)
- }
- return nil
-}
-
-func _SecurityDefinitionsItem_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
- m := msg.(*SecurityDefinitionsItem)
- switch tag {
- case 1: // oneof.basic_authentication_security
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(BasicAuthenticationSecurity)
- err := b.DecodeMessage(msg)
- m.Oneof = &SecurityDefinitionsItem_BasicAuthenticationSecurity{msg}
- return true, err
- case 2: // oneof.api_key_security
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(ApiKeySecurity)
- err := b.DecodeMessage(msg)
- m.Oneof = &SecurityDefinitionsItem_ApiKeySecurity{msg}
- return true, err
- case 3: // oneof.oauth2_implicit_security
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(Oauth2ImplicitSecurity)
- err := b.DecodeMessage(msg)
- m.Oneof = &SecurityDefinitionsItem_Oauth2ImplicitSecurity{msg}
- return true, err
- case 4: // oneof.oauth2_password_security
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(Oauth2PasswordSecurity)
- err := b.DecodeMessage(msg)
- m.Oneof = &SecurityDefinitionsItem_Oauth2PasswordSecurity{msg}
- return true, err
- case 5: // oneof.oauth2_application_security
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(Oauth2ApplicationSecurity)
- err := b.DecodeMessage(msg)
- m.Oneof = &SecurityDefinitionsItem_Oauth2ApplicationSecurity{msg}
- return true, err
- case 6: // oneof.oauth2_access_code_security
- if wire != proto.WireBytes {
- return true, proto.ErrInternalBadWireType
- }
- msg := new(Oauth2AccessCodeSecurity)
- err := b.DecodeMessage(msg)
- m.Oneof = &SecurityDefinitionsItem_Oauth2AccessCodeSecurity{msg}
- return true, err
- default:
- return false, nil
- }
-}
-
-func _SecurityDefinitionsItem_OneofSizer(msg proto.Message) (n int) {
- m := msg.(*SecurityDefinitionsItem)
- // oneof
- switch x := m.Oneof.(type) {
- case *SecurityDefinitionsItem_BasicAuthenticationSecurity:
- s := proto.Size(x.BasicAuthenticationSecurity)
- n += proto.SizeVarint(1<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *SecurityDefinitionsItem_ApiKeySecurity:
- s := proto.Size(x.ApiKeySecurity)
- n += proto.SizeVarint(2<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *SecurityDefinitionsItem_Oauth2ImplicitSecurity:
- s := proto.Size(x.Oauth2ImplicitSecurity)
- n += proto.SizeVarint(3<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *SecurityDefinitionsItem_Oauth2PasswordSecurity:
- s := proto.Size(x.Oauth2PasswordSecurity)
- n += proto.SizeVarint(4<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *SecurityDefinitionsItem_Oauth2ApplicationSecurity:
- s := proto.Size(x.Oauth2ApplicationSecurity)
- n += proto.SizeVarint(5<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case *SecurityDefinitionsItem_Oauth2AccessCodeSecurity:
- s := proto.Size(x.Oauth2AccessCodeSecurity)
- n += proto.SizeVarint(6<<3 | proto.WireBytes)
- n += proto.SizeVarint(uint64(s))
- n += s
- case nil:
- default:
- panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
- }
- return n
-}
-
-type SecurityRequirement struct {
- AdditionalProperties []*NamedStringArray `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *SecurityRequirement) Reset() { *m = SecurityRequirement{} }
-func (m *SecurityRequirement) String() string { return proto.CompactTextString(m) }
-func (*SecurityRequirement) ProtoMessage() {}
-func (*SecurityRequirement) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{54} }
-
-func (m *SecurityRequirement) GetAdditionalProperties() []*NamedStringArray {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-type StringArray struct {
- Value []string `protobuf:"bytes,1,rep,name=value" json:"value,omitempty"`
-}
-
-func (m *StringArray) Reset() { *m = StringArray{} }
-func (m *StringArray) String() string { return proto.CompactTextString(m) }
-func (*StringArray) ProtoMessage() {}
-func (*StringArray) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{55} }
-
-func (m *StringArray) GetValue() []string {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-type Tag struct {
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- Description string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"`
- ExternalDocs *ExternalDocs `protobuf:"bytes,3,opt,name=external_docs,json=externalDocs" json:"external_docs,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,4,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Tag) Reset() { *m = Tag{} }
-func (m *Tag) String() string { return proto.CompactTextString(m) }
-func (*Tag) ProtoMessage() {}
-func (*Tag) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{56} }
-
-func (m *Tag) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *Tag) GetDescription() string {
- if m != nil {
- return m.Description
- }
- return ""
-}
-
-func (m *Tag) GetExternalDocs() *ExternalDocs {
- if m != nil {
- return m.ExternalDocs
- }
- return nil
-}
-
-func (m *Tag) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-type TypeItem struct {
- Value []string `protobuf:"bytes,1,rep,name=value" json:"value,omitempty"`
-}
-
-func (m *TypeItem) Reset() { *m = TypeItem{} }
-func (m *TypeItem) String() string { return proto.CompactTextString(m) }
-func (*TypeItem) ProtoMessage() {}
-func (*TypeItem) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{57} }
-
-func (m *TypeItem) GetValue() []string {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// Any property starting with x- is valid.
-type VendorExtension struct {
- AdditionalProperties []*NamedAny `protobuf:"bytes,1,rep,name=additional_properties,json=additionalProperties" json:"additional_properties,omitempty"`
-}
-
-func (m *VendorExtension) Reset() { *m = VendorExtension{} }
-func (m *VendorExtension) String() string { return proto.CompactTextString(m) }
-func (*VendorExtension) ProtoMessage() {}
-func (*VendorExtension) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{58} }
-
-func (m *VendorExtension) GetAdditionalProperties() []*NamedAny {
- if m != nil {
- return m.AdditionalProperties
- }
- return nil
-}
-
-type Xml struct {
- Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
- Namespace string `protobuf:"bytes,2,opt,name=namespace" json:"namespace,omitempty"`
- Prefix string `protobuf:"bytes,3,opt,name=prefix" json:"prefix,omitempty"`
- Attribute bool `protobuf:"varint,4,opt,name=attribute" json:"attribute,omitempty"`
- Wrapped bool `protobuf:"varint,5,opt,name=wrapped" json:"wrapped,omitempty"`
- VendorExtension []*NamedAny `protobuf:"bytes,6,rep,name=vendor_extension,json=vendorExtension" json:"vendor_extension,omitempty"`
-}
-
-func (m *Xml) Reset() { *m = Xml{} }
-func (m *Xml) String() string { return proto.CompactTextString(m) }
-func (*Xml) ProtoMessage() {}
-func (*Xml) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{59} }
-
-func (m *Xml) GetName() string {
- if m != nil {
- return m.Name
- }
- return ""
-}
-
-func (m *Xml) GetNamespace() string {
- if m != nil {
- return m.Namespace
- }
- return ""
-}
-
-func (m *Xml) GetPrefix() string {
- if m != nil {
- return m.Prefix
- }
- return ""
-}
-
-func (m *Xml) GetAttribute() bool {
- if m != nil {
- return m.Attribute
- }
- return false
-}
-
-func (m *Xml) GetWrapped() bool {
- if m != nil {
- return m.Wrapped
- }
- return false
-}
-
-func (m *Xml) GetVendorExtension() []*NamedAny {
- if m != nil {
- return m.VendorExtension
- }
- return nil
-}
-
-func init() {
- proto.RegisterType((*AdditionalPropertiesItem)(nil), "openapi.v2.AdditionalPropertiesItem")
- proto.RegisterType((*Any)(nil), "openapi.v2.Any")
- proto.RegisterType((*ApiKeySecurity)(nil), "openapi.v2.ApiKeySecurity")
- proto.RegisterType((*BasicAuthenticationSecurity)(nil), "openapi.v2.BasicAuthenticationSecurity")
- proto.RegisterType((*BodyParameter)(nil), "openapi.v2.BodyParameter")
- proto.RegisterType((*Contact)(nil), "openapi.v2.Contact")
- proto.RegisterType((*Default)(nil), "openapi.v2.Default")
- proto.RegisterType((*Definitions)(nil), "openapi.v2.Definitions")
- proto.RegisterType((*Document)(nil), "openapi.v2.Document")
- proto.RegisterType((*Examples)(nil), "openapi.v2.Examples")
- proto.RegisterType((*ExternalDocs)(nil), "openapi.v2.ExternalDocs")
- proto.RegisterType((*FileSchema)(nil), "openapi.v2.FileSchema")
- proto.RegisterType((*FormDataParameterSubSchema)(nil), "openapi.v2.FormDataParameterSubSchema")
- proto.RegisterType((*Header)(nil), "openapi.v2.Header")
- proto.RegisterType((*HeaderParameterSubSchema)(nil), "openapi.v2.HeaderParameterSubSchema")
- proto.RegisterType((*Headers)(nil), "openapi.v2.Headers")
- proto.RegisterType((*Info)(nil), "openapi.v2.Info")
- proto.RegisterType((*ItemsItem)(nil), "openapi.v2.ItemsItem")
- proto.RegisterType((*JsonReference)(nil), "openapi.v2.JsonReference")
- proto.RegisterType((*License)(nil), "openapi.v2.License")
- proto.RegisterType((*NamedAny)(nil), "openapi.v2.NamedAny")
- proto.RegisterType((*NamedHeader)(nil), "openapi.v2.NamedHeader")
- proto.RegisterType((*NamedParameter)(nil), "openapi.v2.NamedParameter")
- proto.RegisterType((*NamedPathItem)(nil), "openapi.v2.NamedPathItem")
- proto.RegisterType((*NamedResponse)(nil), "openapi.v2.NamedResponse")
- proto.RegisterType((*NamedResponseValue)(nil), "openapi.v2.NamedResponseValue")
- proto.RegisterType((*NamedSchema)(nil), "openapi.v2.NamedSchema")
- proto.RegisterType((*NamedSecurityDefinitionsItem)(nil), "openapi.v2.NamedSecurityDefinitionsItem")
- proto.RegisterType((*NamedString)(nil), "openapi.v2.NamedString")
- proto.RegisterType((*NamedStringArray)(nil), "openapi.v2.NamedStringArray")
- proto.RegisterType((*NonBodyParameter)(nil), "openapi.v2.NonBodyParameter")
- proto.RegisterType((*Oauth2AccessCodeSecurity)(nil), "openapi.v2.Oauth2AccessCodeSecurity")
- proto.RegisterType((*Oauth2ApplicationSecurity)(nil), "openapi.v2.Oauth2ApplicationSecurity")
- proto.RegisterType((*Oauth2ImplicitSecurity)(nil), "openapi.v2.Oauth2ImplicitSecurity")
- proto.RegisterType((*Oauth2PasswordSecurity)(nil), "openapi.v2.Oauth2PasswordSecurity")
- proto.RegisterType((*Oauth2Scopes)(nil), "openapi.v2.Oauth2Scopes")
- proto.RegisterType((*Operation)(nil), "openapi.v2.Operation")
- proto.RegisterType((*Parameter)(nil), "openapi.v2.Parameter")
- proto.RegisterType((*ParameterDefinitions)(nil), "openapi.v2.ParameterDefinitions")
- proto.RegisterType((*ParametersItem)(nil), "openapi.v2.ParametersItem")
- proto.RegisterType((*PathItem)(nil), "openapi.v2.PathItem")
- proto.RegisterType((*PathParameterSubSchema)(nil), "openapi.v2.PathParameterSubSchema")
- proto.RegisterType((*Paths)(nil), "openapi.v2.Paths")
- proto.RegisterType((*PrimitivesItems)(nil), "openapi.v2.PrimitivesItems")
- proto.RegisterType((*Properties)(nil), "openapi.v2.Properties")
- proto.RegisterType((*QueryParameterSubSchema)(nil), "openapi.v2.QueryParameterSubSchema")
- proto.RegisterType((*Response)(nil), "openapi.v2.Response")
- proto.RegisterType((*ResponseDefinitions)(nil), "openapi.v2.ResponseDefinitions")
- proto.RegisterType((*ResponseValue)(nil), "openapi.v2.ResponseValue")
- proto.RegisterType((*Responses)(nil), "openapi.v2.Responses")
- proto.RegisterType((*Schema)(nil), "openapi.v2.Schema")
- proto.RegisterType((*SchemaItem)(nil), "openapi.v2.SchemaItem")
- proto.RegisterType((*SecurityDefinitions)(nil), "openapi.v2.SecurityDefinitions")
- proto.RegisterType((*SecurityDefinitionsItem)(nil), "openapi.v2.SecurityDefinitionsItem")
- proto.RegisterType((*SecurityRequirement)(nil), "openapi.v2.SecurityRequirement")
- proto.RegisterType((*StringArray)(nil), "openapi.v2.StringArray")
- proto.RegisterType((*Tag)(nil), "openapi.v2.Tag")
- proto.RegisterType((*TypeItem)(nil), "openapi.v2.TypeItem")
- proto.RegisterType((*VendorExtension)(nil), "openapi.v2.VendorExtension")
- proto.RegisterType((*Xml)(nil), "openapi.v2.Xml")
-}
-
-func init() { proto.RegisterFile("OpenAPIv2/OpenAPIv2.proto", fileDescriptor0) }
-
-var fileDescriptor0 = []byte{
- // 3129 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x3b, 0x4b, 0x73, 0x1c, 0x57,
- 0xd5, 0xf3, 0x7e, 0x1c, 0x69, 0x46, 0xa3, 0x96, 0x2c, 0xb7, 0x24, 0xc7, 0x71, 0xe4, 0x3c, 0x6c,
- 0xe7, 0xb3, 0x9c, 0x4f, 0x29, 0x48, 0x05, 0x2a, 0x05, 0xf2, 0xab, 0xc6, 0xc4, 0x44, 0x4a, 0xcb,
- 0x0e, 0x09, 0x04, 0xba, 0xae, 0x66, 0xee, 0x48, 0x9d, 0x74, 0xf7, 0x6d, 0x77, 0xf7, 0xc8, 0x1a,
- 0x16, 0x2c, 0xa0, 0x8a, 0x35, 0x50, 0x59, 0x53, 0x15, 0x16, 0x14, 0x55, 0x59, 0xb0, 0x62, 0xc5,
- 0x1f, 0x60, 0xc7, 0x3f, 0x60, 0x0d, 0x5b, 0xaa, 0x58, 0x51, 0x3c, 0xea, 0xbe, 0xfa, 0x31, 0x7d,
- 0x7b, 0x1e, 0x96, 0x0b, 0x28, 0xd0, 0x6a, 0xe6, 0xde, 0x73, 0xee, 0xb9, 0xa7, 0x4f, 0x9f, 0xd7,
- 0x3d, 0xe7, 0x36, 0xac, 0xef, 0x79, 0xd8, 0xdd, 0xdd, 0x7f, 0x70, 0xb2, 0x73, 0x2b, 0xfa, 0xb7,
- 0xed, 0xf9, 0x24, 0x24, 0x1a, 0x10, 0x0f, 0xbb, 0xc8, 0xb3, 0xb6, 0x4f, 0x76, 0x36, 0xd6, 0x8f,
- 0x08, 0x39, 0xb2, 0xf1, 0x2d, 0x06, 0x39, 0x1c, 0x0e, 0x6e, 0x21, 0x77, 0xc4, 0xd1, 0xb6, 0x1c,
- 0xd0, 0x77, 0xfb, 0x7d, 0x2b, 0xb4, 0x88, 0x8b, 0xec, 0x7d, 0x9f, 0x78, 0xd8, 0x0f, 0x2d, 0x1c,
- 0x3c, 0x08, 0xb1, 0xa3, 0xfd, 0x1f, 0xd4, 0x82, 0xde, 0x31, 0x76, 0x90, 0x5e, 0xbc, 0x52, 0xbc,
- 0xb6, 0xb0, 0xa3, 0x6d, 0xc7, 0x34, 0xb7, 0x0f, 0x18, 0xa4, 0x5b, 0x30, 0x04, 0x8e, 0xb6, 0x01,
- 0xf5, 0x43, 0x42, 0x6c, 0x8c, 0x5c, 0xbd, 0x74, 0xa5, 0x78, 0xad, 0xd1, 0x2d, 0x18, 0x72, 0xe2,
- 0x76, 0x1d, 0xaa, 0xc4, 0xc5, 0x64, 0xb0, 0x75, 0x0f, 0xca, 0xbb, 0xee, 0x48, 0xbb, 0x01, 0xd5,
- 0x13, 0x64, 0x0f, 0xb1, 0x20, 0xbc, 0xba, 0xcd, 0x19, 0xdc, 0x96, 0x0c, 0x6e, 0xef, 0xba, 0x23,
- 0x83, 0xa3, 0x68, 0x1a, 0x54, 0x46, 0xc8, 0xb1, 0x19, 0xd1, 0xa6, 0xc1, 0xfe, 0x6f, 0x7d, 0x51,
- 0x84, 0xf6, 0xae, 0x67, 0xbd, 0x8b, 0x47, 0x07, 0xb8, 0x37, 0xf4, 0xad, 0x70, 0x44, 0xd1, 0xc2,
- 0x91, 0xc7, 0x29, 0x36, 0x0d, 0xf6, 0x9f, 0xce, 0xb9, 0xc8, 0xc1, 0x72, 0x29, 0xfd, 0xaf, 0xb5,
- 0xa1, 0x64, 0xb9, 0x7a, 0x99, 0xcd, 0x94, 0x2c, 0x57, 0xbb, 0x02, 0x0b, 0x7d, 0x1c, 0xf4, 0x7c,
- 0xcb, 0xa3, 0x32, 0xd0, 0x2b, 0x0c, 0x90, 0x9c, 0xd2, 0xbe, 0x06, 0x9d, 0x13, 0xec, 0xf6, 0x89,
- 0x6f, 0xe2, 0xd3, 0x10, 0xbb, 0x01, 0x45, 0xab, 0x5e, 0x29, 0x33, 0xbe, 0x13, 0x02, 0x79, 0x0f,
- 0x39, 0xb8, 0x4f, 0xf9, 0x5e, 0xe2, 0xd8, 0xf7, 0x24, 0xf2, 0xd6, 0x67, 0x45, 0xd8, 0xbc, 0x8d,
- 0x02, 0xab, 0xb7, 0x3b, 0x0c, 0x8f, 0xb1, 0x1b, 0x5a, 0x3d, 0x44, 0x09, 0x4f, 0x64, 0x7d, 0x8c,
- 0xad, 0xd2, 0x6c, 0x6c, 0x95, 0xe7, 0x61, 0xeb, 0x0f, 0x45, 0x68, 0xdd, 0x26, 0xfd, 0xd1, 0x3e,
- 0xf2, 0x91, 0x83, 0x43, 0xec, 0x8f, 0x6f, 0x5a, 0xcc, 0x6e, 0x3a, 0x8b, 0x44, 0x37, 0xa0, 0xe1,
- 0xe3, 0x27, 0x43, 0xcb, 0xc7, 0x7d, 0x26, 0xce, 0x86, 0x11, 0x8d, 0xb5, 0x1b, 0x91, 0x4a, 0x55,
- 0xf3, 0x54, 0x2a, 0x52, 0x28, 0xd5, 0x03, 0xd6, 0xe6, 0x79, 0xc0, 0x1f, 0x17, 0xa1, 0x7e, 0x87,
- 0xb8, 0x21, 0xea, 0x85, 0x11, 0xe3, 0xc5, 0x04, 0xe3, 0x1d, 0x28, 0x0f, 0x7d, 0xa9, 0x58, 0xf4,
- 0xaf, 0xb6, 0x0a, 0x55, 0xec, 0x20, 0xcb, 0x16, 0x4f, 0xc3, 0x07, 0x4a, 0x46, 0x2a, 0xf3, 0x30,
- 0xf2, 0x08, 0xea, 0x77, 0xf1, 0x00, 0x0d, 0xed, 0x50, 0x7b, 0x00, 0x17, 0x50, 0x64, 0x6f, 0xa6,
- 0x17, 0x19, 0x9c, 0x5e, 0x9c, 0x40, 0x70, 0x15, 0x29, 0x4c, 0x74, 0xeb, 0x3b, 0xb0, 0x70, 0x17,
- 0x0f, 0x2c, 0x97, 0x41, 0x02, 0xed, 0xe1, 0x64, 0xca, 0x17, 0x33, 0x94, 0x85, 0xb8, 0xd5, 0xc4,
- 0xff, 0x58, 0x85, 0xc6, 0x5d, 0xd2, 0x1b, 0x3a, 0xd8, 0x0d, 0x35, 0x1d, 0xea, 0xc1, 0x53, 0x74,
- 0x74, 0x84, 0x7d, 0x21, 0x3f, 0x39, 0xd4, 0x5e, 0x86, 0x8a, 0xe5, 0x0e, 0x08, 0x93, 0xe1, 0xc2,
- 0x4e, 0x27, 0xb9, 0xc7, 0x03, 0x77, 0x40, 0x0c, 0x06, 0xa5, 0xc2, 0x3f, 0x26, 0x41, 0x28, 0xa4,
- 0xca, 0xfe, 0x6b, 0x9b, 0xd0, 0x3c, 0x44, 0x01, 0x36, 0x3d, 0x14, 0x1e, 0x0b, 0xab, 0x6b, 0xd0,
- 0x89, 0x7d, 0x14, 0x1e, 0xb3, 0x0d, 0x29, 0x77, 0x38, 0x60, 0x96, 0x46, 0x37, 0xe4, 0x43, 0xaa,
- 0x5c, 0x3d, 0xe2, 0x06, 0x43, 0x0a, 0xaa, 0x31, 0x50, 0x34, 0xa6, 0x30, 0xcf, 0x27, 0xfd, 0x61,
- 0x0f, 0x07, 0x7a, 0x9d, 0xc3, 0xe4, 0x58, 0x7b, 0x0d, 0xaa, 0x74, 0xa7, 0x40, 0x6f, 0x30, 0x4e,
- 0x97, 0x93, 0x9c, 0xd2, 0x2d, 0x03, 0x83, 0xc3, 0xb5, 0xb7, 0xa9, 0x0d, 0x44, 0x52, 0xd5, 0x9b,
- 0x0c, 0x3d, 0x25, 0xbc, 0x84, 0xd0, 0x8d, 0x24, 0xae, 0xf6, 0x75, 0x00, 0x4f, 0xda, 0x52, 0xa0,
- 0x03, 0x5b, 0x79, 0x25, 0xbd, 0x91, 0x80, 0x26, 0x49, 0x24, 0xd6, 0x68, 0xef, 0x40, 0xd3, 0xc7,
- 0x81, 0x47, 0xdc, 0x00, 0x07, 0xfa, 0x02, 0x23, 0xf0, 0x62, 0x92, 0x80, 0x21, 0x80, 0xc9, 0xf5,
- 0xf1, 0x0a, 0xed, 0xab, 0xd0, 0x08, 0x84, 0x53, 0xd1, 0x17, 0xd9, 0x5b, 0x4f, 0xad, 0x96, 0x0e,
- 0xc7, 0xe0, 0xd6, 0x48, 0x5f, 0xad, 0x11, 0x2d, 0xd0, 0x0c, 0x58, 0x95, 0xff, 0xcd, 0xa4, 0x04,
- 0x5a, 0x59, 0x36, 0x24, 0xa1, 0x24, 0x1b, 0x2b, 0x41, 0x76, 0x52, 0xbb, 0x0a, 0x95, 0x10, 0x1d,
- 0x05, 0x7a, 0x9b, 0x31, 0xb3, 0x94, 0xa4, 0xf1, 0x08, 0x1d, 0x19, 0x0c, 0xa8, 0xbd, 0x03, 0x2d,
- 0x6a, 0x57, 0x3e, 0x55, 0xdb, 0x3e, 0xe9, 0x05, 0xfa, 0x12, 0xdb, 0x51, 0x4f, 0x62, 0xdf, 0x13,
- 0x08, 0x77, 0x49, 0x2f, 0x30, 0x16, 0x71, 0x62, 0xa4, 0xb4, 0xce, 0xce, 0x3c, 0xd6, 0xf9, 0x18,
- 0x1a, 0xf7, 0x4e, 0x91, 0xe3, 0xd9, 0x38, 0x78, 0x9e, 0xe6, 0xf9, 0xa3, 0x22, 0x2c, 0x26, 0xd9,
- 0x9e, 0xc1, 0xbb, 0x66, 0x1d, 0xd2, 0x99, 0x9d, 0xfc, 0x3f, 0x4a, 0x00, 0xf7, 0x2d, 0x1b, 0x73,
- 0x63, 0xd7, 0xd6, 0xa0, 0x36, 0x20, 0xbe, 0x83, 0x42, 0xb1, 0xbd, 0x18, 0x51, 0xc7, 0x17, 0x5a,
- 0xa1, 0x2d, 0x1d, 0x3b, 0x1f, 0x8c, 0x73, 0x5c, 0xce, 0x72, 0x7c, 0x1d, 0xea, 0x7d, 0xee, 0xd9,
- 0x98, 0x0d, 0x8f, 0xbd, 0x63, 0xca, 0x91, 0x84, 0xa7, 0xc2, 0x02, 0x37, 0xea, 0x38, 0x2c, 0xc8,
- 0x08, 0x58, 0x4b, 0x44, 0xc0, 0x4d, 0x6a, 0x0b, 0xa8, 0x6f, 0x12, 0xd7, 0x1e, 0xe9, 0x75, 0x19,
- 0x47, 0x50, 0x7f, 0xcf, 0xb5, 0x47, 0x59, 0x9d, 0x69, 0xcc, 0xa5, 0x33, 0xd7, 0xa1, 0x8e, 0xf9,
- 0x2b, 0x17, 0x06, 0x9e, 0x65, 0x5b, 0xc0, 0x95, 0x6f, 0x00, 0xe6, 0x79, 0x03, 0x5f, 0xd4, 0x60,
- 0xe3, 0x3e, 0xf1, 0x9d, 0xbb, 0x28, 0x44, 0x91, 0x03, 0x38, 0x18, 0x1e, 0x1e, 0xc8, 0xb4, 0x29,
- 0x16, 0x4b, 0x71, 0x2c, 0x5a, 0xf2, 0xc8, 0x5a, 0xca, 0xcb, 0x55, 0xca, 0xf9, 0xf1, 0xb9, 0x92,
- 0x08, 0x73, 0x37, 0x60, 0x19, 0xd9, 0x36, 0x79, 0x6a, 0x62, 0xc7, 0x0b, 0x47, 0x26, 0x4f, 0xbc,
- 0xaa, 0x6c, 0xab, 0x25, 0x06, 0xb8, 0x47, 0xe7, 0x3f, 0x90, 0xc9, 0x56, 0xe6, 0x45, 0xc4, 0x3a,
- 0x53, 0x4f, 0xe9, 0xcc, 0xff, 0x43, 0xd5, 0x0a, 0xb1, 0x23, 0x65, 0xbf, 0x99, 0xf2, 0x74, 0xbe,
- 0xe5, 0x58, 0xa1, 0x75, 0xc2, 0x33, 0xc9, 0xc0, 0xe0, 0x98, 0xda, 0xeb, 0xb0, 0xdc, 0x23, 0xb6,
- 0x8d, 0x7b, 0x94, 0x59, 0x53, 0x50, 0x6d, 0x32, 0xaa, 0x9d, 0x18, 0x70, 0x9f, 0xd3, 0x4f, 0xe8,
- 0x16, 0x4c, 0xd1, 0x2d, 0x1d, 0xea, 0x0e, 0x3a, 0xb5, 0x9c, 0xa1, 0xc3, 0xbc, 0x66, 0xd1, 0x90,
- 0x43, 0xba, 0x23, 0x3e, 0xed, 0xd9, 0xc3, 0xc0, 0x3a, 0xc1, 0xa6, 0xc4, 0x59, 0x64, 0x0f, 0xdf,
- 0x89, 0x00, 0xdf, 0x14, 0xc8, 0x94, 0x8c, 0xe5, 0x32, 0x94, 0x96, 0x20, 0xc3, 0x87, 0x63, 0x64,
- 0x04, 0x4e, 0x7b, 0x9c, 0x8c, 0x40, 0x7e, 0x01, 0xc0, 0x41, 0xa7, 0xa6, 0x8d, 0xdd, 0xa3, 0xf0,
- 0x98, 0x79, 0xb3, 0xb2, 0xd1, 0x74, 0xd0, 0xe9, 0x43, 0x36, 0xc1, 0xc0, 0x96, 0x2b, 0xc1, 0x1d,
- 0x01, 0xb6, 0x5c, 0x01, 0xd6, 0xa1, 0xee, 0xa1, 0x90, 0x2a, 0xab, 0xbe, 0xcc, 0x83, 0xad, 0x18,
- 0x52, 0x8b, 0xa0, 0x74, 0xb9, 0xd0, 0x35, 0xb6, 0xae, 0xe1, 0xa0, 0x53, 0x26, 0x61, 0x06, 0xb4,
- 0x5c, 0x01, 0x5c, 0x11, 0x40, 0xcb, 0xe5, 0xc0, 0x97, 0x60, 0x71, 0xe8, 0x5a, 0x4f, 0x86, 0x58,
- 0xc0, 0x57, 0x19, 0xe7, 0x0b, 0x7c, 0x8e, 0xa3, 0x5c, 0x85, 0x0a, 0x76, 0x87, 0x8e, 0x7e, 0x21,
- 0xeb, 0xaa, 0xa9, 0xa8, 0x19, 0x50, 0x7b, 0x11, 0x16, 0x9c, 0xa1, 0x1d, 0x5a, 0x9e, 0x8d, 0x4d,
- 0x32, 0xd0, 0xd7, 0x98, 0x90, 0x40, 0x4e, 0xed, 0x0d, 0x94, 0xd6, 0x72, 0x71, 0x2e, 0x6b, 0xa9,
- 0x42, 0xad, 0x8b, 0x51, 0x1f, 0xfb, 0xca, 0xb4, 0x38, 0xd6, 0xc5, 0x92, 0x5a, 0x17, 0xcb, 0x67,
- 0xd3, 0xc5, 0xca, 0x74, 0x5d, 0xac, 0xce, 0xae, 0x8b, 0xb5, 0x19, 0x74, 0xb1, 0x3e, 0x5d, 0x17,
- 0x1b, 0x33, 0xe8, 0x62, 0x73, 0x26, 0x5d, 0x84, 0xc9, 0xba, 0xb8, 0x30, 0x41, 0x17, 0x17, 0x27,
- 0xe8, 0x62, 0x6b, 0x92, 0x2e, 0xb6, 0xa7, 0xe8, 0xe2, 0x52, 0xbe, 0x2e, 0x76, 0xe6, 0xd0, 0xc5,
- 0xe5, 0x8c, 0x2e, 0x8e, 0x79, 0x4b, 0x6d, 0xb6, 0x23, 0xd4, 0xca, 0x3c, 0xda, 0xfa, 0xb7, 0x2a,
- 0xe8, 0x5c, 0x5b, 0xff, 0x2d, 0x9e, 0x5d, 0x5a, 0x48, 0x55, 0x69, 0x21, 0x35, 0xb5, 0x85, 0xd4,
- 0xcf, 0x66, 0x21, 0x8d, 0xe9, 0x16, 0xd2, 0x9c, 0xdd, 0x42, 0x60, 0x06, 0x0b, 0x59, 0x98, 0x6e,
- 0x21, 0x8b, 0x33, 0x58, 0x48, 0x6b, 0x26, 0x0b, 0x69, 0x4f, 0xb6, 0x90, 0xa5, 0x09, 0x16, 0xd2,
- 0x99, 0x60, 0x21, 0xcb, 0x93, 0x2c, 0x44, 0x9b, 0x62, 0x21, 0x2b, 0xf9, 0x16, 0xb2, 0x3a, 0x87,
- 0x85, 0x5c, 0x98, 0xc9, 0x5b, 0xaf, 0xcd, 0xa3, 0xff, 0xdf, 0x82, 0x3a, 0x57, 0xff, 0x67, 0x38,
- 0x7e, 0xf2, 0x85, 0x39, 0xc9, 0xf3, 0xe7, 0x25, 0xa8, 0xd0, 0x03, 0x64, 0x9c, 0x98, 0x16, 0x93,
- 0x89, 0xa9, 0x0e, 0xf5, 0x13, 0xec, 0x07, 0x71, 0x65, 0x44, 0x0e, 0x67, 0x30, 0xa4, 0x6b, 0xd0,
- 0x09, 0xb1, 0xef, 0x04, 0x26, 0x19, 0x98, 0x01, 0xf6, 0x4f, 0xac, 0x9e, 0x34, 0xaa, 0x36, 0x9b,
- 0xdf, 0x1b, 0x1c, 0xf0, 0x59, 0xed, 0x26, 0xd4, 0x7b, 0xbc, 0x7c, 0x20, 0x9c, 0xfe, 0x4a, 0xf2,
- 0x21, 0x44, 0x65, 0xc1, 0x90, 0x38, 0x14, 0xdd, 0xb6, 0x7a, 0xd8, 0x0d, 0x78, 0xfa, 0x34, 0x86,
- 0xfe, 0x90, 0x83, 0x0c, 0x89, 0xa3, 0x14, 0x7e, 0x7d, 0x1e, 0xe1, 0xbf, 0x05, 0x4d, 0xa6, 0x0c,
- 0xac, 0x56, 0x77, 0x23, 0x51, 0xab, 0x2b, 0x4f, 0x2e, 0xac, 0x6c, 0xdd, 0x85, 0xd6, 0x37, 0x02,
- 0xe2, 0x1a, 0x78, 0x80, 0x7d, 0xec, 0xf6, 0xb0, 0xb6, 0x0c, 0x15, 0xd3, 0xc7, 0x03, 0x21, 0xe3,
- 0xb2, 0x81, 0x07, 0xd3, 0xeb, 0x4f, 0x5b, 0x1e, 0xd4, 0xc5, 0x33, 0xcd, 0x58, 0x5c, 0x39, 0xf3,
- 0x59, 0xe6, 0x1e, 0x34, 0x24, 0x50, 0xb9, 0xe5, 0x2b, 0xb2, 0xaa, 0x58, 0x52, 0x3b, 0x20, 0x0e,
- 0xdd, 0x7a, 0x17, 0x16, 0x12, 0x0a, 0xa8, 0xa4, 0x74, 0x2d, 0x4d, 0x29, 0x25, 0x4c, 0xa1, 0xb7,
- 0x82, 0xd8, 0xfb, 0xd0, 0x66, 0xc4, 0xe2, 0x22, 0x9a, 0x8a, 0xde, 0xeb, 0x69, 0x7a, 0x17, 0x94,
- 0x45, 0x01, 0x49, 0x72, 0x0f, 0x5a, 0x82, 0x64, 0x78, 0xcc, 0xde, 0xad, 0x8a, 0xe2, 0x8d, 0x34,
- 0xc5, 0xd5, 0xf1, 0x7a, 0x06, 0x5d, 0x38, 0x4e, 0x50, 0x56, 0x0f, 0xe6, 0x26, 0x28, 0x17, 0x4a,
- 0x82, 0x1f, 0x81, 0x96, 0x22, 0x18, 0x9d, 0x1d, 0x32, 0x54, 0x6f, 0xa5, 0xa9, 0xae, 0xab, 0xa8,
- 0xb2, 0xd5, 0xe3, 0x2f, 0x47, 0xc4, 0xd0, 0x79, 0x5f, 0x8e, 0xd0, 0x74, 0x41, 0xcc, 0x81, 0x4b,
- 0x9c, 0x58, 0xb6, 0x34, 0x91, 0x2b, 0xd8, 0xb7, 0xd3, 0xd4, 0xaf, 0x4e, 0xa9, 0x7b, 0x24, 0xe5,
- 0xfc, 0x96, 0xe4, 0x3d, 0xf4, 0x2d, 0xf7, 0x48, 0x49, 0x7d, 0x35, 0x49, 0xbd, 0x29, 0x17, 0x3e,
- 0x86, 0x4e, 0x62, 0xe1, 0xae, 0xef, 0x23, 0xb5, 0x82, 0xdf, 0x4c, 0xf3, 0x96, 0xf2, 0xa9, 0x89,
- 0xb5, 0x92, 0xec, 0x6f, 0xca, 0xd0, 0x79, 0x8f, 0xb8, 0xe9, 0x1a, 0x2f, 0x86, 0xcd, 0x63, 0xa6,
- 0xc1, 0x66, 0x54, 0x77, 0x32, 0x83, 0xe1, 0xa1, 0x99, 0xaa, 0xf4, 0xbf, 0x9c, 0x55, 0xf8, 0x6c,
- 0x82, 0xd3, 0x2d, 0x18, 0xfa, 0x71, 0x5e, 0xf2, 0x63, 0xc3, 0x65, 0x9a, 0x30, 0x98, 0x7d, 0x14,
- 0x22, 0xf5, 0x4e, 0xfc, 0x19, 0x5e, 0x4d, 0xee, 0x94, 0x7f, 0x4c, 0xee, 0x16, 0x8c, 0x8d, 0x41,
- 0xfe, 0x21, 0xfa, 0x10, 0x36, 0x9e, 0x0c, 0xb1, 0x3f, 0x52, 0xef, 0x54, 0xce, 0xbe, 0xc9, 0xf7,
- 0x29, 0xb6, 0x72, 0x9b, 0x8b, 0x4f, 0xd4, 0x20, 0xcd, 0x84, 0x75, 0x0f, 0x85, 0xc7, 0xea, 0x2d,
- 0x78, 0xf1, 0x63, 0x6b, 0xdc, 0x0a, 0x95, 0x3b, 0xac, 0x79, 0x4a, 0x48, 0xdc, 0x24, 0xf9, 0xbc,
- 0x04, 0xfa, 0x1e, 0x1a, 0x86, 0xc7, 0x3b, 0xbb, 0xbd, 0x1e, 0x0e, 0x82, 0x3b, 0xa4, 0x8f, 0xa7,
- 0xf5, 0x39, 0x06, 0x36, 0x79, 0x2a, 0xab, 0xf2, 0xf4, 0xbf, 0xf6, 0x06, 0x0d, 0x08, 0xc4, 0xc3,
- 0xf2, 0x48, 0x94, 0x2a, 0x8d, 0x70, 0xea, 0x07, 0x0c, 0x6e, 0x08, 0x3c, 0x9a, 0x35, 0xd1, 0x69,
- 0xe2, 0x5b, 0xdf, 0x67, 0xfd, 0x09, 0x93, 0xfa, 0x6f, 0x71, 0x20, 0x4a, 0x01, 0x1e, 0xfb, 0x36,
- 0x4d, 0x60, 0x42, 0xf2, 0x29, 0xe6, 0x48, 0x3c, 0xff, 0x6c, 0xb0, 0x09, 0x0a, 0x1c, 0x0b, 0x1e,
- 0xb5, 0xd9, 0x32, 0xef, 0xb9, 0x82, 0xdf, 0x5f, 0x8a, 0xb0, 0x2e, 0x64, 0xe4, 0x79, 0xf6, 0x2c,
- 0x1d, 0x95, 0xe7, 0x23, 0xa4, 0xd4, 0x73, 0x57, 0x26, 0x3f, 0x77, 0x75, 0xb6, 0xe7, 0x9e, 0xab,
- 0xa7, 0xf1, 0xc3, 0x12, 0xac, 0x71, 0xc6, 0x1e, 0x38, 0xf4, 0xb9, 0xad, 0xf0, 0x3f, 0x4d, 0x33,
- 0xfe, 0x05, 0x42, 0xf8, 0x73, 0x51, 0x0a, 0x61, 0x1f, 0x05, 0xc1, 0x53, 0xe2, 0xf7, 0xff, 0x07,
- 0xde, 0xfc, 0xc7, 0xb0, 0x98, 0xe4, 0xeb, 0x19, 0xfa, 0x3d, 0x2c, 0x42, 0xe4, 0x24, 0xdc, 0x3f,
- 0xaf, 0x40, 0x73, 0xcf, 0xc3, 0x3e, 0x92, 0x87, 0x4d, 0x56, 0xb7, 0x2f, 0xb2, 0x3a, 0x2d, 0x2f,
- 0xd3, 0xeb, 0x50, 0x0f, 0x86, 0x8e, 0x83, 0xfc, 0x91, 0xcc, 0xb9, 0xc5, 0x70, 0x86, 0x9c, 0x3b,
- 0x53, 0xae, 0xad, 0xcc, 0x55, 0xae, 0x7d, 0x09, 0x16, 0x89, 0xe4, 0xcd, 0xb4, 0xfa, 0x52, 0xbc,
- 0xd1, 0xdc, 0x83, 0x7e, 0xaa, 0xf7, 0x53, 0x1b, 0xeb, 0xfd, 0x24, 0x7b, 0x46, 0xf5, 0xb1, 0x9e,
- 0xd1, 0x57, 0x52, 0x3d, 0x9b, 0x06, 0x13, 0xdd, 0x86, 0x32, 0x3d, 0xe3, 0xa1, 0x3e, 0xd9, 0xad,
- 0x79, 0x33, 0xd9, 0xad, 0x69, 0x66, 0x33, 0x3b, 0x99, 0xe0, 0xa4, 0x7a, 0x34, 0x89, 0xd6, 0x16,
- 0xa4, 0x5b, 0x5b, 0x97, 0x01, 0xfa, 0xd8, 0xf3, 0x71, 0x0f, 0x85, 0xb8, 0x2f, 0x4e, 0xbd, 0x89,
- 0x99, 0xb3, 0x75, 0x77, 0x54, 0xea, 0xd7, 0x9a, 0x47, 0xfd, 0x7e, 0x59, 0x84, 0x66, 0x9c, 0x45,
- 0xdc, 0x86, 0xf6, 0x21, 0xe9, 0x27, 0xe2, 0xad, 0x48, 0x1c, 0x52, 0x09, 0x5e, 0x2a, 0xf1, 0xe8,
- 0x16, 0x8c, 0xd6, 0x61, 0x2a, 0x13, 0x79, 0x08, 0x9a, 0x4b, 0x5c, 0x73, 0x8c, 0x0e, 0x4f, 0x0b,
- 0x2e, 0xa5, 0x98, 0x1a, 0xcb, 0x61, 0xba, 0x05, 0xa3, 0xe3, 0x8e, 0xcd, 0xc5, 0xd1, 0xf3, 0x08,
- 0x56, 0x55, 0x7d, 0x36, 0x6d, 0x6f, 0xb2, 0xbd, 0x6c, 0x64, 0xc4, 0x10, 0x27, 0xe6, 0x6a, 0x93,
- 0xf9, 0xac, 0x08, 0xed, 0xb4, 0x76, 0x68, 0x5f, 0x82, 0xe6, 0xb8, 0x44, 0xd4, 0xb9, 0x7e, 0xb7,
- 0x60, 0xc4, 0x98, 0x54, 0x9a, 0x9f, 0x04, 0xc4, 0xa5, 0x67, 0x30, 0x7e, 0x22, 0x53, 0xa5, 0xcb,
- 0xa9, 0x23, 0x1b, 0x95, 0xe6, 0x27, 0xc9, 0x89, 0xf8, 0xf9, 0x7f, 0x5f, 0x86, 0x46, 0x74, 0x74,
- 0x50, 0x9c, 0xec, 0x5e, 0x83, 0xf2, 0x11, 0x0e, 0x55, 0x27, 0x91, 0xc8, 0xfe, 0x0d, 0x8a, 0x41,
- 0x11, 0xbd, 0x61, 0x28, 0xfc, 0x63, 0x1e, 0xa2, 0x37, 0x0c, 0xb5, 0xeb, 0x50, 0xf1, 0x48, 0x20,
- 0x3b, 0x40, 0x39, 0x98, 0x0c, 0x45, 0xbb, 0x09, 0xb5, 0x3e, 0xb6, 0x71, 0x88, 0xc5, 0x89, 0x3a,
- 0x07, 0x59, 0x20, 0x69, 0xb7, 0xa0, 0x4e, 0x3c, 0xde, 0x86, 0xac, 0x4d, 0xc2, 0x97, 0x58, 0x94,
- 0x15, 0x9a, 0x92, 0x8a, 0x22, 0x57, 0x1e, 0x2b, 0x14, 0x85, 0x9e, 0xc9, 0x3c, 0x14, 0xf6, 0x8e,
- 0x45, 0xfb, 0x22, 0x07, 0x97, 0xe3, 0x8c, 0xb9, 0x89, 0xe6, 0x5c, 0x6e, 0xe2, 0xcc, 0x1d, 0xa4,
- 0xbf, 0x56, 0x61, 0x4d, 0x9d, 0x4d, 0x9e, 0xd7, 0x18, 0xcf, 0x6b, 0x8c, 0xff, 0xed, 0x35, 0xc6,
- 0xa7, 0x50, 0x65, 0x17, 0x34, 0x94, 0x94, 0x8a, 0x73, 0x50, 0xd2, 0x6e, 0x42, 0x85, 0xdd, 0x36,
- 0x29, 0xb1, 0x45, 0xeb, 0x0a, 0x87, 0x2f, 0xea, 0x26, 0x0c, 0x6d, 0xeb, 0x67, 0x55, 0x58, 0x1a,
- 0xd3, 0xda, 0xf3, 0x9e, 0xd4, 0x79, 0x4f, 0xea, 0x4c, 0x3d, 0x29, 0x95, 0x0e, 0x6b, 0xf3, 0x58,
- 0xc3, 0xb7, 0x01, 0xe2, 0x14, 0xe4, 0x39, 0xdf, 0xf9, 0xfa, 0x55, 0x0d, 0x2e, 0xe6, 0x14, 0x46,
- 0xce, 0xaf, 0x29, 0x9c, 0x5f, 0x53, 0x38, 0xbf, 0xa6, 0x10, 0x9b, 0xe1, 0xdf, 0x8b, 0xd0, 0x88,
- 0xca, 0xe9, 0xd3, 0x2f, 0x76, 0x6d, 0x47, 0xdd, 0x19, 0x9e, 0x76, 0xaf, 0x65, 0x6b, 0xd6, 0x2c,
- 0xf0, 0xc8, 0xab, 0xaf, 0x37, 0xa1, 0xce, 0x2b, 0xab, 0x32, 0x78, 0xac, 0x64, 0x0b, 0xb2, 0x81,
- 0x21, 0x71, 0xb4, 0x37, 0xa0, 0x21, 0xae, 0x2b, 0xc9, 0x93, 0xf5, 0x6a, 0xfa, 0x64, 0xcd, 0x61,
- 0x46, 0x84, 0x75, 0xf6, 0x3b, 0xcd, 0x18, 0x56, 0x14, 0x97, 0x11, 0xb5, 0xf7, 0x26, 0x3b, 0xa4,
- 0x6c, 0xcc, 0x8d, 0x5a, 0x0b, 0x6a, 0x97, 0xf4, 0x93, 0x22, 0xb4, 0xd2, 0x5d, 0x86, 0x1d, 0xea,
- 0x88, 0xf8, 0x44, 0x74, 0x7b, 0x5c, 0x71, 0xe6, 0xee, 0x16, 0x8c, 0x08, 0xef, 0xf9, 0x9e, 0xaf,
- 0x7e, 0x5a, 0x84, 0x66, 0x74, 0xb2, 0xd7, 0xee, 0x40, 0x4b, 0x6e, 0x63, 0xf6, 0x48, 0x1f, 0x8b,
- 0x07, 0xbd, 0x9c, 0xfb, 0xa0, 0xbc, 0xdb, 0xb1, 0x28, 0x17, 0xdd, 0x21, 0x7d, 0x75, 0x2b, 0xb0,
- 0x34, 0xcf, 0xdb, 0xf8, 0x75, 0x13, 0x6a, 0xc2, 0x51, 0x2b, 0x4e, 0x7c, 0x79, 0x09, 0x4a, 0xd4,
- 0x5b, 0x2d, 0x4f, 0xb8, 0xf4, 0x57, 0x99, 0x78, 0xe9, 0x6f, 0x5a, 0xe2, 0x31, 0x66, 0x89, 0xb5,
- 0x8c, 0x25, 0x26, 0x5c, 0x62, 0x7d, 0x06, 0x97, 0xd8, 0x98, 0xee, 0x12, 0x9b, 0x33, 0xb8, 0x44,
- 0x98, 0xc9, 0x25, 0x2e, 0x4c, 0x76, 0x89, 0x8b, 0x13, 0x5c, 0x62, 0x6b, 0x82, 0x4b, 0x6c, 0x4f,
- 0x72, 0x89, 0x4b, 0x53, 0x5c, 0x62, 0x27, 0xeb, 0x12, 0x5f, 0x81, 0x36, 0x25, 0x9e, 0x30, 0x36,
- 0x7e, 0x12, 0x68, 0x39, 0xe8, 0x34, 0x91, 0x2b, 0x50, 0x34, 0xcb, 0x4d, 0xa2, 0x69, 0x02, 0xcd,
- 0x72, 0x13, 0x68, 0xc9, 0x40, 0xbf, 0x32, 0x76, 0x4d, 0x73, 0xa6, 0x13, 0xc1, 0x47, 0x79, 0x2e,
- 0xe0, 0x42, 0xb6, 0xb5, 0x94, 0xf7, 0xe9, 0x89, 0xda, 0x1b, 0x68, 0xd7, 0x44, 0xd8, 0x5f, 0xcb,
- 0xda, 0xfd, 0xa3, 0x91, 0x87, 0x79, 0xee, 0xce, 0x92, 0x81, 0xd7, 0x65, 0xd0, 0xbf, 0x98, 0x3d,
- 0xdc, 0x47, 0x4d, 0x73, 0x19, 0xee, 0xaf, 0x43, 0x0d, 0xd9, 0x36, 0xd5, 0x4f, 0x3d, 0xb7, 0x77,
- 0x5e, 0x45, 0xb6, 0xbd, 0x37, 0xd0, 0xbe, 0x0c, 0x90, 0x78, 0xa2, 0xf5, 0xac, 0x33, 0x8f, 0xb9,
- 0x35, 0x12, 0x98, 0xda, 0xcb, 0xd0, 0xea, 0x5b, 0xd4, 0x82, 0x1c, 0xcb, 0x45, 0x21, 0xf1, 0xf5,
- 0x0d, 0xa6, 0x20, 0xe9, 0xc9, 0xf4, 0x95, 0xd7, 0xcd, 0xb1, 0x2b, 0xaf, 0x2f, 0x41, 0xf9, 0xd4,
- 0xb1, 0xf5, 0x4b, 0x59, 0x8b, 0xfb, 0xd0, 0xb1, 0x0d, 0x0a, 0xcb, 0x96, 0x59, 0x5f, 0x78, 0xd6,
- 0x5b, 0xb1, 0x97, 0x9f, 0xe1, 0x56, 0xec, 0x8b, 0xf3, 0x78, 0xac, 0x1f, 0x00, 0xc4, 0x71, 0x6f,
- 0xce, 0x2f, 0x8d, 0xde, 0x86, 0x85, 0x81, 0x65, 0x63, 0x33, 0x3f, 0xa4, 0xc6, 0x37, 0x9e, 0xbb,
- 0x05, 0x03, 0x06, 0xd1, 0x28, 0xf6, 0xe2, 0x21, 0xac, 0x28, 0xba, 0xb9, 0xda, 0x77, 0x27, 0xc7,
- 0xaf, 0x6b, 0xd9, 0x84, 0x3a, 0xa7, 0x25, 0xac, 0x0e, 0x67, 0x7f, 0xaa, 0xc0, 0xc5, 0xbc, 0x66,
- 0xb4, 0x03, 0x2f, 0x1c, 0xa2, 0xc0, 0xea, 0x99, 0x28, 0xf5, 0x95, 0x90, 0x19, 0xd5, 0x7c, 0xb9,
- 0x68, 0x5e, 0x4b, 0x55, 0x58, 0xf3, 0xbf, 0x2a, 0xea, 0x16, 0x8c, 0xcd, 0xc3, 0x09, 0x1f, 0x1d,
- 0xdd, 0x87, 0x0e, 0xf2, 0x2c, 0xf3, 0x53, 0x3c, 0x8a, 0x77, 0xe0, 0x92, 0x4c, 0xd5, 0xb5, 0xd2,
- 0x5f, 0x59, 0x75, 0x0b, 0x46, 0x1b, 0xa5, 0xbf, 0xbb, 0xfa, 0x1e, 0xe8, 0x84, 0xb5, 0x25, 0x4c,
- 0x4b, 0x34, 0xa4, 0x62, 0x7a, 0xe5, 0x6c, 0x57, 0x54, 0xdd, 0xbb, 0xea, 0x16, 0x8c, 0x35, 0xa2,
- 0xee, 0x6a, 0xc5, 0xf4, 0x3d, 0xd1, 0xeb, 0x89, 0xe9, 0x57, 0xf2, 0xe8, 0x8f, 0xb7, 0x85, 0x62,
- 0xfa, 0x99, 0x86, 0xd1, 0x11, 0x6c, 0x0a, 0xfa, 0x28, 0x6e, 0x24, 0xc6, 0x5b, 0xf0, 0x00, 0xf7,
- 0x4a, 0x76, 0x0b, 0x45, 0xdb, 0xb1, 0x5b, 0x30, 0xd6, 0x49, 0x6e, 0x4f, 0x12, 0xc7, 0x1b, 0xb1,
- 0xae, 0x2e, 0x4b, 0x17, 0xe2, 0x8d, 0x6a, 0x59, 0xef, 0x98, 0xd7, 0x03, 0xee, 0x16, 0x0c, 0x21,
- 0x93, 0x2c, 0x2c, 0xd6, 0xf0, 0xe3, 0x58, 0xc3, 0x13, 0x2d, 0x01, 0xed, 0xfd, 0xc9, 0x1a, 0x7e,
- 0x29, 0xa7, 0x6d, 0xc4, 0x2f, 0x16, 0xa8, 0xb5, 0xfa, 0x2a, 0x2c, 0x24, 0x6f, 0x2e, 0xac, 0xc6,
- 0x1f, 0xf7, 0x95, 0xe3, 0x3b, 0x0e, 0xbf, 0x2d, 0x42, 0xf9, 0x11, 0x52, 0xdf, 0x8a, 0x98, 0xfe,
- 0xb1, 0x5b, 0xc6, 0xb3, 0x95, 0xcf, 0xfc, 0x8d, 0xc8, 0x5c, 0x5f, 0x70, 0x5d, 0x81, 0x86, 0x8c,
- 0x30, 0x39, 0xcf, 0xf7, 0x31, 0x2c, 0x7d, 0x30, 0x56, 0x6f, 0x7a, 0x8e, 0x1f, 0x93, 0xfc, 0xae,
- 0x08, 0xe5, 0x0f, 0x1d, 0x5b, 0x29, 0xbd, 0x4b, 0xd0, 0xa4, 0xbf, 0x81, 0x87, 0x7a, 0xf2, 0x5e,
- 0x49, 0x3c, 0x41, 0x93, 0x3f, 0xcf, 0xc7, 0x03, 0xeb, 0x54, 0x64, 0x79, 0x62, 0x44, 0x57, 0xa1,
- 0x30, 0xf4, 0xad, 0xc3, 0x61, 0x88, 0xc5, 0x67, 0x7a, 0xf1, 0x04, 0x4d, 0x65, 0x9e, 0xfa, 0xc8,
- 0xf3, 0x70, 0x5f, 0x1c, 0xc1, 0xe5, 0xf0, 0xcc, 0x7d, 0xcc, 0xdb, 0xaf, 0x42, 0x9b, 0xf8, 0x47,
- 0x12, 0xd7, 0x3c, 0xd9, 0xb9, 0xbd, 0x28, 0xbe, 0x5d, 0xdd, 0xf7, 0x49, 0x48, 0xf6, 0x8b, 0xbf,
- 0x28, 0x95, 0xf7, 0x76, 0x0f, 0x0e, 0x6b, 0xec, 0x63, 0xd0, 0x37, 0xff, 0x19, 0x00, 0x00, 0xff,
- 0xff, 0xd4, 0x0a, 0xef, 0xca, 0xe4, 0x3a, 0x00, 0x00,
-}
diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.proto b/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.proto
deleted file mode 100644
index 557c8807..00000000
--- a/vendor/github.com/googleapis/gnostic/OpenAPIv2/OpenAPIv2.proto
+++ /dev/null
@@ -1,663 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// THIS FILE IS AUTOMATICALLY GENERATED.
-
-syntax = "proto3";
-
-package openapi.v2;
-
-import "google/protobuf/any.proto";
-
-// This option lets the proto compiler generate Java code inside the package
-// name (see below) instead of inside an outer class. It creates a simpler
-// developer experience by reducing one-level of name nesting and be
-// consistent with most programming languages that don't support outer classes.
-option java_multiple_files = true;
-
-// The Java outer classname should be the filename in UpperCamelCase. This
-// class is only used to hold proto descriptor, so developers don't need to
-// work with it directly.
-option java_outer_classname = "OpenAPIProto";
-
-// The Java package name must be proto package name with proper prefix.
-option java_package = "org.openapi_v2";
-
-// A reasonable prefix for the Objective-C symbols generated from the package.
-// It should at a minimum be 3 characters long, all uppercase, and convention
-// is to use an abbreviation of the package name. Something short, but
-// hopefully unique enough to not conflict with things that may come along in
-// the future. 'GPB' is reserved for the protocol buffer implementation itself.
-option objc_class_prefix = "OAS";
-
-message AdditionalPropertiesItem {
- oneof oneof {
- Schema schema = 1;
- bool boolean = 2;
- }
-}
-
-message Any {
- google.protobuf.Any value = 1;
- string yaml = 2;
-}
-
-message ApiKeySecurity {
- string type = 1;
- string name = 2;
- string in = 3;
- string description = 4;
- repeated NamedAny vendor_extension = 5;
-}
-
-message BasicAuthenticationSecurity {
- string type = 1;
- string description = 2;
- repeated NamedAny vendor_extension = 3;
-}
-
-message BodyParameter {
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- string description = 1;
- // The name of the parameter.
- string name = 2;
- // Determines the location of the parameter.
- string in = 3;
- // Determines whether or not this parameter is required or optional.
- bool required = 4;
- Schema schema = 5;
- repeated NamedAny vendor_extension = 6;
-}
-
-// Contact information for the owners of the API.
-message Contact {
- // The identifying name of the contact person/organization.
- string name = 1;
- // The URL pointing to the contact information.
- string url = 2;
- // The email address of the contact person/organization.
- string email = 3;
- repeated NamedAny vendor_extension = 4;
-}
-
-message Default {
- repeated NamedAny additional_properties = 1;
-}
-
-// One or more JSON objects describing the schemas being consumed and produced by the API.
-message Definitions {
- repeated NamedSchema additional_properties = 1;
-}
-
-message Document {
- // The Swagger version of this document.
- string swagger = 1;
- Info info = 2;
- // The host (name or ip) of the API. Example: 'swagger.io'
- string host = 3;
- // The base path to the API. Example: '/api'.
- string base_path = 4;
- // The transfer protocol of the API.
- repeated string schemes = 5;
- // A list of MIME types accepted by the API.
- repeated string consumes = 6;
- // A list of MIME types the API can produce.
- repeated string produces = 7;
- Paths paths = 8;
- Definitions definitions = 9;
- ParameterDefinitions parameters = 10;
- ResponseDefinitions responses = 11;
- repeated SecurityRequirement security = 12;
- SecurityDefinitions security_definitions = 13;
- repeated Tag tags = 14;
- ExternalDocs external_docs = 15;
- repeated NamedAny vendor_extension = 16;
-}
-
-message Examples {
- repeated NamedAny additional_properties = 1;
-}
-
-// information about external documentation
-message ExternalDocs {
- string description = 1;
- string url = 2;
- repeated NamedAny vendor_extension = 3;
-}
-
-// A deterministic version of a JSON Schema object.
-message FileSchema {
- string format = 1;
- string title = 2;
- string description = 3;
- Any default = 4;
- repeated string required = 5;
- string type = 6;
- bool read_only = 7;
- ExternalDocs external_docs = 8;
- Any example = 9;
- repeated NamedAny vendor_extension = 10;
-}
-
-message FormDataParameterSubSchema {
- // Determines whether or not this parameter is required or optional.
- bool required = 1;
- // Determines the location of the parameter.
- string in = 2;
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- string description = 3;
- // The name of the parameter.
- string name = 4;
- // allows sending a parameter by name only or with an empty value.
- bool allow_empty_value = 5;
- string type = 6;
- string format = 7;
- PrimitivesItems items = 8;
- string collection_format = 9;
- Any default = 10;
- double maximum = 11;
- bool exclusive_maximum = 12;
- double minimum = 13;
- bool exclusive_minimum = 14;
- int64 max_length = 15;
- int64 min_length = 16;
- string pattern = 17;
- int64 max_items = 18;
- int64 min_items = 19;
- bool unique_items = 20;
- repeated Any enum = 21;
- double multiple_of = 22;
- repeated NamedAny vendor_extension = 23;
-}
-
-message Header {
- string type = 1;
- string format = 2;
- PrimitivesItems items = 3;
- string collection_format = 4;
- Any default = 5;
- double maximum = 6;
- bool exclusive_maximum = 7;
- double minimum = 8;
- bool exclusive_minimum = 9;
- int64 max_length = 10;
- int64 min_length = 11;
- string pattern = 12;
- int64 max_items = 13;
- int64 min_items = 14;
- bool unique_items = 15;
- repeated Any enum = 16;
- double multiple_of = 17;
- string description = 18;
- repeated NamedAny vendor_extension = 19;
-}
-
-message HeaderParameterSubSchema {
- // Determines whether or not this parameter is required or optional.
- bool required = 1;
- // Determines the location of the parameter.
- string in = 2;
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- string description = 3;
- // The name of the parameter.
- string name = 4;
- string type = 5;
- string format = 6;
- PrimitivesItems items = 7;
- string collection_format = 8;
- Any default = 9;
- double maximum = 10;
- bool exclusive_maximum = 11;
- double minimum = 12;
- bool exclusive_minimum = 13;
- int64 max_length = 14;
- int64 min_length = 15;
- string pattern = 16;
- int64 max_items = 17;
- int64 min_items = 18;
- bool unique_items = 19;
- repeated Any enum = 20;
- double multiple_of = 21;
- repeated NamedAny vendor_extension = 22;
-}
-
-message Headers {
- repeated NamedHeader additional_properties = 1;
-}
-
-// General information about the API.
-message Info {
- // A unique and precise title of the API.
- string title = 1;
- // A semantic version number of the API.
- string version = 2;
- // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.
- string description = 3;
- // The terms of service for the API.
- string terms_of_service = 4;
- Contact contact = 5;
- License license = 6;
- repeated NamedAny vendor_extension = 7;
-}
-
-message ItemsItem {
- repeated Schema schema = 1;
-}
-
-message JsonReference {
- string _ref = 1;
- string description = 2;
-}
-
-message License {
- // The name of the license type. It's encouraged to use an OSI compatible license.
- string name = 1;
- // The URL pointing to the license.
- string url = 2;
- repeated NamedAny vendor_extension = 3;
-}
-
-// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
-message NamedAny {
- // Map key
- string name = 1;
- // Mapped value
- Any value = 2;
-}
-
-// Automatically-generated message used to represent maps of Header as ordered (name,value) pairs.
-message NamedHeader {
- // Map key
- string name = 1;
- // Mapped value
- Header value = 2;
-}
-
-// Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs.
-message NamedParameter {
- // Map key
- string name = 1;
- // Mapped value
- Parameter value = 2;
-}
-
-// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
-message NamedPathItem {
- // Map key
- string name = 1;
- // Mapped value
- PathItem value = 2;
-}
-
-// Automatically-generated message used to represent maps of Response as ordered (name,value) pairs.
-message NamedResponse {
- // Map key
- string name = 1;
- // Mapped value
- Response value = 2;
-}
-
-// Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs.
-message NamedResponseValue {
- // Map key
- string name = 1;
- // Mapped value
- ResponseValue value = 2;
-}
-
-// Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs.
-message NamedSchema {
- // Map key
- string name = 1;
- // Mapped value
- Schema value = 2;
-}
-
-// Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs.
-message NamedSecurityDefinitionsItem {
- // Map key
- string name = 1;
- // Mapped value
- SecurityDefinitionsItem value = 2;
-}
-
-// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
-message NamedString {
- // Map key
- string name = 1;
- // Mapped value
- string value = 2;
-}
-
-// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
-message NamedStringArray {
- // Map key
- string name = 1;
- // Mapped value
- StringArray value = 2;
-}
-
-message NonBodyParameter {
- oneof oneof {
- HeaderParameterSubSchema header_parameter_sub_schema = 1;
- FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
- QueryParameterSubSchema query_parameter_sub_schema = 3;
- PathParameterSubSchema path_parameter_sub_schema = 4;
- }
-}
-
-message Oauth2AccessCodeSecurity {
- string type = 1;
- string flow = 2;
- Oauth2Scopes scopes = 3;
- string authorization_url = 4;
- string token_url = 5;
- string description = 6;
- repeated NamedAny vendor_extension = 7;
-}
-
-message Oauth2ApplicationSecurity {
- string type = 1;
- string flow = 2;
- Oauth2Scopes scopes = 3;
- string token_url = 4;
- string description = 5;
- repeated NamedAny vendor_extension = 6;
-}
-
-message Oauth2ImplicitSecurity {
- string type = 1;
- string flow = 2;
- Oauth2Scopes scopes = 3;
- string authorization_url = 4;
- string description = 5;
- repeated NamedAny vendor_extension = 6;
-}
-
-message Oauth2PasswordSecurity {
- string type = 1;
- string flow = 2;
- Oauth2Scopes scopes = 3;
- string token_url = 4;
- string description = 5;
- repeated NamedAny vendor_extension = 6;
-}
-
-message Oauth2Scopes {
- repeated NamedString additional_properties = 1;
-}
-
-message Operation {
- repeated string tags = 1;
- // A brief summary of the operation.
- string summary = 2;
- // A longer description of the operation, GitHub Flavored Markdown is allowed.
- string description = 3;
- ExternalDocs external_docs = 4;
- // A unique identifier of the operation.
- string operation_id = 5;
- // A list of MIME types the API can produce.
- repeated string produces = 6;
- // A list of MIME types the API can consume.
- repeated string consumes = 7;
- // The parameters needed to send a valid API call.
- repeated ParametersItem parameters = 8;
- Responses responses = 9;
- // The transfer protocol of the API.
- repeated string schemes = 10;
- bool deprecated = 11;
- repeated SecurityRequirement security = 12;
- repeated NamedAny vendor_extension = 13;
-}
-
-message Parameter {
- oneof oneof {
- BodyParameter body_parameter = 1;
- NonBodyParameter non_body_parameter = 2;
- }
-}
-
-// One or more JSON representations for parameters
-message ParameterDefinitions {
- repeated NamedParameter additional_properties = 1;
-}
-
-message ParametersItem {
- oneof oneof {
- Parameter parameter = 1;
- JsonReference json_reference = 2;
- }
-}
-
-message PathItem {
- string _ref = 1;
- Operation get = 2;
- Operation put = 3;
- Operation post = 4;
- Operation delete = 5;
- Operation options = 6;
- Operation head = 7;
- Operation patch = 8;
- // The parameters needed to send a valid API call.
- repeated ParametersItem parameters = 9;
- repeated NamedAny vendor_extension = 10;
-}
-
-message PathParameterSubSchema {
- // Determines whether or not this parameter is required or optional.
- bool required = 1;
- // Determines the location of the parameter.
- string in = 2;
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- string description = 3;
- // The name of the parameter.
- string name = 4;
- string type = 5;
- string format = 6;
- PrimitivesItems items = 7;
- string collection_format = 8;
- Any default = 9;
- double maximum = 10;
- bool exclusive_maximum = 11;
- double minimum = 12;
- bool exclusive_minimum = 13;
- int64 max_length = 14;
- int64 min_length = 15;
- string pattern = 16;
- int64 max_items = 17;
- int64 min_items = 18;
- bool unique_items = 19;
- repeated Any enum = 20;
- double multiple_of = 21;
- repeated NamedAny vendor_extension = 22;
-}
-
-// Relative paths to the individual endpoints. They must be relative to the 'basePath'.
-message Paths {
- repeated NamedAny vendor_extension = 1;
- repeated NamedPathItem path = 2;
-}
-
-message PrimitivesItems {
- string type = 1;
- string format = 2;
- PrimitivesItems items = 3;
- string collection_format = 4;
- Any default = 5;
- double maximum = 6;
- bool exclusive_maximum = 7;
- double minimum = 8;
- bool exclusive_minimum = 9;
- int64 max_length = 10;
- int64 min_length = 11;
- string pattern = 12;
- int64 max_items = 13;
- int64 min_items = 14;
- bool unique_items = 15;
- repeated Any enum = 16;
- double multiple_of = 17;
- repeated NamedAny vendor_extension = 18;
-}
-
-message Properties {
- repeated NamedSchema additional_properties = 1;
-}
-
-message QueryParameterSubSchema {
- // Determines whether or not this parameter is required or optional.
- bool required = 1;
- // Determines the location of the parameter.
- string in = 2;
- // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
- string description = 3;
- // The name of the parameter.
- string name = 4;
- // allows sending a parameter by name only or with an empty value.
- bool allow_empty_value = 5;
- string type = 6;
- string format = 7;
- PrimitivesItems items = 8;
- string collection_format = 9;
- Any default = 10;
- double maximum = 11;
- bool exclusive_maximum = 12;
- double minimum = 13;
- bool exclusive_minimum = 14;
- int64 max_length = 15;
- int64 min_length = 16;
- string pattern = 17;
- int64 max_items = 18;
- int64 min_items = 19;
- bool unique_items = 20;
- repeated Any enum = 21;
- double multiple_of = 22;
- repeated NamedAny vendor_extension = 23;
-}
-
-message Response {
- string description = 1;
- SchemaItem schema = 2;
- Headers headers = 3;
- Examples examples = 4;
- repeated NamedAny vendor_extension = 5;
-}
-
-// One or more JSON representations for parameters
-message ResponseDefinitions {
- repeated NamedResponse additional_properties = 1;
-}
-
-message ResponseValue {
- oneof oneof {
- Response response = 1;
- JsonReference json_reference = 2;
- }
-}
-
-// Response objects names can either be any valid HTTP status code or 'default'.
-message Responses {
- repeated NamedResponseValue response_code = 1;
- repeated NamedAny vendor_extension = 2;
-}
-
-// A deterministic version of a JSON Schema object.
-message Schema {
- string _ref = 1;
- string format = 2;
- string title = 3;
- string description = 4;
- Any default = 5;
- double multiple_of = 6;
- double maximum = 7;
- bool exclusive_maximum = 8;
- double minimum = 9;
- bool exclusive_minimum = 10;
- int64 max_length = 11;
- int64 min_length = 12;
- string pattern = 13;
- int64 max_items = 14;
- int64 min_items = 15;
- bool unique_items = 16;
- int64 max_properties = 17;
- int64 min_properties = 18;
- repeated string required = 19;
- repeated Any enum = 20;
- AdditionalPropertiesItem additional_properties = 21;
- TypeItem type = 22;
- ItemsItem items = 23;
- repeated Schema all_of = 24;
- Properties properties = 25;
- string discriminator = 26;
- bool read_only = 27;
- Xml xml = 28;
- ExternalDocs external_docs = 29;
- Any example = 30;
- repeated NamedAny vendor_extension = 31;
-}
-
-message SchemaItem {
- oneof oneof {
- Schema schema = 1;
- FileSchema file_schema = 2;
- }
-}
-
-message SecurityDefinitions {
- repeated NamedSecurityDefinitionsItem additional_properties = 1;
-}
-
-message SecurityDefinitionsItem {
- oneof oneof {
- BasicAuthenticationSecurity basic_authentication_security = 1;
- ApiKeySecurity api_key_security = 2;
- Oauth2ImplicitSecurity oauth2_implicit_security = 3;
- Oauth2PasswordSecurity oauth2_password_security = 4;
- Oauth2ApplicationSecurity oauth2_application_security = 5;
- Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
- }
-}
-
-message SecurityRequirement {
- repeated NamedStringArray additional_properties = 1;
-}
-
-message StringArray {
- repeated string value = 1;
-}
-
-message Tag {
- string name = 1;
- string description = 2;
- ExternalDocs external_docs = 3;
- repeated NamedAny vendor_extension = 4;
-}
-
-message TypeItem {
- repeated string value = 1;
-}
-
-// Any property starting with x- is valid.
-message VendorExtension {
- repeated NamedAny additional_properties = 1;
-}
-
-message Xml {
- string name = 1;
- string namespace = 2;
- string prefix = 3;
- bool attribute = 4;
- bool wrapped = 5;
- repeated NamedAny vendor_extension = 6;
-}
-
diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/README.md b/vendor/github.com/googleapis/gnostic/OpenAPIv2/README.md
deleted file mode 100644
index 836fb32a..00000000
--- a/vendor/github.com/googleapis/gnostic/OpenAPIv2/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# OpenAPI v2 Protocol Buffer Models
-
-This directory contains a Protocol Buffer-language model
-and related code for supporting OpenAPI v2.
-
-Gnostic applications and plugins can use OpenAPIv2.proto
-to generate Protocol Buffer support code for their preferred languages.
-
-OpenAPIv2.go is used by Gnostic to read JSON and YAML OpenAPI
-descriptions into the Protocol Buffer-based datastructures
-generated from OpenAPIv2.proto.
-
-OpenAPIv2.proto and OpenAPIv2.go are generated by the Gnostic
-compiler generator, and OpenAPIv2.pb.go is generated by
-protoc, the Protocol Buffer compiler, and protoc-gen-go, the
-Protocol Buffer Go code generation plugin.
diff --git a/vendor/github.com/googleapis/gnostic/OpenAPIv2/openapi-2.0.json b/vendor/github.com/googleapis/gnostic/OpenAPIv2/openapi-2.0.json
deleted file mode 100644
index 2815a26e..00000000
--- a/vendor/github.com/googleapis/gnostic/OpenAPIv2/openapi-2.0.json
+++ /dev/null
@@ -1,1610 +0,0 @@
-{
- "title": "A JSON Schema for Swagger 2.0 API.",
- "id": "http://swagger.io/v2/schema.json#",
- "$schema": "http://json-schema.org/draft-04/schema#",
- "type": "object",
- "required": [
- "swagger",
- "info",
- "paths"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "swagger": {
- "type": "string",
- "enum": [
- "2.0"
- ],
- "description": "The Swagger version of this document."
- },
- "info": {
- "$ref": "#/definitions/info"
- },
- "host": {
- "type": "string",
- "pattern": "^[^{}/ :\\\\]+(?::\\d+)?$",
- "description": "The host (name or ip) of the API. Example: 'swagger.io'"
- },
- "basePath": {
- "type": "string",
- "pattern": "^/",
- "description": "The base path to the API. Example: '/api'."
- },
- "schemes": {
- "$ref": "#/definitions/schemesList"
- },
- "consumes": {
- "description": "A list of MIME types accepted by the API.",
- "allOf": [
- {
- "$ref": "#/definitions/mediaTypeList"
- }
- ]
- },
- "produces": {
- "description": "A list of MIME types the API can produce.",
- "allOf": [
- {
- "$ref": "#/definitions/mediaTypeList"
- }
- ]
- },
- "paths": {
- "$ref": "#/definitions/paths"
- },
- "definitions": {
- "$ref": "#/definitions/definitions"
- },
- "parameters": {
- "$ref": "#/definitions/parameterDefinitions"
- },
- "responses": {
- "$ref": "#/definitions/responseDefinitions"
- },
- "security": {
- "$ref": "#/definitions/security"
- },
- "securityDefinitions": {
- "$ref": "#/definitions/securityDefinitions"
- },
- "tags": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/tag"
- },
- "uniqueItems": true
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- }
- },
- "definitions": {
- "info": {
- "type": "object",
- "description": "General information about the API.",
- "required": [
- "version",
- "title"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "title": {
- "type": "string",
- "description": "A unique and precise title of the API."
- },
- "version": {
- "type": "string",
- "description": "A semantic version number of the API."
- },
- "description": {
- "type": "string",
- "description": "A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed."
- },
- "termsOfService": {
- "type": "string",
- "description": "The terms of service for the API."
- },
- "contact": {
- "$ref": "#/definitions/contact"
- },
- "license": {
- "$ref": "#/definitions/license"
- }
- }
- },
- "contact": {
- "type": "object",
- "description": "Contact information for the owners of the API.",
- "additionalProperties": false,
- "properties": {
- "name": {
- "type": "string",
- "description": "The identifying name of the contact person/organization."
- },
- "url": {
- "type": "string",
- "description": "The URL pointing to the contact information.",
- "format": "uri"
- },
- "email": {
- "type": "string",
- "description": "The email address of the contact person/organization.",
- "format": "email"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "license": {
- "type": "object",
- "required": [
- "name"
- ],
- "additionalProperties": false,
- "properties": {
- "name": {
- "type": "string",
- "description": "The name of the license type. It's encouraged to use an OSI compatible license."
- },
- "url": {
- "type": "string",
- "description": "The URL pointing to the license.",
- "format": "uri"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "paths": {
- "type": "object",
- "description": "Relative paths to the individual endpoints. They must be relative to the 'basePath'.",
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- },
- "^/": {
- "$ref": "#/definitions/pathItem"
- }
- },
- "additionalProperties": false
- },
- "definitions": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/schema"
- },
- "description": "One or more JSON objects describing the schemas being consumed and produced by the API."
- },
- "parameterDefinitions": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/parameter"
- },
- "description": "One or more JSON representations for parameters"
- },
- "responseDefinitions": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/response"
- },
- "description": "One or more JSON representations for parameters"
- },
- "externalDocs": {
- "type": "object",
- "additionalProperties": false,
- "description": "information about external documentation",
- "required": [
- "url"
- ],
- "properties": {
- "description": {
- "type": "string"
- },
- "url": {
- "type": "string",
- "format": "uri"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "examples": {
- "type": "object",
- "additionalProperties": true
- },
- "mimeType": {
- "type": "string",
- "description": "The MIME type of the HTTP message."
- },
- "operation": {
- "type": "object",
- "required": [
- "responses"
- ],
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "tags": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- },
- "summary": {
- "type": "string",
- "description": "A brief summary of the operation."
- },
- "description": {
- "type": "string",
- "description": "A longer description of the operation, GitHub Flavored Markdown is allowed."
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "operationId": {
- "type": "string",
- "description": "A unique identifier of the operation."
- },
- "produces": {
- "description": "A list of MIME types the API can produce.",
- "allOf": [
- {
- "$ref": "#/definitions/mediaTypeList"
- }
- ]
- },
- "consumes": {
- "description": "A list of MIME types the API can consume.",
- "allOf": [
- {
- "$ref": "#/definitions/mediaTypeList"
- }
- ]
- },
- "parameters": {
- "$ref": "#/definitions/parametersList"
- },
- "responses": {
- "$ref": "#/definitions/responses"
- },
- "schemes": {
- "$ref": "#/definitions/schemesList"
- },
- "deprecated": {
- "type": "boolean",
- "default": false
- },
- "security": {
- "$ref": "#/definitions/security"
- }
- }
- },
- "pathItem": {
- "type": "object",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "$ref": {
- "type": "string"
- },
- "get": {
- "$ref": "#/definitions/operation"
- },
- "put": {
- "$ref": "#/definitions/operation"
- },
- "post": {
- "$ref": "#/definitions/operation"
- },
- "delete": {
- "$ref": "#/definitions/operation"
- },
- "options": {
- "$ref": "#/definitions/operation"
- },
- "head": {
- "$ref": "#/definitions/operation"
- },
- "patch": {
- "$ref": "#/definitions/operation"
- },
- "parameters": {
- "$ref": "#/definitions/parametersList"
- }
- }
- },
- "responses": {
- "type": "object",
- "description": "Response objects names can either be any valid HTTP status code or 'default'.",
- "minProperties": 1,
- "additionalProperties": false,
- "patternProperties": {
- "^([0-9]{3})$|^(default)$": {
- "$ref": "#/definitions/responseValue"
- },
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "not": {
- "type": "object",
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- }
- },
- "responseValue": {
- "oneOf": [
- {
- "$ref": "#/definitions/response"
- },
- {
- "$ref": "#/definitions/jsonReference"
- }
- ]
- },
- "response": {
- "type": "object",
- "required": [
- "description"
- ],
- "properties": {
- "description": {
- "type": "string"
- },
- "schema": {
- "oneOf": [
- {
- "$ref": "#/definitions/schema"
- },
- {
- "$ref": "#/definitions/fileSchema"
- }
- ]
- },
- "headers": {
- "$ref": "#/definitions/headers"
- },
- "examples": {
- "$ref": "#/definitions/examples"
- }
- },
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "headers": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/header"
- }
- },
- "header": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "integer",
- "boolean",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormat"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "vendorExtension": {
- "description": "Any property starting with x- is valid.",
- "additionalProperties": true,
- "additionalItems": true
- },
- "bodyParameter": {
- "type": "object",
- "required": [
- "name",
- "in",
- "schema"
- ],
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "body"
- ]
- },
- "required": {
- "type": "boolean",
- "description": "Determines whether or not this parameter is required or optional.",
- "default": false
- },
- "schema": {
- "$ref": "#/definitions/schema"
- }
- },
- "additionalProperties": false
- },
- "headerParameterSubSchema": {
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "required": {
- "type": "boolean",
- "description": "Determines whether or not this parameter is required or optional.",
- "default": false
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "header"
- ]
- },
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "boolean",
- "integer",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormat"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- }
- },
- "queryParameterSubSchema": {
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "required": {
- "type": "boolean",
- "description": "Determines whether or not this parameter is required or optional.",
- "default": false
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "query"
- ]
- },
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "allowEmptyValue": {
- "type": "boolean",
- "default": false,
- "description": "allows sending a parameter by name only or with an empty value."
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "boolean",
- "integer",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormatWithMulti"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- }
- },
- "formDataParameterSubSchema": {
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "required": {
- "type": "boolean",
- "description": "Determines whether or not this parameter is required or optional.",
- "default": false
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "formData"
- ]
- },
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "allowEmptyValue": {
- "type": "boolean",
- "default": false,
- "description": "allows sending a parameter by name only or with an empty value."
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "boolean",
- "integer",
- "array",
- "file"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormatWithMulti"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- }
- },
- "pathParameterSubSchema": {
- "additionalProperties": false,
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "required": [
- "required"
- ],
- "properties": {
- "required": {
- "type": "boolean",
- "enum": [
- true
- ],
- "description": "Determines whether or not this parameter is required or optional."
- },
- "in": {
- "type": "string",
- "description": "Determines the location of the parameter.",
- "enum": [
- "path"
- ]
- },
- "description": {
- "type": "string",
- "description": "A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed."
- },
- "name": {
- "type": "string",
- "description": "The name of the parameter."
- },
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "boolean",
- "integer",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormat"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- }
- },
- "nonBodyParameter": {
- "type": "object",
- "required": [
- "name",
- "in",
- "type"
- ],
- "oneOf": [
- {
- "$ref": "#/definitions/headerParameterSubSchema"
- },
- {
- "$ref": "#/definitions/formDataParameterSubSchema"
- },
- {
- "$ref": "#/definitions/queryParameterSubSchema"
- },
- {
- "$ref": "#/definitions/pathParameterSubSchema"
- }
- ]
- },
- "parameter": {
- "oneOf": [
- {
- "$ref": "#/definitions/bodyParameter"
- },
- {
- "$ref": "#/definitions/nonBodyParameter"
- }
- ]
- },
- "schema": {
- "type": "object",
- "description": "A deterministic version of a JSON Schema object.",
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "properties": {
- "$ref": {
- "type": "string"
- },
- "format": {
- "type": "string"
- },
- "title": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
- },
- "description": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
- },
- "default": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
- },
- "multipleOf": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
- },
- "maximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "pattern": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
- },
- "maxItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "uniqueItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
- },
- "maxProperties": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minProperties": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "required": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
- },
- "enum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
- },
- "additionalProperties": {
- "oneOf": [
- {
- "$ref": "#/definitions/schema"
- },
- {
- "type": "boolean"
- }
- ],
- "default": {}
- },
- "type": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/type"
- },
- "items": {
- "anyOf": [
- {
- "$ref": "#/definitions/schema"
- },
- {
- "type": "array",
- "minItems": 1,
- "items": {
- "$ref": "#/definitions/schema"
- }
- }
- ],
- "default": {}
- },
- "allOf": {
- "type": "array",
- "minItems": 1,
- "items": {
- "$ref": "#/definitions/schema"
- }
- },
- "properties": {
- "type": "object",
- "additionalProperties": {
- "$ref": "#/definitions/schema"
- },
- "default": {}
- },
- "discriminator": {
- "type": "string"
- },
- "readOnly": {
- "type": "boolean",
- "default": false
- },
- "xml": {
- "$ref": "#/definitions/xml"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "example": {}
- },
- "additionalProperties": false
- },
- "fileSchema": {
- "type": "object",
- "description": "A deterministic version of a JSON Schema object.",
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- },
- "required": [
- "type"
- ],
- "properties": {
- "format": {
- "type": "string"
- },
- "title": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
- },
- "description": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
- },
- "default": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
- },
- "required": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/stringArray"
- },
- "type": {
- "type": "string",
- "enum": [
- "file"
- ]
- },
- "readOnly": {
- "type": "boolean",
- "default": false
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- },
- "example": {}
- },
- "additionalProperties": false
- },
- "primitivesItems": {
- "type": "object",
- "additionalProperties": false,
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "string",
- "number",
- "integer",
- "boolean",
- "array"
- ]
- },
- "format": {
- "type": "string"
- },
- "items": {
- "$ref": "#/definitions/primitivesItems"
- },
- "collectionFormat": {
- "$ref": "#/definitions/collectionFormat"
- },
- "default": {
- "$ref": "#/definitions/default"
- },
- "maximum": {
- "$ref": "#/definitions/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "#/definitions/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "#/definitions/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "#/definitions/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "#/definitions/maxLength"
- },
- "minLength": {
- "$ref": "#/definitions/minLength"
- },
- "pattern": {
- "$ref": "#/definitions/pattern"
- },
- "maxItems": {
- "$ref": "#/definitions/maxItems"
- },
- "minItems": {
- "$ref": "#/definitions/minItems"
- },
- "uniqueItems": {
- "$ref": "#/definitions/uniqueItems"
- },
- "enum": {
- "$ref": "#/definitions/enum"
- },
- "multipleOf": {
- "$ref": "#/definitions/multipleOf"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "security": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/securityRequirement"
- },
- "uniqueItems": true
- },
- "securityRequirement": {
- "type": "object",
- "additionalProperties": {
- "type": "array",
- "items": {
- "type": "string"
- },
- "uniqueItems": true
- }
- },
- "xml": {
- "type": "object",
- "additionalProperties": false,
- "properties": {
- "name": {
- "type": "string"
- },
- "namespace": {
- "type": "string"
- },
- "prefix": {
- "type": "string"
- },
- "attribute": {
- "type": "boolean",
- "default": false
- },
- "wrapped": {
- "type": "boolean",
- "default": false
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "tag": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "name"
- ],
- "properties": {
- "name": {
- "type": "string"
- },
- "description": {
- "type": "string"
- },
- "externalDocs": {
- "$ref": "#/definitions/externalDocs"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "securityDefinitions": {
- "type": "object",
- "additionalProperties": {
- "oneOf": [
- {
- "$ref": "#/definitions/basicAuthenticationSecurity"
- },
- {
- "$ref": "#/definitions/apiKeySecurity"
- },
- {
- "$ref": "#/definitions/oauth2ImplicitSecurity"
- },
- {
- "$ref": "#/definitions/oauth2PasswordSecurity"
- },
- {
- "$ref": "#/definitions/oauth2ApplicationSecurity"
- },
- {
- "$ref": "#/definitions/oauth2AccessCodeSecurity"
- }
- ]
- }
- },
- "basicAuthenticationSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "basic"
- ]
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "apiKeySecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "name",
- "in"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "apiKey"
- ]
- },
- "name": {
- "type": "string"
- },
- "in": {
- "type": "string",
- "enum": [
- "header",
- "query"
- ]
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2ImplicitSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "flow",
- "authorizationUrl"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "oauth2"
- ]
- },
- "flow": {
- "type": "string",
- "enum": [
- "implicit"
- ]
- },
- "scopes": {
- "$ref": "#/definitions/oauth2Scopes"
- },
- "authorizationUrl": {
- "type": "string",
- "format": "uri"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2PasswordSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "flow",
- "tokenUrl"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "oauth2"
- ]
- },
- "flow": {
- "type": "string",
- "enum": [
- "password"
- ]
- },
- "scopes": {
- "$ref": "#/definitions/oauth2Scopes"
- },
- "tokenUrl": {
- "type": "string",
- "format": "uri"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2ApplicationSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "flow",
- "tokenUrl"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "oauth2"
- ]
- },
- "flow": {
- "type": "string",
- "enum": [
- "application"
- ]
- },
- "scopes": {
- "$ref": "#/definitions/oauth2Scopes"
- },
- "tokenUrl": {
- "type": "string",
- "format": "uri"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2AccessCodeSecurity": {
- "type": "object",
- "additionalProperties": false,
- "required": [
- "type",
- "flow",
- "authorizationUrl",
- "tokenUrl"
- ],
- "properties": {
- "type": {
- "type": "string",
- "enum": [
- "oauth2"
- ]
- },
- "flow": {
- "type": "string",
- "enum": [
- "accessCode"
- ]
- },
- "scopes": {
- "$ref": "#/definitions/oauth2Scopes"
- },
- "authorizationUrl": {
- "type": "string",
- "format": "uri"
- },
- "tokenUrl": {
- "type": "string",
- "format": "uri"
- },
- "description": {
- "type": "string"
- }
- },
- "patternProperties": {
- "^x-": {
- "$ref": "#/definitions/vendorExtension"
- }
- }
- },
- "oauth2Scopes": {
- "type": "object",
- "additionalProperties": {
- "type": "string"
- }
- },
- "mediaTypeList": {
- "type": "array",
- "items": {
- "$ref": "#/definitions/mimeType"
- },
- "uniqueItems": true
- },
- "parametersList": {
- "type": "array",
- "description": "The parameters needed to send a valid API call.",
- "additionalItems": false,
- "items": {
- "oneOf": [
- {
- "$ref": "#/definitions/parameter"
- },
- {
- "$ref": "#/definitions/jsonReference"
- }
- ]
- },
- "uniqueItems": true
- },
- "schemesList": {
- "type": "array",
- "description": "The transfer protocol of the API.",
- "items": {
- "type": "string",
- "enum": [
- "http",
- "https",
- "ws",
- "wss"
- ]
- },
- "uniqueItems": true
- },
- "collectionFormat": {
- "type": "string",
- "enum": [
- "csv",
- "ssv",
- "tsv",
- "pipes"
- ],
- "default": "csv"
- },
- "collectionFormatWithMulti": {
- "type": "string",
- "enum": [
- "csv",
- "ssv",
- "tsv",
- "pipes",
- "multi"
- ],
- "default": "csv"
- },
- "title": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/title"
- },
- "description": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/description"
- },
- "default": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/default"
- },
- "multipleOf": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
- },
- "maximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
- },
- "exclusiveMaximum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
- },
- "minimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
- },
- "exclusiveMinimum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
- },
- "maxLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minLength": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "pattern": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
- },
- "maxItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
- },
- "minItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
- },
- "uniqueItems": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
- },
- "enum": {
- "$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
- },
- "jsonReference": {
- "type": "object",
- "required": [
- "$ref"
- ],
- "additionalProperties": false,
- "properties": {
- "$ref": {
- "type": "string"
- },
- "description": {
- "type": "string"
- }
- }
- }
- }
-}
diff --git a/vendor/github.com/googleapis/gnostic/compiler/README.md b/vendor/github.com/googleapis/gnostic/compiler/README.md
deleted file mode 100644
index 848b16c6..00000000
--- a/vendor/github.com/googleapis/gnostic/compiler/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# Compiler support code
-
-This directory contains compiler support code used by Gnostic and Gnostic extensions.
\ No newline at end of file
diff --git a/vendor/github.com/googleapis/gnostic/compiler/context.go b/vendor/github.com/googleapis/gnostic/compiler/context.go
deleted file mode 100644
index a64c1b75..00000000
--- a/vendor/github.com/googleapis/gnostic/compiler/context.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package compiler
-
-// Context contains state of the compiler as it traverses a document.
-type Context struct {
- Parent *Context
- Name string
- ExtensionHandlers *[]ExtensionHandler
-}
-
-// NewContextWithExtensions returns a new object representing the compiler state
-func NewContextWithExtensions(name string, parent *Context, extensionHandlers *[]ExtensionHandler) *Context {
- return &Context{Name: name, Parent: parent, ExtensionHandlers: extensionHandlers}
-}
-
-// NewContext returns a new object representing the compiler state
-func NewContext(name string, parent *Context) *Context {
- if parent != nil {
- return &Context{Name: name, Parent: parent, ExtensionHandlers: parent.ExtensionHandlers}
- }
- return &Context{Name: name, Parent: parent, ExtensionHandlers: nil}
-}
-
-// Description returns a text description of the compiler state
-func (context *Context) Description() string {
- if context.Parent != nil {
- return context.Parent.Description() + "." + context.Name
- }
- return context.Name
-}
diff --git a/vendor/github.com/googleapis/gnostic/compiler/error.go b/vendor/github.com/googleapis/gnostic/compiler/error.go
deleted file mode 100644
index d8672c10..00000000
--- a/vendor/github.com/googleapis/gnostic/compiler/error.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package compiler
-
-// Error represents compiler errors and their location in the document.
-type Error struct {
- Context *Context
- Message string
-}
-
-// NewError creates an Error.
-func NewError(context *Context, message string) *Error {
- return &Error{Context: context, Message: message}
-}
-
-// Error returns the string value of an Error.
-func (err *Error) Error() string {
- if err.Context == nil {
- return "ERROR " + err.Message
- }
- return "ERROR " + err.Context.Description() + " " + err.Message
-}
-
-// ErrorGroup is a container for groups of Error values.
-type ErrorGroup struct {
- Errors []error
-}
-
-// NewErrorGroupOrNil returns a new ErrorGroup for a slice of errors or nil if the slice is empty.
-func NewErrorGroupOrNil(errors []error) error {
- if len(errors) == 0 {
- return nil
- } else if len(errors) == 1 {
- return errors[0]
- } else {
- return &ErrorGroup{Errors: errors}
- }
-}
-
-func (group *ErrorGroup) Error() string {
- result := ""
- for i, err := range group.Errors {
- if i > 0 {
- result += "\n"
- }
- result += err.Error()
- }
- return result
-}
diff --git a/vendor/github.com/googleapis/gnostic/compiler/extension-handler.go b/vendor/github.com/googleapis/gnostic/compiler/extension-handler.go
deleted file mode 100644
index 1f85b650..00000000
--- a/vendor/github.com/googleapis/gnostic/compiler/extension-handler.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package compiler
-
-import (
- "bytes"
- "fmt"
- "os/exec"
-
- "strings"
-
- "errors"
-
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes/any"
- ext_plugin "github.com/googleapis/gnostic/extensions"
- yaml "gopkg.in/yaml.v2"
-)
-
-// ExtensionHandler describes a binary that is called by the compiler to handle specification extensions.
-type ExtensionHandler struct {
- Name string
-}
-
-// HandleExtension calls a binary extension handler.
-func HandleExtension(context *Context, in interface{}, extensionName string) (bool, *any.Any, error) {
- handled := false
- var errFromPlugin error
- var outFromPlugin *any.Any
-
- if context != nil && context.ExtensionHandlers != nil && len(*(context.ExtensionHandlers)) != 0 {
- for _, customAnyProtoGenerator := range *(context.ExtensionHandlers) {
- outFromPlugin, errFromPlugin = customAnyProtoGenerator.handle(in, extensionName)
- if outFromPlugin == nil {
- continue
- } else {
- handled = true
- break
- }
- }
- }
- return handled, outFromPlugin, errFromPlugin
-}
-
-func (extensionHandlers *ExtensionHandler) handle(in interface{}, extensionName string) (*any.Any, error) {
- if extensionHandlers.Name != "" {
- binary, _ := yaml.Marshal(in)
-
- request := &ext_plugin.ExtensionHandlerRequest{}
-
- version := &ext_plugin.Version{}
- version.Major = 0
- version.Minor = 1
- version.Patch = 0
- request.CompilerVersion = version
-
- request.Wrapper = &ext_plugin.Wrapper{}
-
- request.Wrapper.Version = "v2"
- request.Wrapper.Yaml = string(binary)
- request.Wrapper.ExtensionName = extensionName
-
- requestBytes, _ := proto.Marshal(request)
- cmd := exec.Command(extensionHandlers.Name)
- cmd.Stdin = bytes.NewReader(requestBytes)
- output, err := cmd.Output()
-
- if err != nil {
- fmt.Printf("Error: %+v\n", err)
- return nil, err
- }
- response := &ext_plugin.ExtensionHandlerResponse{}
- err = proto.Unmarshal(output, response)
- if err != nil {
- fmt.Printf("Error: %+v\n", err)
- fmt.Printf("%s\n", string(output))
- return nil, err
- }
- if !response.Handled {
- return nil, nil
- }
- if len(response.Error) != 0 {
- message := fmt.Sprintf("Errors when parsing: %+v for field %s by vendor extension handler %s. Details %+v", in, extensionName, extensionHandlers.Name, strings.Join(response.Error, ","))
- return nil, errors.New(message)
- }
- return response.Value, nil
- }
- return nil, nil
-}
diff --git a/vendor/github.com/googleapis/gnostic/compiler/helpers.go b/vendor/github.com/googleapis/gnostic/compiler/helpers.go
deleted file mode 100644
index 76df635f..00000000
--- a/vendor/github.com/googleapis/gnostic/compiler/helpers.go
+++ /dev/null
@@ -1,197 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package compiler
-
-import (
- "fmt"
- "gopkg.in/yaml.v2"
- "regexp"
- "sort"
- "strconv"
-)
-
-// compiler helper functions, usually called from generated code
-
-// UnpackMap gets a yaml.MapSlice if possible.
-func UnpackMap(in interface{}) (yaml.MapSlice, bool) {
- m, ok := in.(yaml.MapSlice)
- if ok {
- return m, true
- }
- // do we have an empty array?
- a, ok := in.([]interface{})
- if ok && len(a) == 0 {
- // if so, return an empty map
- return yaml.MapSlice{}, true
- }
- return nil, false
-}
-
-// SortedKeysForMap returns the sorted keys of a yaml.MapSlice.
-func SortedKeysForMap(m yaml.MapSlice) []string {
- keys := make([]string, 0)
- for _, item := range m {
- keys = append(keys, item.Key.(string))
- }
- sort.Strings(keys)
- return keys
-}
-
-// MapHasKey returns true if a yaml.MapSlice contains a specified key.
-func MapHasKey(m yaml.MapSlice, key string) bool {
- for _, item := range m {
- itemKey, ok := item.Key.(string)
- if ok && key == itemKey {
- return true
- }
- }
- return false
-}
-
-// MapValueForKey gets the value of a map value for a specified key.
-func MapValueForKey(m yaml.MapSlice, key string) interface{} {
- for _, item := range m {
- itemKey, ok := item.Key.(string)
- if ok && key == itemKey {
- return item.Value
- }
- }
- return nil
-}
-
-// ConvertInterfaceArrayToStringArray converts an array of interfaces to an array of strings, if possible.
-func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string {
- stringArray := make([]string, 0)
- for _, item := range interfaceArray {
- v, ok := item.(string)
- if ok {
- stringArray = append(stringArray, v)
- }
- }
- return stringArray
-}
-
-// MissingKeysInMap identifies which keys from a list of required keys are not in a map.
-func MissingKeysInMap(m yaml.MapSlice, requiredKeys []string) []string {
- missingKeys := make([]string, 0)
- for _, k := range requiredKeys {
- if !MapHasKey(m, k) {
- missingKeys = append(missingKeys, k)
- }
- }
- return missingKeys
-}
-
-// InvalidKeysInMap returns keys in a map that don't match a list of allowed keys and patterns.
-func InvalidKeysInMap(m yaml.MapSlice, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string {
- invalidKeys := make([]string, 0)
- for _, item := range m {
- itemKey, ok := item.Key.(string)
- if ok {
- key := itemKey
- found := false
- // does the key match an allowed key?
- for _, allowedKey := range allowedKeys {
- if key == allowedKey {
- found = true
- break
- }
- }
- if !found {
- // does the key match an allowed pattern?
- for _, allowedPattern := range allowedPatterns {
- if allowedPattern.MatchString(key) {
- found = true
- break
- }
- }
- if !found {
- invalidKeys = append(invalidKeys, key)
- }
- }
- }
- }
- return invalidKeys
-}
-
-// DescribeMap describes a map (for debugging purposes).
-func DescribeMap(in interface{}, indent string) string {
- description := ""
- m, ok := in.(map[string]interface{})
- if ok {
- keys := make([]string, 0)
- for k := range m {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- for _, k := range keys {
- v := m[k]
- description += fmt.Sprintf("%s%s:\n", indent, k)
- description += DescribeMap(v, indent+" ")
- }
- return description
- }
- a, ok := in.([]interface{})
- if ok {
- for i, v := range a {
- description += fmt.Sprintf("%s%d:\n", indent, i)
- description += DescribeMap(v, indent+" ")
- }
- return description
- }
- description += fmt.Sprintf("%s%+v\n", indent, in)
- return description
-}
-
-// PluralProperties returns the string "properties" pluralized.
-func PluralProperties(count int) string {
- if count == 1 {
- return "property"
- }
- return "properties"
-}
-
-// StringArrayContainsValue returns true if a string array contains a specified value.
-func StringArrayContainsValue(array []string, value string) bool {
- for _, item := range array {
- if item == value {
- return true
- }
- }
- return false
-}
-
-// StringArrayContainsValues returns true if a string array contains all of a list of specified values.
-func StringArrayContainsValues(array []string, values []string) bool {
- for _, value := range values {
- if !StringArrayContainsValue(array, value) {
- return false
- }
- }
- return true
-}
-
-// StringValue returns the string value of an item.
-func StringValue(item interface{}) (value string, ok bool) {
- value, ok = item.(string)
- if ok {
- return value, ok
- }
- intValue, ok := item.(int)
- if ok {
- return strconv.Itoa(intValue), true
- }
- return "", false
-}
diff --git a/vendor/github.com/googleapis/gnostic/compiler/main.go b/vendor/github.com/googleapis/gnostic/compiler/main.go
deleted file mode 100644
index 9713a21c..00000000
--- a/vendor/github.com/googleapis/gnostic/compiler/main.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package compiler provides support functions to generated compiler code.
-package compiler
diff --git a/vendor/github.com/googleapis/gnostic/compiler/reader.go b/vendor/github.com/googleapis/gnostic/compiler/reader.go
deleted file mode 100644
index c954a2d9..00000000
--- a/vendor/github.com/googleapis/gnostic/compiler/reader.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package compiler
-
-import (
- "errors"
- "fmt"
- "gopkg.in/yaml.v2"
- "io/ioutil"
- "log"
- "net/http"
- "net/url"
- "path/filepath"
- "strings"
-)
-
-var fileCache map[string][]byte
-var infoCache map[string]interface{}
-var count int64
-
-var verboseReader = false
-
-func initializeFileCache() {
- if fileCache == nil {
- fileCache = make(map[string][]byte, 0)
- }
-}
-
-func initializeInfoCache() {
- if infoCache == nil {
- infoCache = make(map[string]interface{}, 0)
- }
-}
-
-// FetchFile gets a specified file from the local filesystem or a remote location.
-func FetchFile(fileurl string) ([]byte, error) {
- initializeFileCache()
- bytes, ok := fileCache[fileurl]
- if ok {
- if verboseReader {
- log.Printf("Cache hit %s", fileurl)
- }
- return bytes, nil
- }
- if verboseReader {
- log.Printf("Fetching %s", fileurl)
- }
- response, err := http.Get(fileurl)
- if err != nil {
- return nil, err
- }
- if response.StatusCode != 200 {
- return nil, errors.New(fmt.Sprintf("Error downloading %s: %s", fileurl, response.Status))
- }
- defer response.Body.Close()
- bytes, err = ioutil.ReadAll(response.Body)
- if err == nil {
- fileCache[fileurl] = bytes
- }
- return bytes, err
-}
-
-// ReadBytesForFile reads the bytes of a file.
-func ReadBytesForFile(filename string) ([]byte, error) {
- // is the filename a url?
- fileurl, _ := url.Parse(filename)
- if fileurl.Scheme != "" {
- // yes, fetch it
- bytes, err := FetchFile(filename)
- if err != nil {
- return nil, err
- }
- return bytes, nil
- }
- // no, it's a local filename
- bytes, err := ioutil.ReadFile(filename)
- if err != nil {
- return nil, err
- }
- return bytes, nil
-}
-
-// ReadInfoFromBytes unmarshals a file as a yaml.MapSlice.
-func ReadInfoFromBytes(filename string, bytes []byte) (interface{}, error) {
- initializeInfoCache()
- cachedInfo, ok := infoCache[filename]
- if ok {
- if verboseReader {
- log.Printf("Cache hit info for file %s", filename)
- }
- return cachedInfo, nil
- }
- if verboseReader {
- log.Printf("Reading info for file %s", filename)
- }
- var info yaml.MapSlice
- err := yaml.Unmarshal(bytes, &info)
- if err != nil {
- return nil, err
- }
- if len(filename) > 0 {
- infoCache[filename] = info
- }
- return info, nil
-}
-
-// ReadInfoForRef reads a file and return the fragment needed to resolve a $ref.
-func ReadInfoForRef(basefile string, ref string) (interface{}, error) {
- initializeInfoCache()
- {
- info, ok := infoCache[ref]
- if ok {
- if verboseReader {
- log.Printf("Cache hit for ref %s#%s", basefile, ref)
- }
- return info, nil
- }
- }
- if verboseReader {
- log.Printf("Reading info for ref %s#%s", basefile, ref)
- }
- count = count + 1
- basedir, _ := filepath.Split(basefile)
- parts := strings.Split(ref, "#")
- var filename string
- if parts[0] != "" {
- filename = basedir + parts[0]
- } else {
- filename = basefile
- }
- bytes, err := ReadBytesForFile(filename)
- if err != nil {
- return nil, err
- }
- info, err := ReadInfoFromBytes(filename, bytes)
- if err != nil {
- log.Printf("File error: %v\n", err)
- } else {
- if len(parts) > 1 {
- path := strings.Split(parts[1], "/")
- for i, key := range path {
- if i > 0 {
- m, ok := info.(yaml.MapSlice)
- if ok {
- found := false
- for _, section := range m {
- if section.Key == key {
- info = section.Value
- found = true
- }
- }
- if !found {
- infoCache[ref] = nil
- return nil, NewError(nil, fmt.Sprintf("could not resolve %s", ref))
- }
- }
- }
- }
- }
- }
- infoCache[ref] = info
- return info, nil
-}
diff --git a/vendor/github.com/googleapis/gnostic/extensions/COMPILE-EXTENSION.sh b/vendor/github.com/googleapis/gnostic/extensions/COMPILE-EXTENSION.sh
deleted file mode 100755
index 68d02a02..00000000
--- a/vendor/github.com/googleapis/gnostic/extensions/COMPILE-EXTENSION.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-go get github.com/golang/protobuf/protoc-gen-go
-
-protoc \
---go_out=Mgoogle/protobuf/any.proto=github.com/golang/protobuf/ptypes/any:. *.proto
-
diff --git a/vendor/github.com/googleapis/gnostic/extensions/README.md b/vendor/github.com/googleapis/gnostic/extensions/README.md
deleted file mode 100644
index ff1c2eb1..00000000
--- a/vendor/github.com/googleapis/gnostic/extensions/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# Extensions
-
-This directory contains support code for building Gnostic extensions and associated examples.
-
-Extensions are used to compile vendor or specification extensions into protocol buffer structures.
diff --git a/vendor/github.com/googleapis/gnostic/extensions/extension.pb.go b/vendor/github.com/googleapis/gnostic/extensions/extension.pb.go
deleted file mode 100644
index 749ff784..00000000
--- a/vendor/github.com/googleapis/gnostic/extensions/extension.pb.go
+++ /dev/null
@@ -1,218 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: extension.proto
-
-/*
-Package openapiextension_v1 is a generated protocol buffer package.
-
-It is generated from these files:
- extension.proto
-
-It has these top-level messages:
- Version
- ExtensionHandlerRequest
- ExtensionHandlerResponse
- Wrapper
-*/
-package openapiextension_v1
-
-import proto "github.com/golang/protobuf/proto"
-import fmt "fmt"
-import math "math"
-import google_protobuf "github.com/golang/protobuf/ptypes/any"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
-
-// The version number of OpenAPI compiler.
-type Version struct {
- Major int32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"`
- Minor int32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"`
- Patch int32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"`
- // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
- // be empty for mainline stable releases.
- Suffix string `protobuf:"bytes,4,opt,name=suffix" json:"suffix,omitempty"`
-}
-
-func (m *Version) Reset() { *m = Version{} }
-func (m *Version) String() string { return proto.CompactTextString(m) }
-func (*Version) ProtoMessage() {}
-func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
-
-func (m *Version) GetMajor() int32 {
- if m != nil {
- return m.Major
- }
- return 0
-}
-
-func (m *Version) GetMinor() int32 {
- if m != nil {
- return m.Minor
- }
- return 0
-}
-
-func (m *Version) GetPatch() int32 {
- if m != nil {
- return m.Patch
- }
- return 0
-}
-
-func (m *Version) GetSuffix() string {
- if m != nil {
- return m.Suffix
- }
- return ""
-}
-
-// An encoded Request is written to the ExtensionHandler's stdin.
-type ExtensionHandlerRequest struct {
- // The OpenAPI descriptions that were explicitly listed on the command line.
- // The specifications will appear in the order they are specified to gnostic.
- Wrapper *Wrapper `protobuf:"bytes,1,opt,name=wrapper" json:"wrapper,omitempty"`
- // The version number of openapi compiler.
- CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"`
-}
-
-func (m *ExtensionHandlerRequest) Reset() { *m = ExtensionHandlerRequest{} }
-func (m *ExtensionHandlerRequest) String() string { return proto.CompactTextString(m) }
-func (*ExtensionHandlerRequest) ProtoMessage() {}
-func (*ExtensionHandlerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
-
-func (m *ExtensionHandlerRequest) GetWrapper() *Wrapper {
- if m != nil {
- return m.Wrapper
- }
- return nil
-}
-
-func (m *ExtensionHandlerRequest) GetCompilerVersion() *Version {
- if m != nil {
- return m.CompilerVersion
- }
- return nil
-}
-
-// The extensions writes an encoded ExtensionHandlerResponse to stdout.
-type ExtensionHandlerResponse struct {
- // true if the extension is handled by the extension handler; false otherwise
- Handled bool `protobuf:"varint,1,opt,name=handled" json:"handled,omitempty"`
- // Error message. If non-empty, the extension handling failed.
- // The extension handler process should exit with status code zero
- // even if it reports an error in this way.
- //
- // This should be used to indicate errors which prevent the extension from
- // operating as intended. Errors which indicate a problem in gnostic
- // itself -- such as the input Document being unparseable -- should be
- // reported by writing a message to stderr and exiting with a non-zero
- // status code.
- Error []string `protobuf:"bytes,2,rep,name=error" json:"error,omitempty"`
- // text output
- Value *google_protobuf.Any `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"`
-}
-
-func (m *ExtensionHandlerResponse) Reset() { *m = ExtensionHandlerResponse{} }
-func (m *ExtensionHandlerResponse) String() string { return proto.CompactTextString(m) }
-func (*ExtensionHandlerResponse) ProtoMessage() {}
-func (*ExtensionHandlerResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
-
-func (m *ExtensionHandlerResponse) GetHandled() bool {
- if m != nil {
- return m.Handled
- }
- return false
-}
-
-func (m *ExtensionHandlerResponse) GetError() []string {
- if m != nil {
- return m.Error
- }
- return nil
-}
-
-func (m *ExtensionHandlerResponse) GetValue() *google_protobuf.Any {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-type Wrapper struct {
- // version of the OpenAPI specification in which this extension was written.
- Version string `protobuf:"bytes,1,opt,name=version" json:"version,omitempty"`
- // Name of the extension
- ExtensionName string `protobuf:"bytes,2,opt,name=extension_name,json=extensionName" json:"extension_name,omitempty"`
- // Must be a valid yaml for the proto
- Yaml string `protobuf:"bytes,3,opt,name=yaml" json:"yaml,omitempty"`
-}
-
-func (m *Wrapper) Reset() { *m = Wrapper{} }
-func (m *Wrapper) String() string { return proto.CompactTextString(m) }
-func (*Wrapper) ProtoMessage() {}
-func (*Wrapper) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
-
-func (m *Wrapper) GetVersion() string {
- if m != nil {
- return m.Version
- }
- return ""
-}
-
-func (m *Wrapper) GetExtensionName() string {
- if m != nil {
- return m.ExtensionName
- }
- return ""
-}
-
-func (m *Wrapper) GetYaml() string {
- if m != nil {
- return m.Yaml
- }
- return ""
-}
-
-func init() {
- proto.RegisterType((*Version)(nil), "openapiextension.v1.Version")
- proto.RegisterType((*ExtensionHandlerRequest)(nil), "openapiextension.v1.ExtensionHandlerRequest")
- proto.RegisterType((*ExtensionHandlerResponse)(nil), "openapiextension.v1.ExtensionHandlerResponse")
- proto.RegisterType((*Wrapper)(nil), "openapiextension.v1.Wrapper")
-}
-
-func init() { proto.RegisterFile("extension.proto", fileDescriptor0) }
-
-var fileDescriptor0 = []byte{
- // 357 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x4d, 0x4b, 0xc3, 0x40,
- 0x18, 0x84, 0x49, 0xbf, 0x62, 0x56, 0x6c, 0x65, 0x2d, 0x1a, 0xc5, 0x43, 0x09, 0x08, 0x45, 0x64,
- 0x4b, 0x15, 0xbc, 0xb7, 0x50, 0xd4, 0x8b, 0x2d, 0x7b, 0xa8, 0x37, 0xcb, 0x36, 0x7d, 0x9b, 0x46,
- 0x92, 0xdd, 0x75, 0xf3, 0x61, 0xfb, 0x57, 0x3c, 0xfa, 0x4b, 0x25, 0xbb, 0x49, 0x3d, 0xa8, 0xb7,
- 0xcc, 0xc3, 0x24, 0xef, 0xcc, 0x04, 0x75, 0x60, 0x9b, 0x02, 0x4f, 0x42, 0xc1, 0x89, 0x54, 0x22,
- 0x15, 0xf8, 0x44, 0x48, 0xe0, 0x4c, 0x86, 0x3f, 0x3c, 0x1f, 0x5e, 0x9c, 0x07, 0x42, 0x04, 0x11,
- 0x0c, 0xb4, 0x65, 0x99, 0xad, 0x07, 0x8c, 0xef, 0x8c, 0xdf, 0xf3, 0x91, 0x3d, 0x07, 0x55, 0x18,
- 0x71, 0x17, 0x35, 0x63, 0xf6, 0x26, 0x94, 0x6b, 0xf5, 0xac, 0x7e, 0x93, 0x1a, 0xa1, 0x69, 0xc8,
- 0x85, 0x72, 0x6b, 0x25, 0x2d, 0x44, 0x41, 0x25, 0x4b, 0xfd, 0x8d, 0x5b, 0x37, 0x54, 0x0b, 0x7c,
- 0x8a, 0x5a, 0x49, 0xb6, 0x5e, 0x87, 0x5b, 0xb7, 0xd1, 0xb3, 0xfa, 0x0e, 0x2d, 0x95, 0xf7, 0x69,
- 0xa1, 0xb3, 0x49, 0x15, 0xe8, 0x91, 0xf1, 0x55, 0x04, 0x8a, 0xc2, 0x7b, 0x06, 0x49, 0x8a, 0xef,
- 0x91, 0xfd, 0xa1, 0x98, 0x94, 0x60, 0xee, 0x1e, 0xde, 0x5e, 0x92, 0x3f, 0x2a, 0x90, 0x17, 0xe3,
- 0xa1, 0x95, 0x19, 0x3f, 0xa0, 0x63, 0x5f, 0xc4, 0x32, 0x8c, 0x40, 0x2d, 0x72, 0xd3, 0x40, 0x87,
- 0xf9, 0xef, 0x03, 0x65, 0x4b, 0xda, 0xa9, 0xde, 0x2a, 0x81, 0x97, 0x23, 0xf7, 0x77, 0xb6, 0x44,
- 0x0a, 0x9e, 0x00, 0x76, 0x91, 0xbd, 0xd1, 0x68, 0xa5, 0xc3, 0x1d, 0xd0, 0x4a, 0x16, 0x03, 0x80,
- 0x52, 0x7a, 0x96, 0x7a, 0xdf, 0xa1, 0x46, 0xe0, 0x6b, 0xd4, 0xcc, 0x59, 0x94, 0x41, 0x99, 0xa4,
- 0x4b, 0xcc, 0xf0, 0xa4, 0x1a, 0x9e, 0x8c, 0xf8, 0x8e, 0x1a, 0x8b, 0xf7, 0x8a, 0xec, 0xb2, 0x54,
- 0x71, 0xa6, 0xaa, 0x60, 0xe9, 0xe1, 0x2a, 0x89, 0xaf, 0x50, 0x7b, 0xdf, 0x62, 0xc1, 0x59, 0x0c,
- 0xfa, 0x37, 0x38, 0xf4, 0x68, 0x4f, 0x9f, 0x59, 0x0c, 0x18, 0xa3, 0xc6, 0x8e, 0xc5, 0x91, 0x3e,
- 0xeb, 0x50, 0xfd, 0x3c, 0xbe, 0x41, 0x6d, 0xa1, 0x02, 0x12, 0x70, 0x91, 0xa4, 0xa1, 0x4f, 0xf2,
- 0xe1, 0x18, 0x4f, 0x25, 0xf0, 0xd1, 0xec, 0x69, 0x5f, 0x77, 0x3e, 0x9c, 0x59, 0x5f, 0xb5, 0xfa,
- 0x74, 0x34, 0x59, 0xb6, 0x74, 0xc4, 0xbb, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x84, 0x5c, 0x6b,
- 0x80, 0x51, 0x02, 0x00, 0x00,
-}
diff --git a/vendor/github.com/googleapis/gnostic/extensions/extension.proto b/vendor/github.com/googleapis/gnostic/extensions/extension.proto
deleted file mode 100644
index 04856f91..00000000
--- a/vendor/github.com/googleapis/gnostic/extensions/extension.proto
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-syntax = "proto3";
-
-import "google/protobuf/any.proto";
-package openapiextension.v1;
-
-// This option lets the proto compiler generate Java code inside the package
-// name (see below) instead of inside an outer class. It creates a simpler
-// developer experience by reducing one-level of name nesting and be
-// consistent with most programming languages that don't support outer classes.
-option java_multiple_files = true;
-
-// The Java outer classname should be the filename in UpperCamelCase. This
-// class is only used to hold proto descriptor, so developers don't need to
-// work with it directly.
-option java_outer_classname = "OpenAPIExtensionV1";
-
-// The Java package name must be proto package name with proper prefix.
-option java_package = "org.gnostic.v1";
-
-// A reasonable prefix for the Objective-C symbols generated from the package.
-// It should at a minimum be 3 characters long, all uppercase, and convention
-// is to use an abbreviation of the package name. Something short, but
-// hopefully unique enough to not conflict with things that may come along in
-// the future. 'GPB' is reserved for the protocol buffer implementation itself.
-//
-option objc_class_prefix = "OAE"; // "OpenAPI Extension"
-
-// The version number of OpenAPI compiler.
-message Version {
- int32 major = 1;
- int32 minor = 2;
- int32 patch = 3;
- // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
- // be empty for mainline stable releases.
- string suffix = 4;
-}
-
-// An encoded Request is written to the ExtensionHandler's stdin.
-message ExtensionHandlerRequest {
-
- // The OpenAPI descriptions that were explicitly listed on the command line.
- // The specifications will appear in the order they are specified to gnostic.
- Wrapper wrapper = 1;
-
- // The version number of openapi compiler.
- Version compiler_version = 3;
-}
-
-// The extensions writes an encoded ExtensionHandlerResponse to stdout.
-message ExtensionHandlerResponse {
-
- // true if the extension is handled by the extension handler; false otherwise
- bool handled = 1;
-
- // Error message. If non-empty, the extension handling failed.
- // The extension handler process should exit with status code zero
- // even if it reports an error in this way.
- //
- // This should be used to indicate errors which prevent the extension from
- // operating as intended. Errors which indicate a problem in gnostic
- // itself -- such as the input Document being unparseable -- should be
- // reported by writing a message to stderr and exiting with a non-zero
- // status code.
- repeated string error = 2;
-
- // text output
- google.protobuf.Any value = 3;
-}
-
-message Wrapper {
- // version of the OpenAPI specification in which this extension was written.
- string version = 1;
-
- // Name of the extension
- string extension_name = 2;
-
- // Must be a valid yaml for the proto
- string yaml = 3;
-}
diff --git a/vendor/github.com/googleapis/gnostic/extensions/extensions.go b/vendor/github.com/googleapis/gnostic/extensions/extensions.go
deleted file mode 100644
index 94a8e62a..00000000
--- a/vendor/github.com/googleapis/gnostic/extensions/extensions.go
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package openapiextension_v1
-
-import (
- "fmt"
- "io/ioutil"
- "os"
-
- "github.com/golang/protobuf/proto"
- "github.com/golang/protobuf/ptypes"
-)
-
-type documentHandler func(version string, extensionName string, document string)
-type extensionHandler func(name string, yamlInput string) (bool, proto.Message, error)
-
-func forInputYamlFromOpenapic(handler documentHandler) {
- data, err := ioutil.ReadAll(os.Stdin)
- if err != nil {
- fmt.Println("File error:", err.Error())
- os.Exit(1)
- }
- if len(data) == 0 {
- fmt.Println("No input data.")
- os.Exit(1)
- }
- request := &ExtensionHandlerRequest{}
- err = proto.Unmarshal(data, request)
- if err != nil {
- fmt.Println("Input error:", err.Error())
- os.Exit(1)
- }
- handler(request.Wrapper.Version, request.Wrapper.ExtensionName, request.Wrapper.Yaml)
-}
-
-// ProcessExtension calles the handler for a specified extension.
-func ProcessExtension(handleExtension extensionHandler) {
- response := &ExtensionHandlerResponse{}
- forInputYamlFromOpenapic(
- func(version string, extensionName string, yamlInput string) {
- var newObject proto.Message
- var err error
-
- handled, newObject, err := handleExtension(extensionName, yamlInput)
- if !handled {
- responseBytes, _ := proto.Marshal(response)
- os.Stdout.Write(responseBytes)
- os.Exit(0)
- }
-
- // If we reach here, then the extension is handled
- response.Handled = true
- if err != nil {
- response.Error = append(response.Error, err.Error())
- responseBytes, _ := proto.Marshal(response)
- os.Stdout.Write(responseBytes)
- os.Exit(0)
- }
- response.Value, err = ptypes.MarshalAny(newObject)
- if err != nil {
- response.Error = append(response.Error, err.Error())
- responseBytes, _ := proto.Marshal(response)
- os.Stdout.Write(responseBytes)
- os.Exit(0)
- }
- })
-
- responseBytes, _ := proto.Marshal(response)
- os.Stdout.Write(responseBytes)
-}
diff --git a/vendor/github.com/gregjones/httpcache/.travis.yml b/vendor/github.com/gregjones/httpcache/.travis.yml
deleted file mode 100644
index b5ffbe03..00000000
--- a/vendor/github.com/gregjones/httpcache/.travis.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.6.x
- - 1.7.x
- - 1.8.x
- - 1.9.x
- - master
-matrix:
- allow_failures:
- - go: master
- fast_finish: true
-install:
- - # Do nothing. This is needed to prevent default install action "go get -t -v ./..." from happening here (we want it to happen inside script step).
-script:
- - go get -t -v ./...
- - diff -u <(echo -n) <(gofmt -d .)
- - go tool vet .
- - go test -v -race ./...
diff --git a/vendor/github.com/gregjones/httpcache/LICENSE.txt b/vendor/github.com/gregjones/httpcache/LICENSE.txt
deleted file mode 100644
index 81316beb..00000000
--- a/vendor/github.com/gregjones/httpcache/LICENSE.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright © 2012 Greg Jones (greg.jones@gmail.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/vendor/github.com/gregjones/httpcache/README.md b/vendor/github.com/gregjones/httpcache/README.md
deleted file mode 100644
index 09c9e7c1..00000000
--- a/vendor/github.com/gregjones/httpcache/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-httpcache
-=========
-
-[](https://travis-ci.org/gregjones/httpcache) [](https://godoc.org/github.com/gregjones/httpcache)
-
-Package httpcache provides a http.RoundTripper implementation that works as a mostly [RFC 7234](https://tools.ietf.org/html/rfc7234) compliant cache for http responses.
-
-It is only suitable for use as a 'private' cache (i.e. for a web-browser or an API-client and not for a shared proxy).
-
-Cache Backends
---------------
-
-- The built-in 'memory' cache stores responses in an in-memory map.
-- [`github.com/gregjones/httpcache/diskcache`](https://github.com/gregjones/httpcache/tree/master/diskcache) provides a filesystem-backed cache using the [diskv](https://github.com/peterbourgon/diskv) library.
-- [`github.com/gregjones/httpcache/memcache`](https://github.com/gregjones/httpcache/tree/master/memcache) provides memcache implementations, for both App Engine and 'normal' memcache servers.
-- [`sourcegraph.com/sourcegraph/s3cache`](https://sourcegraph.com/github.com/sourcegraph/s3cache) uses Amazon S3 for storage.
-- [`github.com/gregjones/httpcache/leveldbcache`](https://github.com/gregjones/httpcache/tree/master/leveldbcache) provides a filesystem-backed cache using [leveldb](https://github.com/syndtr/goleveldb/leveldb).
-- [`github.com/die-net/lrucache`](https://github.com/die-net/lrucache) provides an in-memory cache that will evict least-recently used entries.
-- [`github.com/die-net/lrucache/twotier`](https://github.com/die-net/lrucache/tree/master/twotier) allows caches to be combined, for example to use lrucache above with a persistent disk-cache.
-- [`github.com/birkelund/boltdbcache`](https://github.com/birkelund/boltdbcache) provides a BoltDB implementation (based on the [bbolt](https://github.com/coreos/bbolt) fork).
-
-License
--------
-
-- [MIT License](LICENSE.txt)
diff --git a/vendor/github.com/gregjones/httpcache/diskcache/diskcache.go b/vendor/github.com/gregjones/httpcache/diskcache/diskcache.go
deleted file mode 100644
index 42e3129d..00000000
--- a/vendor/github.com/gregjones/httpcache/diskcache/diskcache.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Package diskcache provides an implementation of httpcache.Cache that uses the diskv package
-// to supplement an in-memory map with persistent storage
-//
-package diskcache
-
-import (
- "bytes"
- "crypto/md5"
- "encoding/hex"
- "github.com/peterbourgon/diskv"
- "io"
-)
-
-// Cache is an implementation of httpcache.Cache that supplements the in-memory map with persistent storage
-type Cache struct {
- d *diskv.Diskv
-}
-
-// Get returns the response corresponding to key if present
-func (c *Cache) Get(key string) (resp []byte, ok bool) {
- key = keyToFilename(key)
- resp, err := c.d.Read(key)
- if err != nil {
- return []byte{}, false
- }
- return resp, true
-}
-
-// Set saves a response to the cache as key
-func (c *Cache) Set(key string, resp []byte) {
- key = keyToFilename(key)
- c.d.WriteStream(key, bytes.NewReader(resp), true)
-}
-
-// Delete removes the response with key from the cache
-func (c *Cache) Delete(key string) {
- key = keyToFilename(key)
- c.d.Erase(key)
-}
-
-func keyToFilename(key string) string {
- h := md5.New()
- io.WriteString(h, key)
- return hex.EncodeToString(h.Sum(nil))
-}
-
-// New returns a new Cache that will store files in basePath
-func New(basePath string) *Cache {
- return &Cache{
- d: diskv.New(diskv.Options{
- BasePath: basePath,
- CacheSizeMax: 100 * 1024 * 1024, // 100MB
- }),
- }
-}
-
-// NewWithDiskv returns a new Cache using the provided Diskv as underlying
-// storage.
-func NewWithDiskv(d *diskv.Diskv) *Cache {
- return &Cache{d}
-}
diff --git a/vendor/github.com/gregjones/httpcache/httpcache.go b/vendor/github.com/gregjones/httpcache/httpcache.go
deleted file mode 100644
index f6a2ec4a..00000000
--- a/vendor/github.com/gregjones/httpcache/httpcache.go
+++ /dev/null
@@ -1,551 +0,0 @@
-// Package httpcache provides a http.RoundTripper implementation that works as a
-// mostly RFC-compliant cache for http responses.
-//
-// It is only suitable for use as a 'private' cache (i.e. for a web-browser or an API-client
-// and not for a shared proxy).
-//
-package httpcache
-
-import (
- "bufio"
- "bytes"
- "errors"
- "io"
- "io/ioutil"
- "net/http"
- "net/http/httputil"
- "strings"
- "sync"
- "time"
-)
-
-const (
- stale = iota
- fresh
- transparent
- // XFromCache is the header added to responses that are returned from the cache
- XFromCache = "X-From-Cache"
-)
-
-// A Cache interface is used by the Transport to store and retrieve responses.
-type Cache interface {
- // Get returns the []byte representation of a cached response and a bool
- // set to true if the value isn't empty
- Get(key string) (responseBytes []byte, ok bool)
- // Set stores the []byte representation of a response against a key
- Set(key string, responseBytes []byte)
- // Delete removes the value associated with the key
- Delete(key string)
-}
-
-// cacheKey returns the cache key for req.
-func cacheKey(req *http.Request) string {
- if req.Method == http.MethodGet {
- return req.URL.String()
- } else {
- return req.Method + " " + req.URL.String()
- }
-}
-
-// CachedResponse returns the cached http.Response for req if present, and nil
-// otherwise.
-func CachedResponse(c Cache, req *http.Request) (resp *http.Response, err error) {
- cachedVal, ok := c.Get(cacheKey(req))
- if !ok {
- return
- }
-
- b := bytes.NewBuffer(cachedVal)
- return http.ReadResponse(bufio.NewReader(b), req)
-}
-
-// MemoryCache is an implemtation of Cache that stores responses in an in-memory map.
-type MemoryCache struct {
- mu sync.RWMutex
- items map[string][]byte
-}
-
-// Get returns the []byte representation of the response and true if present, false if not
-func (c *MemoryCache) Get(key string) (resp []byte, ok bool) {
- c.mu.RLock()
- resp, ok = c.items[key]
- c.mu.RUnlock()
- return resp, ok
-}
-
-// Set saves response resp to the cache with key
-func (c *MemoryCache) Set(key string, resp []byte) {
- c.mu.Lock()
- c.items[key] = resp
- c.mu.Unlock()
-}
-
-// Delete removes key from the cache
-func (c *MemoryCache) Delete(key string) {
- c.mu.Lock()
- delete(c.items, key)
- c.mu.Unlock()
-}
-
-// NewMemoryCache returns a new Cache that will store items in an in-memory map
-func NewMemoryCache() *MemoryCache {
- c := &MemoryCache{items: map[string][]byte{}}
- return c
-}
-
-// Transport is an implementation of http.RoundTripper that will return values from a cache
-// where possible (avoiding a network request) and will additionally add validators (etag/if-modified-since)
-// to repeated requests allowing servers to return 304 / Not Modified
-type Transport struct {
- // The RoundTripper interface actually used to make requests
- // If nil, http.DefaultTransport is used
- Transport http.RoundTripper
- Cache Cache
- // If true, responses returned from the cache will be given an extra header, X-From-Cache
- MarkCachedResponses bool
-}
-
-// NewTransport returns a new Transport with the
-// provided Cache implementation and MarkCachedResponses set to true
-func NewTransport(c Cache) *Transport {
- return &Transport{Cache: c, MarkCachedResponses: true}
-}
-
-// Client returns an *http.Client that caches responses.
-func (t *Transport) Client() *http.Client {
- return &http.Client{Transport: t}
-}
-
-// varyMatches will return false unless all of the cached values for the headers listed in Vary
-// match the new request
-func varyMatches(cachedResp *http.Response, req *http.Request) bool {
- for _, header := range headerAllCommaSepValues(cachedResp.Header, "vary") {
- header = http.CanonicalHeaderKey(header)
- if header != "" && req.Header.Get(header) != cachedResp.Header.Get("X-Varied-"+header) {
- return false
- }
- }
- return true
-}
-
-// RoundTrip takes a Request and returns a Response
-//
-// If there is a fresh Response already in cache, then it will be returned without connecting to
-// the server.
-//
-// If there is a stale Response, then any validators it contains will be set on the new request
-// to give the server a chance to respond with NotModified. If this happens, then the cached Response
-// will be returned.
-func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
- cacheKey := cacheKey(req)
- cacheable := (req.Method == "GET" || req.Method == "HEAD") && req.Header.Get("range") == ""
- var cachedResp *http.Response
- if cacheable {
- cachedResp, err = CachedResponse(t.Cache, req)
- } else {
- // Need to invalidate an existing value
- t.Cache.Delete(cacheKey)
- }
-
- transport := t.Transport
- if transport == nil {
- transport = http.DefaultTransport
- }
-
- if cacheable && cachedResp != nil && err == nil {
- if t.MarkCachedResponses {
- cachedResp.Header.Set(XFromCache, "1")
- }
-
- if varyMatches(cachedResp, req) {
- // Can only use cached value if the new request doesn't Vary significantly
- freshness := getFreshness(cachedResp.Header, req.Header)
- if freshness == fresh {
- return cachedResp, nil
- }
-
- if freshness == stale {
- var req2 *http.Request
- // Add validators if caller hasn't already done so
- etag := cachedResp.Header.Get("etag")
- if etag != "" && req.Header.Get("etag") == "" {
- req2 = cloneRequest(req)
- req2.Header.Set("if-none-match", etag)
- }
- lastModified := cachedResp.Header.Get("last-modified")
- if lastModified != "" && req.Header.Get("last-modified") == "" {
- if req2 == nil {
- req2 = cloneRequest(req)
- }
- req2.Header.Set("if-modified-since", lastModified)
- }
- if req2 != nil {
- req = req2
- }
- }
- }
-
- resp, err = transport.RoundTrip(req)
- if err == nil && req.Method == "GET" && resp.StatusCode == http.StatusNotModified {
- // Replace the 304 response with the one from cache, but update with some new headers
- endToEndHeaders := getEndToEndHeaders(resp.Header)
- for _, header := range endToEndHeaders {
- cachedResp.Header[header] = resp.Header[header]
- }
- resp = cachedResp
- } else if (err != nil || (cachedResp != nil && resp.StatusCode >= 500)) &&
- req.Method == "GET" && canStaleOnError(cachedResp.Header, req.Header) {
- // In case of transport failure and stale-if-error activated, returns cached content
- // when available
- return cachedResp, nil
- } else {
- if err != nil || resp.StatusCode != http.StatusOK {
- t.Cache.Delete(cacheKey)
- }
- if err != nil {
- return nil, err
- }
- }
- } else {
- reqCacheControl := parseCacheControl(req.Header)
- if _, ok := reqCacheControl["only-if-cached"]; ok {
- resp = newGatewayTimeoutResponse(req)
- } else {
- resp, err = transport.RoundTrip(req)
- if err != nil {
- return nil, err
- }
- }
- }
-
- if cacheable && canStore(parseCacheControl(req.Header), parseCacheControl(resp.Header)) {
- for _, varyKey := range headerAllCommaSepValues(resp.Header, "vary") {
- varyKey = http.CanonicalHeaderKey(varyKey)
- fakeHeader := "X-Varied-" + varyKey
- reqValue := req.Header.Get(varyKey)
- if reqValue != "" {
- resp.Header.Set(fakeHeader, reqValue)
- }
- }
- switch req.Method {
- case "GET":
- // Delay caching until EOF is reached.
- resp.Body = &cachingReadCloser{
- R: resp.Body,
- OnEOF: func(r io.Reader) {
- resp := *resp
- resp.Body = ioutil.NopCloser(r)
- respBytes, err := httputil.DumpResponse(&resp, true)
- if err == nil {
- t.Cache.Set(cacheKey, respBytes)
- }
- },
- }
- default:
- respBytes, err := httputil.DumpResponse(resp, true)
- if err == nil {
- t.Cache.Set(cacheKey, respBytes)
- }
- }
- } else {
- t.Cache.Delete(cacheKey)
- }
- return resp, nil
-}
-
-// ErrNoDateHeader indicates that the HTTP headers contained no Date header.
-var ErrNoDateHeader = errors.New("no Date header")
-
-// Date parses and returns the value of the Date header.
-func Date(respHeaders http.Header) (date time.Time, err error) {
- dateHeader := respHeaders.Get("date")
- if dateHeader == "" {
- err = ErrNoDateHeader
- return
- }
-
- return time.Parse(time.RFC1123, dateHeader)
-}
-
-type realClock struct{}
-
-func (c *realClock) since(d time.Time) time.Duration {
- return time.Since(d)
-}
-
-type timer interface {
- since(d time.Time) time.Duration
-}
-
-var clock timer = &realClock{}
-
-// getFreshness will return one of fresh/stale/transparent based on the cache-control
-// values of the request and the response
-//
-// fresh indicates the response can be returned
-// stale indicates that the response needs validating before it is returned
-// transparent indicates the response should not be used to fulfil the request
-//
-// Because this is only a private cache, 'public' and 'private' in cache-control aren't
-// signficant. Similarly, smax-age isn't used.
-func getFreshness(respHeaders, reqHeaders http.Header) (freshness int) {
- respCacheControl := parseCacheControl(respHeaders)
- reqCacheControl := parseCacheControl(reqHeaders)
- if _, ok := reqCacheControl["no-cache"]; ok {
- return transparent
- }
- if _, ok := respCacheControl["no-cache"]; ok {
- return stale
- }
- if _, ok := reqCacheControl["only-if-cached"]; ok {
- return fresh
- }
-
- date, err := Date(respHeaders)
- if err != nil {
- return stale
- }
- currentAge := clock.since(date)
-
- var lifetime time.Duration
- var zeroDuration time.Duration
-
- // If a response includes both an Expires header and a max-age directive,
- // the max-age directive overrides the Expires header, even if the Expires header is more restrictive.
- if maxAge, ok := respCacheControl["max-age"]; ok {
- lifetime, err = time.ParseDuration(maxAge + "s")
- if err != nil {
- lifetime = zeroDuration
- }
- } else {
- expiresHeader := respHeaders.Get("Expires")
- if expiresHeader != "" {
- expires, err := time.Parse(time.RFC1123, expiresHeader)
- if err != nil {
- lifetime = zeroDuration
- } else {
- lifetime = expires.Sub(date)
- }
- }
- }
-
- if maxAge, ok := reqCacheControl["max-age"]; ok {
- // the client is willing to accept a response whose age is no greater than the specified time in seconds
- lifetime, err = time.ParseDuration(maxAge + "s")
- if err != nil {
- lifetime = zeroDuration
- }
- }
- if minfresh, ok := reqCacheControl["min-fresh"]; ok {
- // the client wants a response that will still be fresh for at least the specified number of seconds.
- minfreshDuration, err := time.ParseDuration(minfresh + "s")
- if err == nil {
- currentAge = time.Duration(currentAge + minfreshDuration)
- }
- }
-
- if maxstale, ok := reqCacheControl["max-stale"]; ok {
- // Indicates that the client is willing to accept a response that has exceeded its expiration time.
- // If max-stale is assigned a value, then the client is willing to accept a response that has exceeded
- // its expiration time by no more than the specified number of seconds.
- // If no value is assigned to max-stale, then the client is willing to accept a stale response of any age.
- //
- // Responses served only because of a max-stale value are supposed to have a Warning header added to them,
- // but that seems like a hassle, and is it actually useful? If so, then there needs to be a different
- // return-value available here.
- if maxstale == "" {
- return fresh
- }
- maxstaleDuration, err := time.ParseDuration(maxstale + "s")
- if err == nil {
- currentAge = time.Duration(currentAge - maxstaleDuration)
- }
- }
-
- if lifetime > currentAge {
- return fresh
- }
-
- return stale
-}
-
-// Returns true if either the request or the response includes the stale-if-error
-// cache control extension: https://tools.ietf.org/html/rfc5861
-func canStaleOnError(respHeaders, reqHeaders http.Header) bool {
- respCacheControl := parseCacheControl(respHeaders)
- reqCacheControl := parseCacheControl(reqHeaders)
-
- var err error
- lifetime := time.Duration(-1)
-
- if staleMaxAge, ok := respCacheControl["stale-if-error"]; ok {
- if staleMaxAge != "" {
- lifetime, err = time.ParseDuration(staleMaxAge + "s")
- if err != nil {
- return false
- }
- } else {
- return true
- }
- }
- if staleMaxAge, ok := reqCacheControl["stale-if-error"]; ok {
- if staleMaxAge != "" {
- lifetime, err = time.ParseDuration(staleMaxAge + "s")
- if err != nil {
- return false
- }
- } else {
- return true
- }
- }
-
- if lifetime >= 0 {
- date, err := Date(respHeaders)
- if err != nil {
- return false
- }
- currentAge := clock.since(date)
- if lifetime > currentAge {
- return true
- }
- }
-
- return false
-}
-
-func getEndToEndHeaders(respHeaders http.Header) []string {
- // These headers are always hop-by-hop
- hopByHopHeaders := map[string]struct{}{
- "Connection": struct{}{},
- "Keep-Alive": struct{}{},
- "Proxy-Authenticate": struct{}{},
- "Proxy-Authorization": struct{}{},
- "Te": struct{}{},
- "Trailers": struct{}{},
- "Transfer-Encoding": struct{}{},
- "Upgrade": struct{}{},
- }
-
- for _, extra := range strings.Split(respHeaders.Get("connection"), ",") {
- // any header listed in connection, if present, is also considered hop-by-hop
- if strings.Trim(extra, " ") != "" {
- hopByHopHeaders[http.CanonicalHeaderKey(extra)] = struct{}{}
- }
- }
- endToEndHeaders := []string{}
- for respHeader, _ := range respHeaders {
- if _, ok := hopByHopHeaders[respHeader]; !ok {
- endToEndHeaders = append(endToEndHeaders, respHeader)
- }
- }
- return endToEndHeaders
-}
-
-func canStore(reqCacheControl, respCacheControl cacheControl) (canStore bool) {
- if _, ok := respCacheControl["no-store"]; ok {
- return false
- }
- if _, ok := reqCacheControl["no-store"]; ok {
- return false
- }
- return true
-}
-
-func newGatewayTimeoutResponse(req *http.Request) *http.Response {
- var braw bytes.Buffer
- braw.WriteString("HTTP/1.1 504 Gateway Timeout\r\n\r\n")
- resp, err := http.ReadResponse(bufio.NewReader(&braw), req)
- if err != nil {
- panic(err)
- }
- return resp
-}
-
-// cloneRequest returns a clone of the provided *http.Request.
-// The clone is a shallow copy of the struct and its Header map.
-// (This function copyright goauth2 authors: https://code.google.com/p/goauth2)
-func cloneRequest(r *http.Request) *http.Request {
- // shallow copy of the struct
- r2 := new(http.Request)
- *r2 = *r
- // deep copy of the Header
- r2.Header = make(http.Header)
- for k, s := range r.Header {
- r2.Header[k] = s
- }
- return r2
-}
-
-type cacheControl map[string]string
-
-func parseCacheControl(headers http.Header) cacheControl {
- cc := cacheControl{}
- ccHeader := headers.Get("Cache-Control")
- for _, part := range strings.Split(ccHeader, ",") {
- part = strings.Trim(part, " ")
- if part == "" {
- continue
- }
- if strings.ContainsRune(part, '=') {
- keyval := strings.Split(part, "=")
- cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
- } else {
- cc[part] = ""
- }
- }
- return cc
-}
-
-// headerAllCommaSepValues returns all comma-separated values (each
-// with whitespace trimmed) for header name in headers. According to
-// Section 4.2 of the HTTP/1.1 spec
-// (http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2),
-// values from multiple occurrences of a header should be concatenated, if
-// the header's value is a comma-separated list.
-func headerAllCommaSepValues(headers http.Header, name string) []string {
- var vals []string
- for _, val := range headers[http.CanonicalHeaderKey(name)] {
- fields := strings.Split(val, ",")
- for i, f := range fields {
- fields[i] = strings.TrimSpace(f)
- }
- vals = append(vals, fields...)
- }
- return vals
-}
-
-// cachingReadCloser is a wrapper around ReadCloser R that calls OnEOF
-// handler with a full copy of the content read from R when EOF is
-// reached.
-type cachingReadCloser struct {
- // Underlying ReadCloser.
- R io.ReadCloser
- // OnEOF is called with a copy of the content of R when EOF is reached.
- OnEOF func(io.Reader)
-
- buf bytes.Buffer // buf stores a copy of the content of R.
-}
-
-// Read reads the next len(p) bytes from R or until R is drained. The
-// return value n is the number of bytes read. If R has no data to
-// return, err is io.EOF and OnEOF is called with a full copy of what
-// has been read so far.
-func (r *cachingReadCloser) Read(p []byte) (n int, err error) {
- n, err = r.R.Read(p)
- r.buf.Write(p[:n])
- if err == io.EOF {
- r.OnEOF(bytes.NewReader(r.buf.Bytes()))
- }
- return n, err
-}
-
-func (r *cachingReadCloser) Close() error {
- return r.R.Close()
-}
-
-// NewMemoryCacheTransport returns a new Transport using the in-memory cache implementation
-func NewMemoryCacheTransport() *Transport {
- c := NewMemoryCache()
- t := NewTransport(c)
- return t
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/.gitignore b/vendor/github.com/hashicorp/golang-lru/.gitignore
deleted file mode 100644
index 83656241..00000000
--- a/vendor/github.com/hashicorp/golang-lru/.gitignore
+++ /dev/null
@@ -1,23 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
diff --git a/vendor/github.com/hashicorp/golang-lru/2q.go b/vendor/github.com/hashicorp/golang-lru/2q.go
deleted file mode 100644
index e474cd07..00000000
--- a/vendor/github.com/hashicorp/golang-lru/2q.go
+++ /dev/null
@@ -1,223 +0,0 @@
-package lru
-
-import (
- "fmt"
- "sync"
-
- "github.com/hashicorp/golang-lru/simplelru"
-)
-
-const (
- // Default2QRecentRatio is the ratio of the 2Q cache dedicated
- // to recently added entries that have only been accessed once.
- Default2QRecentRatio = 0.25
-
- // Default2QGhostEntries is the default ratio of ghost
- // entries kept to track entries recently evicted
- Default2QGhostEntries = 0.50
-)
-
-// TwoQueueCache is a thread-safe fixed size 2Q cache.
-// 2Q is an enhancement over the standard LRU cache
-// in that it tracks both frequently and recently used
-// entries separately. This avoids a burst in access to new
-// entries from evicting frequently used entries. It adds some
-// additional tracking overhead to the standard LRU cache, and is
-// computationally about 2x the cost, and adds some metadata over
-// head. The ARCCache is similar, but does not require setting any
-// parameters.
-type TwoQueueCache struct {
- size int
- recentSize int
-
- recent simplelru.LRUCache
- frequent simplelru.LRUCache
- recentEvict simplelru.LRUCache
- lock sync.RWMutex
-}
-
-// New2Q creates a new TwoQueueCache using the default
-// values for the parameters.
-func New2Q(size int) (*TwoQueueCache, error) {
- return New2QParams(size, Default2QRecentRatio, Default2QGhostEntries)
-}
-
-// New2QParams creates a new TwoQueueCache using the provided
-// parameter values.
-func New2QParams(size int, recentRatio float64, ghostRatio float64) (*TwoQueueCache, error) {
- if size <= 0 {
- return nil, fmt.Errorf("invalid size")
- }
- if recentRatio < 0.0 || recentRatio > 1.0 {
- return nil, fmt.Errorf("invalid recent ratio")
- }
- if ghostRatio < 0.0 || ghostRatio > 1.0 {
- return nil, fmt.Errorf("invalid ghost ratio")
- }
-
- // Determine the sub-sizes
- recentSize := int(float64(size) * recentRatio)
- evictSize := int(float64(size) * ghostRatio)
-
- // Allocate the LRUs
- recent, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- frequent, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- recentEvict, err := simplelru.NewLRU(evictSize, nil)
- if err != nil {
- return nil, err
- }
-
- // Initialize the cache
- c := &TwoQueueCache{
- size: size,
- recentSize: recentSize,
- recent: recent,
- frequent: frequent,
- recentEvict: recentEvict,
- }
- return c, nil
-}
-
-// Get looks up a key's value from the cache.
-func (c *TwoQueueCache) Get(key interface{}) (value interface{}, ok bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- // Check if this is a frequent value
- if val, ok := c.frequent.Get(key); ok {
- return val, ok
- }
-
- // If the value is contained in recent, then we
- // promote it to frequent
- if val, ok := c.recent.Peek(key); ok {
- c.recent.Remove(key)
- c.frequent.Add(key, val)
- return val, ok
- }
-
- // No hit
- return nil, false
-}
-
-// Add adds a value to the cache.
-func (c *TwoQueueCache) Add(key, value interface{}) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- // Check if the value is frequently used already,
- // and just update the value
- if c.frequent.Contains(key) {
- c.frequent.Add(key, value)
- return
- }
-
- // Check if the value is recently used, and promote
- // the value into the frequent list
- if c.recent.Contains(key) {
- c.recent.Remove(key)
- c.frequent.Add(key, value)
- return
- }
-
- // If the value was recently evicted, add it to the
- // frequently used list
- if c.recentEvict.Contains(key) {
- c.ensureSpace(true)
- c.recentEvict.Remove(key)
- c.frequent.Add(key, value)
- return
- }
-
- // Add to the recently seen list
- c.ensureSpace(false)
- c.recent.Add(key, value)
- return
-}
-
-// ensureSpace is used to ensure we have space in the cache
-func (c *TwoQueueCache) ensureSpace(recentEvict bool) {
- // If we have space, nothing to do
- recentLen := c.recent.Len()
- freqLen := c.frequent.Len()
- if recentLen+freqLen < c.size {
- return
- }
-
- // If the recent buffer is larger than
- // the target, evict from there
- if recentLen > 0 && (recentLen > c.recentSize || (recentLen == c.recentSize && !recentEvict)) {
- k, _, _ := c.recent.RemoveOldest()
- c.recentEvict.Add(k, nil)
- return
- }
-
- // Remove from the frequent list otherwise
- c.frequent.RemoveOldest()
-}
-
-// Len returns the number of items in the cache.
-func (c *TwoQueueCache) Len() int {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.recent.Len() + c.frequent.Len()
-}
-
-// Keys returns a slice of the keys in the cache.
-// The frequently used keys are first in the returned slice.
-func (c *TwoQueueCache) Keys() []interface{} {
- c.lock.RLock()
- defer c.lock.RUnlock()
- k1 := c.frequent.Keys()
- k2 := c.recent.Keys()
- return append(k1, k2...)
-}
-
-// Remove removes the provided key from the cache.
-func (c *TwoQueueCache) Remove(key interface{}) {
- c.lock.Lock()
- defer c.lock.Unlock()
- if c.frequent.Remove(key) {
- return
- }
- if c.recent.Remove(key) {
- return
- }
- if c.recentEvict.Remove(key) {
- return
- }
-}
-
-// Purge is used to completely clear the cache.
-func (c *TwoQueueCache) Purge() {
- c.lock.Lock()
- defer c.lock.Unlock()
- c.recent.Purge()
- c.frequent.Purge()
- c.recentEvict.Purge()
-}
-
-// Contains is used to check if the cache contains a key
-// without updating recency or frequency.
-func (c *TwoQueueCache) Contains(key interface{}) bool {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.frequent.Contains(key) || c.recent.Contains(key)
-}
-
-// Peek is used to inspect the cache value of a key
-// without updating recency or frequency.
-func (c *TwoQueueCache) Peek(key interface{}) (value interface{}, ok bool) {
- c.lock.RLock()
- defer c.lock.RUnlock()
- if val, ok := c.frequent.Peek(key); ok {
- return val, ok
- }
- return c.recent.Peek(key)
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/LICENSE b/vendor/github.com/hashicorp/golang-lru/LICENSE
deleted file mode 100644
index be2cc4df..00000000
--- a/vendor/github.com/hashicorp/golang-lru/LICENSE
+++ /dev/null
@@ -1,362 +0,0 @@
-Mozilla Public License, version 2.0
-
-1. Definitions
-
-1.1. "Contributor"
-
- means each individual or legal entity that creates, contributes to the
- creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
-
- means the combination of the Contributions of others (if any) used by a
- Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
-
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
-
- means Source Code Form to which the initial Contributor has attached the
- notice in Exhibit A, the Executable Form of such Source Code Form, and
- Modifications of such Source Code Form, in each case including portions
- thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- a. that the initial Contributor has attached the notice described in
- Exhibit B to the Covered Software; or
-
- b. that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the terms of
- a Secondary License.
-
-1.6. "Executable Form"
-
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
-
- means a work that combines Covered Software with other material, in a
- separate file or files, that is not Covered Software.
-
-1.8. "License"
-
- means this document.
-
-1.9. "Licensable"
-
- means having the right to grant, to the maximum extent possible, whether
- at the time of the initial grant or subsequently, any and all of the
- rights conveyed by this License.
-
-1.10. "Modifications"
-
- means any of the following:
-
- a. any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered Software; or
-
- b. any new file in Source Code Form that contains any Covered Software.
-
-1.11. "Patent Claims" of a Contributor
-
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the License,
- by the making, using, selling, offering for sale, having made, import,
- or transfer of either its Contributions or its Contributor Version.
-
-1.12. "Secondary License"
-
- means either the GNU General Public License, Version 2.0, the GNU Lesser
- General Public License, Version 2.1, the GNU Affero General Public
- License, Version 3.0, or any later versions of those licenses.
-
-1.13. "Source Code Form"
-
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
-
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that controls, is
- controlled by, or is under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or indirect, to cause
- the direction or management of such entity, whether by contract or
- otherwise, or (b) ownership of more than fifty percent (50%) of the
- outstanding shares or beneficial ownership of such entity.
-
-
-2. License Grants and Conditions
-
-2.1. Grants
-
- Each Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- a. under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
- b. under Patent Claims of such Contributor to make, use, sell, offer for
- sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
- The licenses granted in Section 2.1 with respect to any Contribution
- become effective for each Contribution on the date the Contributor first
- distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
- The licenses granted in this Section 2 are the only rights granted under
- this License. No additional rights or licenses will be implied from the
- distribution or licensing of Covered Software under this License.
- Notwithstanding Section 2.1(b) above, no patent license is granted by a
- Contributor:
-
- a. for any code that a Contributor has removed from Covered Software; or
-
- b. for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
- c. under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
- This License does not grant any rights in the trademarks, service marks,
- or logos of any Contributor (except as may be necessary to comply with
- the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
- No Contributor makes additional grants as a result of Your choice to
- distribute the Covered Software under a subsequent version of this
- License (see Section 10.2) or under the terms of a Secondary License (if
- permitted under the terms of Section 3.3).
-
-2.5. Representation
-
- Each Contributor represents that the Contributor believes its
- Contributions are its original creation(s) or it has sufficient rights to
- grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
- This License is not intended to limit any rights You have under
- applicable copyright doctrines of fair use, fair dealing, or other
- equivalents.
-
-2.7. Conditions
-
- Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in
- Section 2.1.
-
-
-3. Responsibilities
-
-3.1. Distribution of Source Form
-
- All distribution of Covered Software in Source Code Form, including any
- Modifications that You create or to which You contribute, must be under
- the terms of this License. You must inform recipients that the Source
- Code Form of the Covered Software is governed by the terms of this
- License, and how they can obtain a copy of this License. You may not
- attempt to alter or restrict the recipients' rights in the Source Code
- Form.
-
-3.2. Distribution of Executable Form
-
- If You distribute Covered Software in Executable Form then:
-
- a. such Covered Software must also be made available in Source Code Form,
- as described in Section 3.1, and You must inform recipients of the
- Executable Form how they can obtain a copy of such Source Code Form by
- reasonable means in a timely manner, at a charge no more than the cost
- of distribution to the recipient; and
-
- b. You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter the
- recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
- You may create and distribute a Larger Work under terms of Your choice,
- provided that You also comply with the requirements of this License for
- the Covered Software. If the Larger Work is a combination of Covered
- Software with a work governed by one or more Secondary Licenses, and the
- Covered Software is not Incompatible With Secondary Licenses, this
- License permits You to additionally distribute such Covered Software
- under the terms of such Secondary License(s), so that the recipient of
- the Larger Work may, at their option, further distribute the Covered
- Software under the terms of either this License or such Secondary
- License(s).
-
-3.4. Notices
-
- You may not remove or alter the substance of any license notices
- (including copyright notices, patent notices, disclaimers of warranty, or
- limitations of liability) contained within the Source Code Form of the
- Covered Software, except that You may alter any license notices to the
- extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
- You may choose to offer, and to charge a fee for, warranty, support,
- indemnity or liability obligations to one or more recipients of Covered
- Software. However, You may do so only on Your own behalf, and not on
- behalf of any Contributor. You must make it absolutely clear that any
- such warranty, support, indemnity, or liability obligation is offered by
- You alone, and You hereby agree to indemnify every Contributor for any
- liability incurred by such Contributor as a result of warranty, support,
- indemnity or liability terms You offer. You may include additional
- disclaimers of warranty and limitations of liability specific to any
- jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
-
- If it is impossible for You to comply with any of the terms of this License
- with respect to some or all of the Covered Software due to statute,
- judicial order, or regulation then You must: (a) comply with the terms of
- this License to the maximum extent possible; and (b) describe the
- limitations and the code they affect. Such description must be placed in a
- text file included with all distributions of the Covered Software under
- this License. Except to the extent prohibited by statute or regulation,
- such description must be sufficiently detailed for a recipient of ordinary
- skill to be able to understand it.
-
-5. Termination
-
-5.1. The rights granted under this License will terminate automatically if You
- fail to comply with any of its terms. However, if You become compliant,
- then the rights granted under this License from a particular Contributor
- are reinstated (a) provisionally, unless and until such Contributor
- explicitly and finally terminates Your grants, and (b) on an ongoing
- basis, if such Contributor fails to notify You of the non-compliance by
- some reasonable means prior to 60 days after You have come back into
- compliance. Moreover, Your grants from a particular Contributor are
- reinstated on an ongoing basis if such Contributor notifies You of the
- non-compliance by some reasonable means, this is the first time You have
- received notice of non-compliance with this License from such
- Contributor, and You become compliant prior to 30 days after Your receipt
- of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
- infringement claim (excluding declaratory judgment actions,
- counter-claims, and cross-claims) alleging that a Contributor Version
- directly or indirectly infringes any patent, then the rights granted to
- You by any and all Contributors for the Covered Software under Section
- 2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user
- license agreements (excluding distributors and resellers) which have been
- validly granted by You or Your distributors under this License prior to
- termination shall survive termination.
-
-6. Disclaimer of Warranty
-
- Covered Software is provided under this License on an "as is" basis,
- without warranty of any kind, either expressed, implied, or statutory,
- including, without limitation, warranties that the Covered Software is free
- of defects, merchantable, fit for a particular purpose or non-infringing.
- The entire risk as to the quality and performance of the Covered Software
- is with You. Should any Covered Software prove defective in any respect,
- You (not any Contributor) assume the cost of any necessary servicing,
- repair, or correction. This disclaimer of warranty constitutes an essential
- part of this License. No use of any Covered Software is authorized under
- this License except under this disclaimer.
-
-7. Limitation of Liability
-
- Under no circumstances and under no legal theory, whether tort (including
- negligence), contract, or otherwise, shall any Contributor, or anyone who
- distributes Covered Software as permitted above, be liable to You for any
- direct, indirect, special, incidental, or consequential damages of any
- character including, without limitation, damages for lost profits, loss of
- goodwill, work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses, even if such party shall have been
- informed of the possibility of such damages. This limitation of liability
- shall not apply to liability for death or personal injury resulting from
- such party's negligence to the extent applicable law prohibits such
- limitation. Some jurisdictions do not allow the exclusion or limitation of
- incidental or consequential damages, so this exclusion and limitation may
- not apply to You.
-
-8. Litigation
-
- Any litigation relating to this License may be brought only in the courts
- of a jurisdiction where the defendant maintains its principal place of
- business and such litigation shall be governed by laws of that
- jurisdiction, without reference to its conflict-of-law provisions. Nothing
- in this Section shall prevent a party's ability to bring cross-claims or
- counter-claims.
-
-9. Miscellaneous
-
- This License represents the complete agreement concerning the subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the extent
- necessary to make it enforceable. Any law or regulation which provides that
- the language of a contract shall be construed against the drafter shall not
- be used to construe this License against a Contributor.
-
-
-10. Versions of the License
-
-10.1. New Versions
-
- Mozilla Foundation is the license steward. Except as provided in Section
- 10.3, no one other than the license steward has the right to modify or
- publish new versions of this License. Each version will be given a
- distinguishing version number.
-
-10.2. Effect of New Versions
-
- You may distribute the Covered Software under the terms of the version
- of the License under which You originally received the Covered Software,
- or under the terms of any subsequent version published by the license
- steward.
-
-10.3. Modified Versions
-
- If you create software not governed by this License, and you want to
- create a new license for such software, you may create and use a
- modified version of this License if you rename the license and remove
- any references to the name of the license steward (except to note that
- such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
- Licenses If You choose to distribute Source Code Form that is
- Incompatible With Secondary Licenses under the terms of this version of
- the License, the notice described in Exhibit B of this License must be
- attached.
-
-Exhibit A - Source Code Form License Notice
-
- This Source Code Form is subject to the
- terms of the Mozilla Public License, v.
- 2.0. If a copy of the MPL was not
- distributed with this file, You can
- obtain one at
- http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular file,
-then You may include the notice in a location (such as a LICENSE file in a
-relevant directory) where a recipient would be likely to look for such a
-notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
-
- This Source Code Form is "Incompatible
- With Secondary Licenses", as defined by
- the Mozilla Public License, v. 2.0.
diff --git a/vendor/github.com/hashicorp/golang-lru/README.md b/vendor/github.com/hashicorp/golang-lru/README.md
deleted file mode 100644
index 33e58cfa..00000000
--- a/vendor/github.com/hashicorp/golang-lru/README.md
+++ /dev/null
@@ -1,25 +0,0 @@
-golang-lru
-==========
-
-This provides the `lru` package which implements a fixed-size
-thread safe LRU cache. It is based on the cache in Groupcache.
-
-Documentation
-=============
-
-Full docs are available on [Godoc](http://godoc.org/github.com/hashicorp/golang-lru)
-
-Example
-=======
-
-Using the LRU is very simple:
-
-```go
-l, _ := New(128)
-for i := 0; i < 256; i++ {
- l.Add(i, nil)
-}
-if l.Len() != 128 {
- panic(fmt.Sprintf("bad len: %v", l.Len()))
-}
-```
diff --git a/vendor/github.com/hashicorp/golang-lru/arc.go b/vendor/github.com/hashicorp/golang-lru/arc.go
deleted file mode 100644
index 555225a2..00000000
--- a/vendor/github.com/hashicorp/golang-lru/arc.go
+++ /dev/null
@@ -1,257 +0,0 @@
-package lru
-
-import (
- "sync"
-
- "github.com/hashicorp/golang-lru/simplelru"
-)
-
-// ARCCache is a thread-safe fixed size Adaptive Replacement Cache (ARC).
-// ARC is an enhancement over the standard LRU cache in that tracks both
-// frequency and recency of use. This avoids a burst in access to new
-// entries from evicting the frequently used older entries. It adds some
-// additional tracking overhead to a standard LRU cache, computationally
-// it is roughly 2x the cost, and the extra memory overhead is linear
-// with the size of the cache. ARC has been patented by IBM, but is
-// similar to the TwoQueueCache (2Q) which requires setting parameters.
-type ARCCache struct {
- size int // Size is the total capacity of the cache
- p int // P is the dynamic preference towards T1 or T2
-
- t1 simplelru.LRUCache // T1 is the LRU for recently accessed items
- b1 simplelru.LRUCache // B1 is the LRU for evictions from t1
-
- t2 simplelru.LRUCache // T2 is the LRU for frequently accessed items
- b2 simplelru.LRUCache // B2 is the LRU for evictions from t2
-
- lock sync.RWMutex
-}
-
-// NewARC creates an ARC of the given size
-func NewARC(size int) (*ARCCache, error) {
- // Create the sub LRUs
- b1, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- b2, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- t1, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
- t2, err := simplelru.NewLRU(size, nil)
- if err != nil {
- return nil, err
- }
-
- // Initialize the ARC
- c := &ARCCache{
- size: size,
- p: 0,
- t1: t1,
- b1: b1,
- t2: t2,
- b2: b2,
- }
- return c, nil
-}
-
-// Get looks up a key's value from the cache.
-func (c *ARCCache) Get(key interface{}) (value interface{}, ok bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- // If the value is contained in T1 (recent), then
- // promote it to T2 (frequent)
- if val, ok := c.t1.Peek(key); ok {
- c.t1.Remove(key)
- c.t2.Add(key, val)
- return val, ok
- }
-
- // Check if the value is contained in T2 (frequent)
- if val, ok := c.t2.Get(key); ok {
- return val, ok
- }
-
- // No hit
- return nil, false
-}
-
-// Add adds a value to the cache.
-func (c *ARCCache) Add(key, value interface{}) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- // Check if the value is contained in T1 (recent), and potentially
- // promote it to frequent T2
- if c.t1.Contains(key) {
- c.t1.Remove(key)
- c.t2.Add(key, value)
- return
- }
-
- // Check if the value is already in T2 (frequent) and update it
- if c.t2.Contains(key) {
- c.t2.Add(key, value)
- return
- }
-
- // Check if this value was recently evicted as part of the
- // recently used list
- if c.b1.Contains(key) {
- // T1 set is too small, increase P appropriately
- delta := 1
- b1Len := c.b1.Len()
- b2Len := c.b2.Len()
- if b2Len > b1Len {
- delta = b2Len / b1Len
- }
- if c.p+delta >= c.size {
- c.p = c.size
- } else {
- c.p += delta
- }
-
- // Potentially need to make room in the cache
- if c.t1.Len()+c.t2.Len() >= c.size {
- c.replace(false)
- }
-
- // Remove from B1
- c.b1.Remove(key)
-
- // Add the key to the frequently used list
- c.t2.Add(key, value)
- return
- }
-
- // Check if this value was recently evicted as part of the
- // frequently used list
- if c.b2.Contains(key) {
- // T2 set is too small, decrease P appropriately
- delta := 1
- b1Len := c.b1.Len()
- b2Len := c.b2.Len()
- if b1Len > b2Len {
- delta = b1Len / b2Len
- }
- if delta >= c.p {
- c.p = 0
- } else {
- c.p -= delta
- }
-
- // Potentially need to make room in the cache
- if c.t1.Len()+c.t2.Len() >= c.size {
- c.replace(true)
- }
-
- // Remove from B2
- c.b2.Remove(key)
-
- // Add the key to the frequently used list
- c.t2.Add(key, value)
- return
- }
-
- // Potentially need to make room in the cache
- if c.t1.Len()+c.t2.Len() >= c.size {
- c.replace(false)
- }
-
- // Keep the size of the ghost buffers trim
- if c.b1.Len() > c.size-c.p {
- c.b1.RemoveOldest()
- }
- if c.b2.Len() > c.p {
- c.b2.RemoveOldest()
- }
-
- // Add to the recently seen list
- c.t1.Add(key, value)
- return
-}
-
-// replace is used to adaptively evict from either T1 or T2
-// based on the current learned value of P
-func (c *ARCCache) replace(b2ContainsKey bool) {
- t1Len := c.t1.Len()
- if t1Len > 0 && (t1Len > c.p || (t1Len == c.p && b2ContainsKey)) {
- k, _, ok := c.t1.RemoveOldest()
- if ok {
- c.b1.Add(k, nil)
- }
- } else {
- k, _, ok := c.t2.RemoveOldest()
- if ok {
- c.b2.Add(k, nil)
- }
- }
-}
-
-// Len returns the number of cached entries
-func (c *ARCCache) Len() int {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.t1.Len() + c.t2.Len()
-}
-
-// Keys returns all the cached keys
-func (c *ARCCache) Keys() []interface{} {
- c.lock.RLock()
- defer c.lock.RUnlock()
- k1 := c.t1.Keys()
- k2 := c.t2.Keys()
- return append(k1, k2...)
-}
-
-// Remove is used to purge a key from the cache
-func (c *ARCCache) Remove(key interface{}) {
- c.lock.Lock()
- defer c.lock.Unlock()
- if c.t1.Remove(key) {
- return
- }
- if c.t2.Remove(key) {
- return
- }
- if c.b1.Remove(key) {
- return
- }
- if c.b2.Remove(key) {
- return
- }
-}
-
-// Purge is used to clear the cache
-func (c *ARCCache) Purge() {
- c.lock.Lock()
- defer c.lock.Unlock()
- c.t1.Purge()
- c.t2.Purge()
- c.b1.Purge()
- c.b2.Purge()
-}
-
-// Contains is used to check if the cache contains a key
-// without updating recency or frequency.
-func (c *ARCCache) Contains(key interface{}) bool {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.t1.Contains(key) || c.t2.Contains(key)
-}
-
-// Peek is used to inspect the cache value of a key
-// without updating recency or frequency.
-func (c *ARCCache) Peek(key interface{}) (value interface{}, ok bool) {
- c.lock.RLock()
- defer c.lock.RUnlock()
- if val, ok := c.t1.Peek(key); ok {
- return val, ok
- }
- return c.t2.Peek(key)
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/doc.go b/vendor/github.com/hashicorp/golang-lru/doc.go
deleted file mode 100644
index 2547df97..00000000
--- a/vendor/github.com/hashicorp/golang-lru/doc.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Package lru provides three different LRU caches of varying sophistication.
-//
-// Cache is a simple LRU cache. It is based on the
-// LRU implementation in groupcache:
-// https://github.com/golang/groupcache/tree/master/lru
-//
-// TwoQueueCache tracks frequently used and recently used entries separately.
-// This avoids a burst of accesses from taking out frequently used entries,
-// at the cost of about 2x computational overhead and some extra bookkeeping.
-//
-// ARCCache is an adaptive replacement cache. It tracks recent evictions as
-// well as recent usage in both the frequent and recent caches. Its
-// computational overhead is comparable to TwoQueueCache, but the memory
-// overhead is linear with the size of the cache.
-//
-// ARC has been patented by IBM, so do not use it if that is problematic for
-// your program.
-//
-// All caches in this package take locks while operating, and are therefore
-// thread-safe for consumers.
-package lru
diff --git a/vendor/github.com/hashicorp/golang-lru/go.mod b/vendor/github.com/hashicorp/golang-lru/go.mod
deleted file mode 100644
index 824cb97e..00000000
--- a/vendor/github.com/hashicorp/golang-lru/go.mod
+++ /dev/null
@@ -1 +0,0 @@
-module github.com/hashicorp/golang-lru
diff --git a/vendor/github.com/hashicorp/golang-lru/lru.go b/vendor/github.com/hashicorp/golang-lru/lru.go
deleted file mode 100644
index c8d9b0a2..00000000
--- a/vendor/github.com/hashicorp/golang-lru/lru.go
+++ /dev/null
@@ -1,110 +0,0 @@
-package lru
-
-import (
- "sync"
-
- "github.com/hashicorp/golang-lru/simplelru"
-)
-
-// Cache is a thread-safe fixed size LRU cache.
-type Cache struct {
- lru simplelru.LRUCache
- lock sync.RWMutex
-}
-
-// New creates an LRU of the given size.
-func New(size int) (*Cache, error) {
- return NewWithEvict(size, nil)
-}
-
-// NewWithEvict constructs a fixed size cache with the given eviction
-// callback.
-func NewWithEvict(size int, onEvicted func(key interface{}, value interface{})) (*Cache, error) {
- lru, err := simplelru.NewLRU(size, simplelru.EvictCallback(onEvicted))
- if err != nil {
- return nil, err
- }
- c := &Cache{
- lru: lru,
- }
- return c, nil
-}
-
-// Purge is used to completely clear the cache.
-func (c *Cache) Purge() {
- c.lock.Lock()
- c.lru.Purge()
- c.lock.Unlock()
-}
-
-// Add adds a value to the cache. Returns true if an eviction occurred.
-func (c *Cache) Add(key, value interface{}) (evicted bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
- return c.lru.Add(key, value)
-}
-
-// Get looks up a key's value from the cache.
-func (c *Cache) Get(key interface{}) (value interface{}, ok bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
- return c.lru.Get(key)
-}
-
-// Contains checks if a key is in the cache, without updating the
-// recent-ness or deleting it for being stale.
-func (c *Cache) Contains(key interface{}) bool {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.lru.Contains(key)
-}
-
-// Peek returns the key value (or undefined if not found) without updating
-// the "recently used"-ness of the key.
-func (c *Cache) Peek(key interface{}) (value interface{}, ok bool) {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.lru.Peek(key)
-}
-
-// ContainsOrAdd checks if a key is in the cache without updating the
-// recent-ness or deleting it for being stale, and if not, adds the value.
-// Returns whether found and whether an eviction occurred.
-func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
- if c.lru.Contains(key) {
- return true, false
- }
- evicted = c.lru.Add(key, value)
- return false, evicted
-}
-
-// Remove removes the provided key from the cache.
-func (c *Cache) Remove(key interface{}) {
- c.lock.Lock()
- c.lru.Remove(key)
- c.lock.Unlock()
-}
-
-// RemoveOldest removes the oldest item from the cache.
-func (c *Cache) RemoveOldest() {
- c.lock.Lock()
- c.lru.RemoveOldest()
- c.lock.Unlock()
-}
-
-// Keys returns a slice of the keys in the cache, from oldest to newest.
-func (c *Cache) Keys() []interface{} {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.lru.Keys()
-}
-
-// Len returns the number of items in the cache.
-func (c *Cache) Len() int {
- c.lock.RLock()
- defer c.lock.RUnlock()
- return c.lru.Len()
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go
deleted file mode 100644
index 5673773b..00000000
--- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go
+++ /dev/null
@@ -1,161 +0,0 @@
-package simplelru
-
-import (
- "container/list"
- "errors"
-)
-
-// EvictCallback is used to get a callback when a cache entry is evicted
-type EvictCallback func(key interface{}, value interface{})
-
-// LRU implements a non-thread safe fixed size LRU cache
-type LRU struct {
- size int
- evictList *list.List
- items map[interface{}]*list.Element
- onEvict EvictCallback
-}
-
-// entry is used to hold a value in the evictList
-type entry struct {
- key interface{}
- value interface{}
-}
-
-// NewLRU constructs an LRU of the given size
-func NewLRU(size int, onEvict EvictCallback) (*LRU, error) {
- if size <= 0 {
- return nil, errors.New("Must provide a positive size")
- }
- c := &LRU{
- size: size,
- evictList: list.New(),
- items: make(map[interface{}]*list.Element),
- onEvict: onEvict,
- }
- return c, nil
-}
-
-// Purge is used to completely clear the cache.
-func (c *LRU) Purge() {
- for k, v := range c.items {
- if c.onEvict != nil {
- c.onEvict(k, v.Value.(*entry).value)
- }
- delete(c.items, k)
- }
- c.evictList.Init()
-}
-
-// Add adds a value to the cache. Returns true if an eviction occurred.
-func (c *LRU) Add(key, value interface{}) (evicted bool) {
- // Check for existing item
- if ent, ok := c.items[key]; ok {
- c.evictList.MoveToFront(ent)
- ent.Value.(*entry).value = value
- return false
- }
-
- // Add new item
- ent := &entry{key, value}
- entry := c.evictList.PushFront(ent)
- c.items[key] = entry
-
- evict := c.evictList.Len() > c.size
- // Verify size not exceeded
- if evict {
- c.removeOldest()
- }
- return evict
-}
-
-// Get looks up a key's value from the cache.
-func (c *LRU) Get(key interface{}) (value interface{}, ok bool) {
- if ent, ok := c.items[key]; ok {
- c.evictList.MoveToFront(ent)
- return ent.Value.(*entry).value, true
- }
- return
-}
-
-// Contains checks if a key is in the cache, without updating the recent-ness
-// or deleting it for being stale.
-func (c *LRU) Contains(key interface{}) (ok bool) {
- _, ok = c.items[key]
- return ok
-}
-
-// Peek returns the key value (or undefined if not found) without updating
-// the "recently used"-ness of the key.
-func (c *LRU) Peek(key interface{}) (value interface{}, ok bool) {
- var ent *list.Element
- if ent, ok = c.items[key]; ok {
- return ent.Value.(*entry).value, true
- }
- return nil, ok
-}
-
-// Remove removes the provided key from the cache, returning if the
-// key was contained.
-func (c *LRU) Remove(key interface{}) (present bool) {
- if ent, ok := c.items[key]; ok {
- c.removeElement(ent)
- return true
- }
- return false
-}
-
-// RemoveOldest removes the oldest item from the cache.
-func (c *LRU) RemoveOldest() (key interface{}, value interface{}, ok bool) {
- ent := c.evictList.Back()
- if ent != nil {
- c.removeElement(ent)
- kv := ent.Value.(*entry)
- return kv.key, kv.value, true
- }
- return nil, nil, false
-}
-
-// GetOldest returns the oldest entry
-func (c *LRU) GetOldest() (key interface{}, value interface{}, ok bool) {
- ent := c.evictList.Back()
- if ent != nil {
- kv := ent.Value.(*entry)
- return kv.key, kv.value, true
- }
- return nil, nil, false
-}
-
-// Keys returns a slice of the keys in the cache, from oldest to newest.
-func (c *LRU) Keys() []interface{} {
- keys := make([]interface{}, len(c.items))
- i := 0
- for ent := c.evictList.Back(); ent != nil; ent = ent.Prev() {
- keys[i] = ent.Value.(*entry).key
- i++
- }
- return keys
-}
-
-// Len returns the number of items in the cache.
-func (c *LRU) Len() int {
- return c.evictList.Len()
-}
-
-// removeOldest removes the oldest item from the cache.
-func (c *LRU) removeOldest() {
- ent := c.evictList.Back()
- if ent != nil {
- c.removeElement(ent)
- }
-}
-
-// removeElement is used to remove a given list element from the cache
-func (c *LRU) removeElement(e *list.Element) {
- c.evictList.Remove(e)
- kv := e.Value.(*entry)
- delete(c.items, kv.key)
- if c.onEvict != nil {
- c.onEvict(kv.key, kv.value)
- }
-}
diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go
deleted file mode 100644
index 74c70774..00000000
--- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package simplelru
-
-// LRUCache is the interface for simple LRU cache.
-type LRUCache interface {
- // Adds a value to the cache, returns true if an eviction occurred and
- // updates the "recently used"-ness of the key.
- Add(key, value interface{}) bool
-
- // Returns key's value from the cache and
- // updates the "recently used"-ness of the key. #value, isFound
- Get(key interface{}) (value interface{}, ok bool)
-
- // Check if a key exsists in cache without updating the recent-ness.
- Contains(key interface{}) (ok bool)
-
- // Returns key's value without updating the "recently used"-ness of the key.
- Peek(key interface{}) (value interface{}, ok bool)
-
- // Removes a key from the cache.
- Remove(key interface{}) bool
-
- // Removes the oldest entry from cache.
- RemoveOldest() (interface{}, interface{}, bool)
-
- // Returns the oldest entry from the cache. #key, value, isFound
- GetOldest() (interface{}, interface{}, bool)
-
- // Returns a slice of the keys in the cache, from oldest to newest.
- Keys() []interface{}
-
- // Returns the number of items in the cache.
- Len() int
-
- // Clear all cache entries
- Purge()
-}
diff --git a/vendor/github.com/hpcloud/tail/.gitignore b/vendor/github.com/hpcloud/tail/.gitignore
deleted file mode 100644
index 6d9953c3..00000000
--- a/vendor/github.com/hpcloud/tail/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-.test
-.go
-
diff --git a/vendor/github.com/hpcloud/tail/.travis.yml b/vendor/github.com/hpcloud/tail/.travis.yml
deleted file mode 100644
index 9cf8bb7f..00000000
--- a/vendor/github.com/hpcloud/tail/.travis.yml
+++ /dev/null
@@ -1,18 +0,0 @@
-language: go
-
-script:
- - go test -race -v ./...
-
-go:
- - 1.4
- - 1.5
- - 1.6
- - tip
-
-matrix:
- allow_failures:
- - go: tip
-
-install:
- - go get gopkg.in/fsnotify.v1
- - go get gopkg.in/tomb.v1
diff --git a/vendor/github.com/hpcloud/tail/CHANGES.md b/vendor/github.com/hpcloud/tail/CHANGES.md
deleted file mode 100644
index 422790c0..00000000
--- a/vendor/github.com/hpcloud/tail/CHANGES.md
+++ /dev/null
@@ -1,63 +0,0 @@
-# API v1 (gopkg.in/hpcloud/tail.v1)
-
-## April, 2016
-
-* Migrated to godep, as depman is not longer supported
-* Introduced golang vendoring feature
-* Fixed issue [#57](https://github.com/hpcloud/tail/issues/57) related to reopen deleted file
-
-## July, 2015
-
-* Fix inotify watcher leak; remove `Cleanup` (#51)
-
-# API v0 (gopkg.in/hpcloud/tail.v0)
-
-## June, 2015
-
-* Don't return partial lines (PR #40)
-* Use stable version of fsnotify (#46)
-
-## July, 2014
-
-* Fix tail for Windows (PR #36)
-
-## May, 2014
-
-* Improved rate limiting using leaky bucket (PR #29)
-* Fix odd line splitting (PR #30)
-
-## Apr, 2014
-
-* LimitRate now discards read buffer (PR #28)
-* allow reading of longer lines if MaxLineSize is unset (PR #24)
-* updated deps.json to latest fsnotify (441bbc86b1)
-
-## Feb, 2014
-
-* added `Config.Logger` to suppress library logging
-
-## Nov, 2013
-
-* add Cleanup to remove leaky inotify watches (PR #20)
-
-## Aug, 2013
-
-* redesigned Location field (PR #12)
-* add tail.Tell (PR #14)
-
-## July, 2013
-
-* Rate limiting (PR #10)
-
-## May, 2013
-
-* Detect file deletions/renames in polling file watcher (PR #1)
-* Detect file truncation
-* Fix potential race condition when reopening the file (issue 5)
-* Fix potential blocking of `tail.Stop` (issue 4)
-* Fix uncleaned up ChangeEvents goroutines after calling tail.Stop
-* Support Follow=false
-
-## Feb, 2013
-
-* Initial open source release
diff --git a/vendor/github.com/hpcloud/tail/Dockerfile b/vendor/github.com/hpcloud/tail/Dockerfile
deleted file mode 100644
index cd297b94..00000000
--- a/vendor/github.com/hpcloud/tail/Dockerfile
+++ /dev/null
@@ -1,19 +0,0 @@
-FROM golang
-
-RUN mkdir -p $GOPATH/src/github.com/hpcloud/tail/
-ADD . $GOPATH/src/github.com/hpcloud/tail/
-
-# expecting to fetch dependencies successfully.
-RUN go get -v github.com/hpcloud/tail
-
-# expecting to run the test successfully.
-RUN go test -v github.com/hpcloud/tail
-
-# expecting to install successfully
-RUN go install -v github.com/hpcloud/tail
-RUN go install -v github.com/hpcloud/tail/cmd/gotail
-
-RUN $GOPATH/bin/gotail -h || true
-
-ENV PATH $GOPATH/bin:$PATH
-CMD ["gotail"]
diff --git a/vendor/github.com/hpcloud/tail/LICENSE.txt b/vendor/github.com/hpcloud/tail/LICENSE.txt
deleted file mode 100644
index 818d802a..00000000
--- a/vendor/github.com/hpcloud/tail/LICENSE.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-# The MIT License (MIT)
-
-# © Copyright 2015 Hewlett Packard Enterprise Development LP
-Copyright (c) 2014 ActiveState
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/hpcloud/tail/Makefile b/vendor/github.com/hpcloud/tail/Makefile
deleted file mode 100644
index 6591b24f..00000000
--- a/vendor/github.com/hpcloud/tail/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-default: test
-
-test: *.go
- go test -v -race ./...
-
-fmt:
- gofmt -w .
-
-# Run the test in an isolated environment.
-fulltest:
- docker build -t hpcloud/tail .
diff --git a/vendor/github.com/hpcloud/tail/README.md b/vendor/github.com/hpcloud/tail/README.md
deleted file mode 100644
index fb7fbc26..00000000
--- a/vendor/github.com/hpcloud/tail/README.md
+++ /dev/null
@@ -1,28 +0,0 @@
-[](https://travis-ci.org/hpcloud/tail)
-[](https://ci.appveyor.com/project/HelionCloudFoundry/tail)
-
-# Go package for tail-ing files
-
-A Go package striving to emulate the features of the BSD `tail` program.
-
-```Go
-t, err := tail.TailFile("/var/log/nginx.log", tail.Config{Follow: true})
-for line := range t.Lines {
- fmt.Println(line.Text)
-}
-```
-
-See [API documentation](http://godoc.org/github.com/hpcloud/tail).
-
-## Log rotation
-
-Tail comes with full support for truncation/move detection as it is
-designed to work with log rotation tools.
-
-## Installing
-
- go get github.com/hpcloud/tail/...
-
-## Windows support
-
-This package [needs assistance](https://github.com/hpcloud/tail/labels/Windows) for full Windows support.
diff --git a/vendor/github.com/hpcloud/tail/appveyor.yml b/vendor/github.com/hpcloud/tail/appveyor.yml
deleted file mode 100644
index d370055b..00000000
--- a/vendor/github.com/hpcloud/tail/appveyor.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-version: 0.{build}
-skip_tags: true
-cache: C:\Users\appveyor\AppData\Local\NuGet\Cache
-build_script:
-- SET GOPATH=c:\workspace
-- go test -v -race ./...
-test: off
-clone_folder: c:\workspace\src\github.com\hpcloud\tail
-branches:
- only:
- - master
diff --git a/vendor/github.com/hpcloud/tail/ratelimiter/Licence b/vendor/github.com/hpcloud/tail/ratelimiter/Licence
deleted file mode 100644
index 434aab19..00000000
--- a/vendor/github.com/hpcloud/tail/ratelimiter/Licence
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright (C) 2013 99designs
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/hpcloud/tail/ratelimiter/leakybucket.go b/vendor/github.com/hpcloud/tail/ratelimiter/leakybucket.go
deleted file mode 100644
index 358b69e7..00000000
--- a/vendor/github.com/hpcloud/tail/ratelimiter/leakybucket.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// Package ratelimiter implements the Leaky Bucket ratelimiting algorithm with memcached and in-memory backends.
-package ratelimiter
-
-import (
- "time"
-)
-
-type LeakyBucket struct {
- Size uint16
- Fill float64
- LeakInterval time.Duration // time.Duration for 1 unit of size to leak
- Lastupdate time.Time
- Now func() time.Time
-}
-
-func NewLeakyBucket(size uint16, leakInterval time.Duration) *LeakyBucket {
- bucket := LeakyBucket{
- Size: size,
- Fill: 0,
- LeakInterval: leakInterval,
- Now: time.Now,
- Lastupdate: time.Now(),
- }
-
- return &bucket
-}
-
-func (b *LeakyBucket) updateFill() {
- now := b.Now()
- if b.Fill > 0 {
- elapsed := now.Sub(b.Lastupdate)
-
- b.Fill -= float64(elapsed) / float64(b.LeakInterval)
- if b.Fill < 0 {
- b.Fill = 0
- }
- }
- b.Lastupdate = now
-}
-
-func (b *LeakyBucket) Pour(amount uint16) bool {
- b.updateFill()
-
- var newfill float64 = b.Fill + float64(amount)
-
- if newfill > float64(b.Size) {
- return false
- }
-
- b.Fill = newfill
-
- return true
-}
-
-// The time at which this bucket will be completely drained
-func (b *LeakyBucket) DrainedAt() time.Time {
- return b.Lastupdate.Add(time.Duration(b.Fill * float64(b.LeakInterval)))
-}
-
-// The duration until this bucket is completely drained
-func (b *LeakyBucket) TimeToDrain() time.Duration {
- return b.DrainedAt().Sub(b.Now())
-}
-
-func (b *LeakyBucket) TimeSinceLastUpdate() time.Duration {
- return b.Now().Sub(b.Lastupdate)
-}
-
-type LeakyBucketSer struct {
- Size uint16
- Fill float64
- LeakInterval time.Duration // time.Duration for 1 unit of size to leak
- Lastupdate time.Time
-}
-
-func (b *LeakyBucket) Serialise() *LeakyBucketSer {
- bucket := LeakyBucketSer{
- Size: b.Size,
- Fill: b.Fill,
- LeakInterval: b.LeakInterval,
- Lastupdate: b.Lastupdate,
- }
-
- return &bucket
-}
-
-func (b *LeakyBucketSer) DeSerialise() *LeakyBucket {
- bucket := LeakyBucket{
- Size: b.Size,
- Fill: b.Fill,
- LeakInterval: b.LeakInterval,
- Lastupdate: b.Lastupdate,
- Now: time.Now,
- }
-
- return &bucket
-}
diff --git a/vendor/github.com/hpcloud/tail/ratelimiter/memory.go b/vendor/github.com/hpcloud/tail/ratelimiter/memory.go
deleted file mode 100644
index 8f6a5784..00000000
--- a/vendor/github.com/hpcloud/tail/ratelimiter/memory.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package ratelimiter
-
-import (
- "errors"
- "time"
-)
-
-const GC_SIZE int = 100
-
-type Memory struct {
- store map[string]LeakyBucket
- lastGCCollected time.Time
-}
-
-func NewMemory() *Memory {
- m := new(Memory)
- m.store = make(map[string]LeakyBucket)
- m.lastGCCollected = time.Now()
- return m
-}
-
-func (m *Memory) GetBucketFor(key string) (*LeakyBucket, error) {
-
- bucket, ok := m.store[key]
- if !ok {
- return nil, errors.New("miss")
- }
-
- return &bucket, nil
-}
-
-func (m *Memory) SetBucketFor(key string, bucket LeakyBucket) error {
-
- if len(m.store) > GC_SIZE {
- m.GarbageCollect()
- }
-
- m.store[key] = bucket
-
- return nil
-}
-
-func (m *Memory) GarbageCollect() {
- now := time.Now()
-
- // rate limit GC to once per minute
- if now.Add(60*time.Second).Unix() > m.lastGCCollected.Unix() {
-
- for key, bucket := range m.store {
- // if the bucket is drained, then GC
- if bucket.DrainedAt().Unix() > now.Unix() {
- delete(m.store, key)
- }
- }
-
- m.lastGCCollected = now
- }
-}
diff --git a/vendor/github.com/hpcloud/tail/ratelimiter/storage.go b/vendor/github.com/hpcloud/tail/ratelimiter/storage.go
deleted file mode 100644
index 89b2fe88..00000000
--- a/vendor/github.com/hpcloud/tail/ratelimiter/storage.go
+++ /dev/null
@@ -1,6 +0,0 @@
-package ratelimiter
-
-type Storage interface {
- GetBucketFor(string) (*LeakyBucket, error)
- SetBucketFor(string, LeakyBucket) error
-}
diff --git a/vendor/github.com/hpcloud/tail/tail.go b/vendor/github.com/hpcloud/tail/tail.go
deleted file mode 100644
index 2d252d60..00000000
--- a/vendor/github.com/hpcloud/tail/tail.go
+++ /dev/null
@@ -1,438 +0,0 @@
-// Copyright (c) 2015 HPE Software Inc. All rights reserved.
-// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
-
-package tail
-
-import (
- "bufio"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "os"
- "strings"
- "sync"
- "time"
-
- "github.com/hpcloud/tail/ratelimiter"
- "github.com/hpcloud/tail/util"
- "github.com/hpcloud/tail/watch"
- "gopkg.in/tomb.v1"
-)
-
-var (
- ErrStop = fmt.Errorf("tail should now stop")
-)
-
-type Line struct {
- Text string
- Time time.Time
- Err error // Error from tail
-}
-
-// NewLine returns a Line with present time.
-func NewLine(text string) *Line {
- return &Line{text, time.Now(), nil}
-}
-
-// SeekInfo represents arguments to `os.Seek`
-type SeekInfo struct {
- Offset int64
- Whence int // os.SEEK_*
-}
-
-type logger interface {
- Fatal(v ...interface{})
- Fatalf(format string, v ...interface{})
- Fatalln(v ...interface{})
- Panic(v ...interface{})
- Panicf(format string, v ...interface{})
- Panicln(v ...interface{})
- Print(v ...interface{})
- Printf(format string, v ...interface{})
- Println(v ...interface{})
-}
-
-// Config is used to specify how a file must be tailed.
-type Config struct {
- // File-specifc
- Location *SeekInfo // Seek to this location before tailing
- ReOpen bool // Reopen recreated files (tail -F)
- MustExist bool // Fail early if the file does not exist
- Poll bool // Poll for file changes instead of using inotify
- Pipe bool // Is a named pipe (mkfifo)
- RateLimiter *ratelimiter.LeakyBucket
-
- // Generic IO
- Follow bool // Continue looking for new lines (tail -f)
- MaxLineSize int // If non-zero, split longer lines into multiple lines
-
- // Logger, when nil, is set to tail.DefaultLogger
- // To disable logging: set field to tail.DiscardingLogger
- Logger logger
-}
-
-type Tail struct {
- Filename string
- Lines chan *Line
- Config
-
- file *os.File
- reader *bufio.Reader
-
- watcher watch.FileWatcher
- changes *watch.FileChanges
-
- tomb.Tomb // provides: Done, Kill, Dying
-
- lk sync.Mutex
-}
-
-var (
- // DefaultLogger is used when Config.Logger == nil
- DefaultLogger = log.New(os.Stderr, "", log.LstdFlags)
- // DiscardingLogger can be used to disable logging output
- DiscardingLogger = log.New(ioutil.Discard, "", 0)
-)
-
-// TailFile begins tailing the file. Output stream is made available
-// via the `Tail.Lines` channel. To handle errors during tailing,
-// invoke the `Wait` or `Err` method after finishing reading from the
-// `Lines` channel.
-func TailFile(filename string, config Config) (*Tail, error) {
- if config.ReOpen && !config.Follow {
- util.Fatal("cannot set ReOpen without Follow.")
- }
-
- t := &Tail{
- Filename: filename,
- Lines: make(chan *Line),
- Config: config,
- }
-
- // when Logger was not specified in config, use default logger
- if t.Logger == nil {
- t.Logger = log.New(os.Stderr, "", log.LstdFlags)
- }
-
- if t.Poll {
- t.watcher = watch.NewPollingFileWatcher(filename)
- } else {
- t.watcher = watch.NewInotifyFileWatcher(filename)
- }
-
- if t.MustExist {
- var err error
- t.file, err = OpenFile(t.Filename)
- if err != nil {
- return nil, err
- }
- }
-
- go t.tailFileSync()
-
- return t, nil
-}
-
-// Return the file's current position, like stdio's ftell().
-// But this value is not very accurate.
-// it may readed one line in the chan(tail.Lines),
-// so it may lost one line.
-func (tail *Tail) Tell() (offset int64, err error) {
- if tail.file == nil {
- return
- }
- offset, err = tail.file.Seek(0, os.SEEK_CUR)
- if err != nil {
- return
- }
-
- tail.lk.Lock()
- defer tail.lk.Unlock()
- if tail.reader == nil {
- return
- }
-
- offset -= int64(tail.reader.Buffered())
- return
-}
-
-// Stop stops the tailing activity.
-func (tail *Tail) Stop() error {
- tail.Kill(nil)
- return tail.Wait()
-}
-
-// StopAtEOF stops tailing as soon as the end of the file is reached.
-func (tail *Tail) StopAtEOF() error {
- tail.Kill(errStopAtEOF)
- return tail.Wait()
-}
-
-var errStopAtEOF = errors.New("tail: stop at eof")
-
-func (tail *Tail) close() {
- close(tail.Lines)
- tail.closeFile()
-}
-
-func (tail *Tail) closeFile() {
- if tail.file != nil {
- tail.file.Close()
- tail.file = nil
- }
-}
-
-func (tail *Tail) reopen() error {
- tail.closeFile()
- for {
- var err error
- tail.file, err = OpenFile(tail.Filename)
- if err != nil {
- if os.IsNotExist(err) {
- tail.Logger.Printf("Waiting for %s to appear...", tail.Filename)
- if err := tail.watcher.BlockUntilExists(&tail.Tomb); err != nil {
- if err == tomb.ErrDying {
- return err
- }
- return fmt.Errorf("Failed to detect creation of %s: %s", tail.Filename, err)
- }
- continue
- }
- return fmt.Errorf("Unable to open file %s: %s", tail.Filename, err)
- }
- break
- }
- return nil
-}
-
-func (tail *Tail) readLine() (string, error) {
- tail.lk.Lock()
- line, err := tail.reader.ReadString('\n')
- tail.lk.Unlock()
- if err != nil {
- // Note ReadString "returns the data read before the error" in
- // case of an error, including EOF, so we return it as is. The
- // caller is expected to process it if err is EOF.
- return line, err
- }
-
- line = strings.TrimRight(line, "\n")
-
- return line, err
-}
-
-func (tail *Tail) tailFileSync() {
- defer tail.Done()
- defer tail.close()
-
- if !tail.MustExist {
- // deferred first open.
- err := tail.reopen()
- if err != nil {
- if err != tomb.ErrDying {
- tail.Kill(err)
- }
- return
- }
- }
-
- // Seek to requested location on first open of the file.
- if tail.Location != nil {
- _, err := tail.file.Seek(tail.Location.Offset, tail.Location.Whence)
- tail.Logger.Printf("Seeked %s - %+v\n", tail.Filename, tail.Location)
- if err != nil {
- tail.Killf("Seek error on %s: %s", tail.Filename, err)
- return
- }
- }
-
- tail.openReader()
-
- var offset int64 = 0
- var err error
-
- // Read line by line.
- for {
- // do not seek in named pipes
- if !tail.Pipe {
- // grab the position in case we need to back up in the event of a half-line
- offset, err = tail.Tell()
- if err != nil {
- tail.Kill(err)
- return
- }
- }
-
- line, err := tail.readLine()
-
- // Process `line` even if err is EOF.
- if err == nil {
- cooloff := !tail.sendLine(line)
- if cooloff {
- // Wait a second before seeking till the end of
- // file when rate limit is reached.
- msg := fmt.Sprintf(
- "Too much log activity; waiting a second " +
- "before resuming tailing")
- tail.Lines <- &Line{msg, time.Now(), fmt.Errorf(msg)}
- select {
- case <-time.After(time.Second):
- case <-tail.Dying():
- return
- }
- if err := tail.seekEnd(); err != nil {
- tail.Kill(err)
- return
- }
- }
- } else if err == io.EOF {
- if !tail.Follow {
- if line != "" {
- tail.sendLine(line)
- }
- return
- }
-
- if tail.Follow && line != "" {
- // this has the potential to never return the last line if
- // it's not followed by a newline; seems a fair trade here
- err := tail.seekTo(SeekInfo{Offset: offset, Whence: 0})
- if err != nil {
- tail.Kill(err)
- return
- }
- }
-
- // When EOF is reached, wait for more data to become
- // available. Wait strategy is based on the `tail.watcher`
- // implementation (inotify or polling).
- err := tail.waitForChanges()
- if err != nil {
- if err != ErrStop {
- tail.Kill(err)
- }
- return
- }
- } else {
- // non-EOF error
- tail.Killf("Error reading %s: %s", tail.Filename, err)
- return
- }
-
- select {
- case <-tail.Dying():
- if tail.Err() == errStopAtEOF {
- continue
- }
- return
- default:
- }
- }
-}
-
-// waitForChanges waits until the file has been appended, deleted,
-// moved or truncated. When moved or deleted - the file will be
-// reopened if ReOpen is true. Truncated files are always reopened.
-func (tail *Tail) waitForChanges() error {
- if tail.changes == nil {
- pos, err := tail.file.Seek(0, os.SEEK_CUR)
- if err != nil {
- return err
- }
- tail.changes, err = tail.watcher.ChangeEvents(&tail.Tomb, pos)
- if err != nil {
- return err
- }
- }
-
- select {
- case <-tail.changes.Modified:
- return nil
- case <-tail.changes.Deleted:
- tail.changes = nil
- if tail.ReOpen {
- // XXX: we must not log from a library.
- tail.Logger.Printf("Re-opening moved/deleted file %s ...", tail.Filename)
- if err := tail.reopen(); err != nil {
- return err
- }
- tail.Logger.Printf("Successfully reopened %s", tail.Filename)
- tail.openReader()
- return nil
- } else {
- tail.Logger.Printf("Stopping tail as file no longer exists: %s", tail.Filename)
- return ErrStop
- }
- case <-tail.changes.Truncated:
- // Always reopen truncated files (Follow is true)
- tail.Logger.Printf("Re-opening truncated file %s ...", tail.Filename)
- if err := tail.reopen(); err != nil {
- return err
- }
- tail.Logger.Printf("Successfully reopened truncated %s", tail.Filename)
- tail.openReader()
- return nil
- case <-tail.Dying():
- return ErrStop
- }
- panic("unreachable")
-}
-
-func (tail *Tail) openReader() {
- if tail.MaxLineSize > 0 {
- // add 2 to account for newline characters
- tail.reader = bufio.NewReaderSize(tail.file, tail.MaxLineSize+2)
- } else {
- tail.reader = bufio.NewReader(tail.file)
- }
-}
-
-func (tail *Tail) seekEnd() error {
- return tail.seekTo(SeekInfo{Offset: 0, Whence: os.SEEK_END})
-}
-
-func (tail *Tail) seekTo(pos SeekInfo) error {
- _, err := tail.file.Seek(pos.Offset, pos.Whence)
- if err != nil {
- return fmt.Errorf("Seek error on %s: %s", tail.Filename, err)
- }
- // Reset the read buffer whenever the file is re-seek'ed
- tail.reader.Reset(tail.file)
- return nil
-}
-
-// sendLine sends the line(s) to Lines channel, splitting longer lines
-// if necessary. Return false if rate limit is reached.
-func (tail *Tail) sendLine(line string) bool {
- now := time.Now()
- lines := []string{line}
-
- // Split longer lines
- if tail.MaxLineSize > 0 && len(line) > tail.MaxLineSize {
- lines = util.PartitionString(line, tail.MaxLineSize)
- }
-
- for _, line := range lines {
- tail.Lines <- &Line{line, now, nil}
- }
-
- if tail.Config.RateLimiter != nil {
- ok := tail.Config.RateLimiter.Pour(uint16(len(lines)))
- if !ok {
- tail.Logger.Printf("Leaky bucket full (%v); entering 1s cooloff period.\n",
- tail.Filename)
- return false
- }
- }
-
- return true
-}
-
-// Cleanup removes inotify watches added by the tail package. This function is
-// meant to be invoked from a process's exit handler. Linux kernel may not
-// automatically remove inotify watches after the process exits.
-func (tail *Tail) Cleanup() {
- watch.Cleanup(tail.Filename)
-}
diff --git a/vendor/github.com/hpcloud/tail/tail_posix.go b/vendor/github.com/hpcloud/tail/tail_posix.go
deleted file mode 100644
index bc4dc335..00000000
--- a/vendor/github.com/hpcloud/tail/tail_posix.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build linux darwin freebsd netbsd openbsd
-
-package tail
-
-import (
- "os"
-)
-
-func OpenFile(name string) (file *os.File, err error) {
- return os.Open(name)
-}
diff --git a/vendor/github.com/hpcloud/tail/tail_windows.go b/vendor/github.com/hpcloud/tail/tail_windows.go
deleted file mode 100644
index ef2cfca1..00000000
--- a/vendor/github.com/hpcloud/tail/tail_windows.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build windows
-
-package tail
-
-import (
- "github.com/hpcloud/tail/winfile"
- "os"
-)
-
-func OpenFile(name string) (file *os.File, err error) {
- return winfile.OpenFile(name, os.O_RDONLY, 0)
-}
diff --git a/vendor/github.com/hpcloud/tail/util/util.go b/vendor/github.com/hpcloud/tail/util/util.go
deleted file mode 100644
index 54151fe3..00000000
--- a/vendor/github.com/hpcloud/tail/util/util.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (c) 2015 HPE Software Inc. All rights reserved.
-// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
-
-package util
-
-import (
- "fmt"
- "log"
- "os"
- "runtime/debug"
-)
-
-type Logger struct {
- *log.Logger
-}
-
-var LOGGER = &Logger{log.New(os.Stderr, "", log.LstdFlags)}
-
-// fatal is like panic except it displays only the current goroutine's stack.
-func Fatal(format string, v ...interface{}) {
- // https://github.com/hpcloud/log/blob/master/log.go#L45
- LOGGER.Output(2, fmt.Sprintf("FATAL -- "+format, v...)+"\n"+string(debug.Stack()))
- os.Exit(1)
-}
-
-// partitionString partitions the string into chunks of given size,
-// with the last chunk of variable size.
-func PartitionString(s string, chunkSize int) []string {
- if chunkSize <= 0 {
- panic("invalid chunkSize")
- }
- length := len(s)
- chunks := 1 + length/chunkSize
- start := 0
- end := chunkSize
- parts := make([]string, 0, chunks)
- for {
- if end > length {
- end = length
- }
- parts = append(parts, s[start:end])
- if end == length {
- break
- }
- start, end = end, end+chunkSize
- }
- return parts
-}
diff --git a/vendor/github.com/hpcloud/tail/watch/filechanges.go b/vendor/github.com/hpcloud/tail/watch/filechanges.go
deleted file mode 100644
index 3ce5dcec..00000000
--- a/vendor/github.com/hpcloud/tail/watch/filechanges.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package watch
-
-type FileChanges struct {
- Modified chan bool // Channel to get notified of modifications
- Truncated chan bool // Channel to get notified of truncations
- Deleted chan bool // Channel to get notified of deletions/renames
-}
-
-func NewFileChanges() *FileChanges {
- return &FileChanges{
- make(chan bool), make(chan bool), make(chan bool)}
-}
-
-func (fc *FileChanges) NotifyModified() {
- sendOnlyIfEmpty(fc.Modified)
-}
-
-func (fc *FileChanges) NotifyTruncated() {
- sendOnlyIfEmpty(fc.Truncated)
-}
-
-func (fc *FileChanges) NotifyDeleted() {
- sendOnlyIfEmpty(fc.Deleted)
-}
-
-// sendOnlyIfEmpty sends on a bool channel only if the channel has no
-// backlog to be read by other goroutines. This concurrency pattern
-// can be used to notify other goroutines if and only if they are
-// looking for it (i.e., subsequent notifications can be compressed
-// into one).
-func sendOnlyIfEmpty(ch chan bool) {
- select {
- case ch <- true:
- default:
- }
-}
diff --git a/vendor/github.com/hpcloud/tail/watch/inotify.go b/vendor/github.com/hpcloud/tail/watch/inotify.go
deleted file mode 100644
index 4478f1e1..00000000
--- a/vendor/github.com/hpcloud/tail/watch/inotify.go
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (c) 2015 HPE Software Inc. All rights reserved.
-// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
-
-package watch
-
-import (
- "fmt"
- "os"
- "path/filepath"
-
- "github.com/hpcloud/tail/util"
-
- "gopkg.in/fsnotify.v1"
- "gopkg.in/tomb.v1"
-)
-
-// InotifyFileWatcher uses inotify to monitor file changes.
-type InotifyFileWatcher struct {
- Filename string
- Size int64
-}
-
-func NewInotifyFileWatcher(filename string) *InotifyFileWatcher {
- fw := &InotifyFileWatcher{filepath.Clean(filename), 0}
- return fw
-}
-
-func (fw *InotifyFileWatcher) BlockUntilExists(t *tomb.Tomb) error {
- err := WatchCreate(fw.Filename)
- if err != nil {
- return err
- }
- defer RemoveWatchCreate(fw.Filename)
-
- // Do a real check now as the file might have been created before
- // calling `WatchFlags` above.
- if _, err = os.Stat(fw.Filename); !os.IsNotExist(err) {
- // file exists, or stat returned an error.
- return err
- }
-
- events := Events(fw.Filename)
-
- for {
- select {
- case evt, ok := <-events:
- if !ok {
- return fmt.Errorf("inotify watcher has been closed")
- }
- evtName, err := filepath.Abs(evt.Name)
- if err != nil {
- return err
- }
- fwFilename, err := filepath.Abs(fw.Filename)
- if err != nil {
- return err
- }
- if evtName == fwFilename {
- return nil
- }
- case <-t.Dying():
- return tomb.ErrDying
- }
- }
- panic("unreachable")
-}
-
-func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChanges, error) {
- err := Watch(fw.Filename)
- if err != nil {
- return nil, err
- }
-
- changes := NewFileChanges()
- fw.Size = pos
-
- go func() {
- defer RemoveWatch(fw.Filename)
-
- events := Events(fw.Filename)
-
- for {
- prevSize := fw.Size
-
- var evt fsnotify.Event
- var ok bool
-
- select {
- case evt, ok = <-events:
- if !ok {
- return
- }
- case <-t.Dying():
- return
- }
-
- switch {
- case evt.Op&fsnotify.Remove == fsnotify.Remove:
- fallthrough
-
- case evt.Op&fsnotify.Rename == fsnotify.Rename:
- changes.NotifyDeleted()
- return
-
- case evt.Op&fsnotify.Write == fsnotify.Write:
- fi, err := os.Stat(fw.Filename)
- if err != nil {
- if os.IsNotExist(err) {
- changes.NotifyDeleted()
- return
- }
- // XXX: report this error back to the user
- util.Fatal("Failed to stat file %v: %v", fw.Filename, err)
- }
- fw.Size = fi.Size()
-
- if prevSize > 0 && prevSize > fw.Size {
- changes.NotifyTruncated()
- } else {
- changes.NotifyModified()
- }
- prevSize = fw.Size
- }
- }
- }()
-
- return changes, nil
-}
diff --git a/vendor/github.com/hpcloud/tail/watch/inotify_tracker.go b/vendor/github.com/hpcloud/tail/watch/inotify_tracker.go
deleted file mode 100644
index 03be4275..00000000
--- a/vendor/github.com/hpcloud/tail/watch/inotify_tracker.go
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (c) 2015 HPE Software Inc. All rights reserved.
-// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
-
-package watch
-
-import (
- "log"
- "os"
- "path/filepath"
- "sync"
- "syscall"
-
- "github.com/hpcloud/tail/util"
-
- "gopkg.in/fsnotify.v1"
-)
-
-type InotifyTracker struct {
- mux sync.Mutex
- watcher *fsnotify.Watcher
- chans map[string]chan fsnotify.Event
- done map[string]chan bool
- watchNums map[string]int
- watch chan *watchInfo
- remove chan *watchInfo
- error chan error
-}
-
-type watchInfo struct {
- op fsnotify.Op
- fname string
-}
-
-func (this *watchInfo) isCreate() bool {
- return this.op == fsnotify.Create
-}
-
-var (
- // globally shared InotifyTracker; ensures only one fsnotify.Watcher is used
- shared *InotifyTracker
-
- // these are used to ensure the shared InotifyTracker is run exactly once
- once = sync.Once{}
- goRun = func() {
- shared = &InotifyTracker{
- mux: sync.Mutex{},
- chans: make(map[string]chan fsnotify.Event),
- done: make(map[string]chan bool),
- watchNums: make(map[string]int),
- watch: make(chan *watchInfo),
- remove: make(chan *watchInfo),
- error: make(chan error),
- }
- go shared.run()
- }
-
- logger = log.New(os.Stderr, "", log.LstdFlags)
-)
-
-// Watch signals the run goroutine to begin watching the input filename
-func Watch(fname string) error {
- return watch(&watchInfo{
- fname: fname,
- })
-}
-
-// Watch create signals the run goroutine to begin watching the input filename
-// if call the WatchCreate function, don't call the Cleanup, call the RemoveWatchCreate
-func WatchCreate(fname string) error {
- return watch(&watchInfo{
- op: fsnotify.Create,
- fname: fname,
- })
-}
-
-func watch(winfo *watchInfo) error {
- // start running the shared InotifyTracker if not already running
- once.Do(goRun)
-
- winfo.fname = filepath.Clean(winfo.fname)
- shared.watch <- winfo
- return <-shared.error
-}
-
-// RemoveWatch signals the run goroutine to remove the watch for the input filename
-func RemoveWatch(fname string) {
- remove(&watchInfo{
- fname: fname,
- })
-}
-
-// RemoveWatch create signals the run goroutine to remove the watch for the input filename
-func RemoveWatchCreate(fname string) {
- remove(&watchInfo{
- op: fsnotify.Create,
- fname: fname,
- })
-}
-
-func remove(winfo *watchInfo) {
- // start running the shared InotifyTracker if not already running
- once.Do(goRun)
-
- winfo.fname = filepath.Clean(winfo.fname)
- shared.mux.Lock()
- done := shared.done[winfo.fname]
- if done != nil {
- delete(shared.done, winfo.fname)
- close(done)
- }
-
- fname := winfo.fname
- if winfo.isCreate() {
- // Watch for new files to be created in the parent directory.
- fname = filepath.Dir(fname)
- }
- shared.watchNums[fname]--
- watchNum := shared.watchNums[fname]
- if watchNum == 0 {
- delete(shared.watchNums, fname)
- }
- shared.mux.Unlock()
-
- // If we were the last ones to watch this file, unsubscribe from inotify.
- // This needs to happen after releasing the lock because fsnotify waits
- // synchronously for the kernel to acknowledge the removal of the watch
- // for this file, which causes us to deadlock if we still held the lock.
- if watchNum == 0 {
- shared.watcher.Remove(fname)
- }
- shared.remove <- winfo
-}
-
-// Events returns a channel to which FileEvents corresponding to the input filename
-// will be sent. This channel will be closed when removeWatch is called on this
-// filename.
-func Events(fname string) <-chan fsnotify.Event {
- shared.mux.Lock()
- defer shared.mux.Unlock()
-
- return shared.chans[fname]
-}
-
-// Cleanup removes the watch for the input filename if necessary.
-func Cleanup(fname string) {
- RemoveWatch(fname)
-}
-
-// watchFlags calls fsnotify.WatchFlags for the input filename and flags, creating
-// a new Watcher if the previous Watcher was closed.
-func (shared *InotifyTracker) addWatch(winfo *watchInfo) error {
- shared.mux.Lock()
- defer shared.mux.Unlock()
-
- if shared.chans[winfo.fname] == nil {
- shared.chans[winfo.fname] = make(chan fsnotify.Event)
- shared.done[winfo.fname] = make(chan bool)
- }
-
- fname := winfo.fname
- if winfo.isCreate() {
- // Watch for new files to be created in the parent directory.
- fname = filepath.Dir(fname)
- }
-
- // already in inotify watch
- if shared.watchNums[fname] > 0 {
- shared.watchNums[fname]++
- if winfo.isCreate() {
- shared.watchNums[winfo.fname]++
- }
- return nil
- }
-
- err := shared.watcher.Add(fname)
- if err == nil {
- shared.watchNums[fname]++
- if winfo.isCreate() {
- shared.watchNums[winfo.fname]++
- }
- }
- return err
-}
-
-// removeWatch calls fsnotify.RemoveWatch for the input filename and closes the
-// corresponding events channel.
-func (shared *InotifyTracker) removeWatch(winfo *watchInfo) {
- shared.mux.Lock()
- defer shared.mux.Unlock()
-
- ch := shared.chans[winfo.fname]
- if ch == nil {
- return
- }
-
- delete(shared.chans, winfo.fname)
- close(ch)
-
- if !winfo.isCreate() {
- return
- }
-
- shared.watchNums[winfo.fname]--
- if shared.watchNums[winfo.fname] == 0 {
- delete(shared.watchNums, winfo.fname)
- }
-}
-
-// sendEvent sends the input event to the appropriate Tail.
-func (shared *InotifyTracker) sendEvent(event fsnotify.Event) {
- name := filepath.Clean(event.Name)
-
- shared.mux.Lock()
- ch := shared.chans[name]
- done := shared.done[name]
- shared.mux.Unlock()
-
- if ch != nil && done != nil {
- select {
- case ch <- event:
- case <-done:
- }
- }
-}
-
-// run starts the goroutine in which the shared struct reads events from its
-// Watcher's Event channel and sends the events to the appropriate Tail.
-func (shared *InotifyTracker) run() {
- watcher, err := fsnotify.NewWatcher()
- if err != nil {
- util.Fatal("failed to create Watcher")
- }
- shared.watcher = watcher
-
- for {
- select {
- case winfo := <-shared.watch:
- shared.error <- shared.addWatch(winfo)
-
- case winfo := <-shared.remove:
- shared.removeWatch(winfo)
-
- case event, open := <-shared.watcher.Events:
- if !open {
- return
- }
- shared.sendEvent(event)
-
- case err, open := <-shared.watcher.Errors:
- if !open {
- return
- } else if err != nil {
- sysErr, ok := err.(*os.SyscallError)
- if !ok || sysErr.Err != syscall.EINTR {
- logger.Printf("Error in Watcher Error channel: %s", err)
- }
- }
- }
- }
-}
diff --git a/vendor/github.com/hpcloud/tail/watch/polling.go b/vendor/github.com/hpcloud/tail/watch/polling.go
deleted file mode 100644
index 49491f21..00000000
--- a/vendor/github.com/hpcloud/tail/watch/polling.go
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (c) 2015 HPE Software Inc. All rights reserved.
-// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
-
-package watch
-
-import (
- "os"
- "runtime"
- "time"
-
- "github.com/hpcloud/tail/util"
- "gopkg.in/tomb.v1"
-)
-
-// PollingFileWatcher polls the file for changes.
-type PollingFileWatcher struct {
- Filename string
- Size int64
-}
-
-func NewPollingFileWatcher(filename string) *PollingFileWatcher {
- fw := &PollingFileWatcher{filename, 0}
- return fw
-}
-
-var POLL_DURATION time.Duration
-
-func (fw *PollingFileWatcher) BlockUntilExists(t *tomb.Tomb) error {
- for {
- if _, err := os.Stat(fw.Filename); err == nil {
- return nil
- } else if !os.IsNotExist(err) {
- return err
- }
- select {
- case <-time.After(POLL_DURATION):
- continue
- case <-t.Dying():
- return tomb.ErrDying
- }
- }
- panic("unreachable")
-}
-
-func (fw *PollingFileWatcher) ChangeEvents(t *tomb.Tomb, pos int64) (*FileChanges, error) {
- origFi, err := os.Stat(fw.Filename)
- if err != nil {
- return nil, err
- }
-
- changes := NewFileChanges()
- var prevModTime time.Time
-
- // XXX: use tomb.Tomb to cleanly manage these goroutines. replace
- // the fatal (below) with tomb's Kill.
-
- fw.Size = pos
-
- go func() {
- prevSize := fw.Size
- for {
- select {
- case <-t.Dying():
- return
- default:
- }
-
- time.Sleep(POLL_DURATION)
- fi, err := os.Stat(fw.Filename)
- if err != nil {
- // Windows cannot delete a file if a handle is still open (tail keeps one open)
- // so it gives access denied to anything trying to read it until all handles are released.
- if os.IsNotExist(err) || (runtime.GOOS == "windows" && os.IsPermission(err)) {
- // File does not exist (has been deleted).
- changes.NotifyDeleted()
- return
- }
-
- // XXX: report this error back to the user
- util.Fatal("Failed to stat file %v: %v", fw.Filename, err)
- }
-
- // File got moved/renamed?
- if !os.SameFile(origFi, fi) {
- changes.NotifyDeleted()
- return
- }
-
- // File got truncated?
- fw.Size = fi.Size()
- if prevSize > 0 && prevSize > fw.Size {
- changes.NotifyTruncated()
- prevSize = fw.Size
- continue
- }
- // File got bigger?
- if prevSize > 0 && prevSize < fw.Size {
- changes.NotifyModified()
- prevSize = fw.Size
- continue
- }
- prevSize = fw.Size
-
- // File was appended to (changed)?
- modTime := fi.ModTime()
- if modTime != prevModTime {
- prevModTime = modTime
- changes.NotifyModified()
- }
- }
- }()
-
- return changes, nil
-}
-
-func init() {
- POLL_DURATION = 250 * time.Millisecond
-}
diff --git a/vendor/github.com/hpcloud/tail/watch/watch.go b/vendor/github.com/hpcloud/tail/watch/watch.go
deleted file mode 100644
index 2e1783ef..00000000
--- a/vendor/github.com/hpcloud/tail/watch/watch.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2015 HPE Software Inc. All rights reserved.
-// Copyright (c) 2013 ActiveState Software Inc. All rights reserved.
-
-package watch
-
-import "gopkg.in/tomb.v1"
-
-// FileWatcher monitors file-level events.
-type FileWatcher interface {
- // BlockUntilExists blocks until the file comes into existence.
- BlockUntilExists(*tomb.Tomb) error
-
- // ChangeEvents reports on changes to a file, be it modification,
- // deletion, renames or truncations. Returned FileChanges group of
- // channels will be closed, thus become unusable, after a deletion
- // or truncation event.
- // In order to properly report truncations, ChangeEvents requires
- // the caller to pass their current offset in the file.
- ChangeEvents(*tomb.Tomb, int64) (*FileChanges, error)
-}
diff --git a/vendor/github.com/hpcloud/tail/winfile/winfile.go b/vendor/github.com/hpcloud/tail/winfile/winfile.go
deleted file mode 100644
index aa7e7bc5..00000000
--- a/vendor/github.com/hpcloud/tail/winfile/winfile.go
+++ /dev/null
@@ -1,92 +0,0 @@
-// +build windows
-
-package winfile
-
-import (
- "os"
- "syscall"
- "unsafe"
-)
-
-// issue also described here
-//https://codereview.appspot.com/8203043/
-
-// https://github.com/jnwhiteh/golang/blob/master/src/pkg/syscall/syscall_windows.go#L218
-func Open(path string, mode int, perm uint32) (fd syscall.Handle, err error) {
- if len(path) == 0 {
- return syscall.InvalidHandle, syscall.ERROR_FILE_NOT_FOUND
- }
- pathp, err := syscall.UTF16PtrFromString(path)
- if err != nil {
- return syscall.InvalidHandle, err
- }
- var access uint32
- switch mode & (syscall.O_RDONLY | syscall.O_WRONLY | syscall.O_RDWR) {
- case syscall.O_RDONLY:
- access = syscall.GENERIC_READ
- case syscall.O_WRONLY:
- access = syscall.GENERIC_WRITE
- case syscall.O_RDWR:
- access = syscall.GENERIC_READ | syscall.GENERIC_WRITE
- }
- if mode&syscall.O_CREAT != 0 {
- access |= syscall.GENERIC_WRITE
- }
- if mode&syscall.O_APPEND != 0 {
- access &^= syscall.GENERIC_WRITE
- access |= syscall.FILE_APPEND_DATA
- }
- sharemode := uint32(syscall.FILE_SHARE_READ | syscall.FILE_SHARE_WRITE | syscall.FILE_SHARE_DELETE)
- var sa *syscall.SecurityAttributes
- if mode&syscall.O_CLOEXEC == 0 {
- sa = makeInheritSa()
- }
- var createmode uint32
- switch {
- case mode&(syscall.O_CREAT|syscall.O_EXCL) == (syscall.O_CREAT | syscall.O_EXCL):
- createmode = syscall.CREATE_NEW
- case mode&(syscall.O_CREAT|syscall.O_TRUNC) == (syscall.O_CREAT | syscall.O_TRUNC):
- createmode = syscall.CREATE_ALWAYS
- case mode&syscall.O_CREAT == syscall.O_CREAT:
- createmode = syscall.OPEN_ALWAYS
- case mode&syscall.O_TRUNC == syscall.O_TRUNC:
- createmode = syscall.TRUNCATE_EXISTING
- default:
- createmode = syscall.OPEN_EXISTING
- }
- h, e := syscall.CreateFile(pathp, access, sharemode, sa, createmode, syscall.FILE_ATTRIBUTE_NORMAL, 0)
- return h, e
-}
-
-// https://github.com/jnwhiteh/golang/blob/master/src/pkg/syscall/syscall_windows.go#L211
-func makeInheritSa() *syscall.SecurityAttributes {
- var sa syscall.SecurityAttributes
- sa.Length = uint32(unsafe.Sizeof(sa))
- sa.InheritHandle = 1
- return &sa
-}
-
-// https://github.com/jnwhiteh/golang/blob/master/src/pkg/os/file_windows.go#L133
-func OpenFile(name string, flag int, perm os.FileMode) (file *os.File, err error) {
- r, e := Open(name, flag|syscall.O_CLOEXEC, syscallMode(perm))
- if e != nil {
- return nil, e
- }
- return os.NewFile(uintptr(r), name), nil
-}
-
-// https://github.com/jnwhiteh/golang/blob/master/src/pkg/os/file_posix.go#L61
-func syscallMode(i os.FileMode) (o uint32) {
- o |= uint32(i.Perm())
- if i&os.ModeSetuid != 0 {
- o |= syscall.S_ISUID
- }
- if i&os.ModeSetgid != 0 {
- o |= syscall.S_ISGID
- }
- if i&os.ModeSticky != 0 {
- o |= syscall.S_ISVTX
- }
- // No mapping for Go's ModeTemporary (plan9 only).
- return
-}
diff --git a/vendor/github.com/imdario/mergo/.gitignore b/vendor/github.com/imdario/mergo/.gitignore
deleted file mode 100644
index 529c3412..00000000
--- a/vendor/github.com/imdario/mergo/.gitignore
+++ /dev/null
@@ -1,33 +0,0 @@
-#### joe made this: http://goel.io/joe
-
-#### go ####
-# Binaries for programs and plugins
-*.exe
-*.dll
-*.so
-*.dylib
-
-# Test binary, build with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
-
-# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
-.glide/
-
-#### vim ####
-# Swap
-[._]*.s[a-v][a-z]
-[._]*.sw[a-p]
-[._]s[a-v][a-z]
-[._]sw[a-p]
-
-# Session
-Session.vim
-
-# Temporary
-.netrwhist
-*~
-# Auto-generated tag files
-tags
diff --git a/vendor/github.com/imdario/mergo/.travis.yml b/vendor/github.com/imdario/mergo/.travis.yml
deleted file mode 100644
index b13a50ed..00000000
--- a/vendor/github.com/imdario/mergo/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: go
-install:
- - go get -t
- - go get golang.org/x/tools/cmd/cover
- - go get github.com/mattn/goveralls
-script:
- - $HOME/gopath/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN
diff --git a/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md b/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md
deleted file mode 100644
index 469b4490..00000000
--- a/vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# Contributor Covenant Code of Conduct
-
-## Our Pledge
-
-In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment include:
-
-* Using welcoming and inclusive language
-* Being respectful of differing viewpoints and experiences
-* Gracefully accepting constructive criticism
-* Focusing on what is best for the community
-* Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-* The use of sexualized language or imagery and unwelcome sexual attention or advances
-* Trolling, insulting/derogatory comments, and personal or political attacks
-* Public or private harassment
-* Publishing others' private information, such as a physical or electronic address, without explicit permission
-* Other conduct which could reasonably be considered inappropriate in a professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
-
-## Scope
-
-This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at i@dario.im. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
-
-[homepage]: http://contributor-covenant.org
-[version]: http://contributor-covenant.org/version/1/4/
diff --git a/vendor/github.com/imdario/mergo/LICENSE b/vendor/github.com/imdario/mergo/LICENSE
deleted file mode 100644
index 68668029..00000000
--- a/vendor/github.com/imdario/mergo/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2013 Dario Castañé. All rights reserved.
-Copyright (c) 2012 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
- * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md
deleted file mode 100644
index 8b76f1fb..00000000
--- a/vendor/github.com/imdario/mergo/README.md
+++ /dev/null
@@ -1,222 +0,0 @@
-# Mergo
-
-A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements.
-
-Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region of Marche.
-
-## Status
-
-It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc](https://github.com/imdario/mergo#mergo-in-the-wild).
-
-[![GoDoc][3]][4]
-[![GoCard][5]][6]
-[![Build Status][1]][2]
-[![Coverage Status][7]][8]
-[![Sourcegraph][9]][10]
-
-[1]: https://travis-ci.org/imdario/mergo.png
-[2]: https://travis-ci.org/imdario/mergo
-[3]: https://godoc.org/github.com/imdario/mergo?status.svg
-[4]: https://godoc.org/github.com/imdario/mergo
-[5]: https://goreportcard.com/badge/imdario/mergo
-[6]: https://goreportcard.com/report/github.com/imdario/mergo
-[7]: https://coveralls.io/repos/github/imdario/mergo/badge.svg?branch=master
-[8]: https://coveralls.io/github/imdario/mergo?branch=master
-[9]: https://sourcegraph.com/github.com/imdario/mergo/-/badge.svg
-[10]: https://sourcegraph.com/github.com/imdario/mergo?badge
-
-### Latest release
-
-[Release v0.3.6](https://github.com/imdario/mergo/releases/tag/v0.3.6).
-
-### Important note
-
-Please keep in mind that in [0.3.2](//github.com/imdario/mergo/releases/tag/0.3.2) Mergo changed `Merge()`and `Map()` signatures to support [transformers](#transformers). An optional/variadic argument has been added, so it won't break existing code.
-
-If you were using Mergo **before** April 6th 2015, please check your project works as intended after updating your local copy with ```go get -u github.com/imdario/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause (I hope it won't!) in existing projects after the change (release 0.2.0).
-
-### Donations
-
-If Mergo is useful to you, consider buying me a coffee, a beer or making a monthly donation so I can keep building great free software. :heart_eyes:
-
-
-[](https://beerpay.io/imdario/mergo)
-[](https://beerpay.io/imdario/mergo)
-
-
-### Mergo in the wild
-
-- [moby/moby](https://github.com/moby/moby)
-- [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes)
-- [vmware/dispatch](https://github.com/vmware/dispatch)
-- [Shopify/themekit](https://github.com/Shopify/themekit)
-- [imdario/zas](https://github.com/imdario/zas)
-- [matcornic/hermes](https://github.com/matcornic/hermes)
-- [OpenBazaar/openbazaar-go](https://github.com/OpenBazaar/openbazaar-go)
-- [kataras/iris](https://github.com/kataras/iris)
-- [michaelsauter/crane](https://github.com/michaelsauter/crane)
-- [go-task/task](https://github.com/go-task/task)
-- [sensu/uchiwa](https://github.com/sensu/uchiwa)
-- [ory/hydra](https://github.com/ory/hydra)
-- [sisatech/vcli](https://github.com/sisatech/vcli)
-- [dairycart/dairycart](https://github.com/dairycart/dairycart)
-- [projectcalico/felix](https://github.com/projectcalico/felix)
-- [resin-os/balena](https://github.com/resin-os/balena)
-- [go-kivik/kivik](https://github.com/go-kivik/kivik)
-- [Telefonica/govice](https://github.com/Telefonica/govice)
-- [supergiant/supergiant](supergiant/supergiant)
-- [SergeyTsalkov/brooce](https://github.com/SergeyTsalkov/brooce)
-- [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy)
-- [ohsu-comp-bio/funnel](https://github.com/ohsu-comp-bio/funnel)
-- [EagerIO/Stout](https://github.com/EagerIO/Stout)
-- [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api)
-- [russross/canvasassignments](https://github.com/russross/canvasassignments)
-- [rdegges/cryptly-api](https://github.com/rdegges/cryptly-api)
-- [casualjim/exeggutor](https://github.com/casualjim/exeggutor)
-- [divshot/gitling](https://github.com/divshot/gitling)
-- [RWJMurphy/gorl](https://github.com/RWJMurphy/gorl)
-- [andrerocker/deploy42](https://github.com/andrerocker/deploy42)
-- [elwinar/rambler](https://github.com/elwinar/rambler)
-- [tmaiaroto/gopartman](https://github.com/tmaiaroto/gopartman)
-- [jfbus/impressionist](https://github.com/jfbus/impressionist)
-- [Jmeyering/zealot](https://github.com/Jmeyering/zealot)
-- [godep-migrator/rigger-host](https://github.com/godep-migrator/rigger-host)
-- [Dronevery/MultiwaySwitch-Go](https://github.com/Dronevery/MultiwaySwitch-Go)
-- [thoas/picfit](https://github.com/thoas/picfit)
-- [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server)
-- [jnuthong/item_search](https://github.com/jnuthong/item_search)
-- [bukalapak/snowboard](https://github.com/bukalapak/snowboard)
-
-## Installation
-
- go get github.com/imdario/mergo
-
- // use in your .go code
- import (
- "github.com/imdario/mergo"
- )
-
-## Usage
-
-You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. It won't merge empty structs value as [they are not considered zero values](https://golang.org/ref/spec#The_zero_value) either. Also maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection).
-
-```go
-if err := mergo.Merge(&dst, src); err != nil {
- // ...
-}
-```
-
-Also, you can merge overwriting values using the transformer `WithOverride`.
-
-```go
-if err := mergo.Merge(&dst, src, mergo.WithOverride); err != nil {
- // ...
-}
-```
-
-Additionally, you can map a `map[string]interface{}` to a struct (and otherwise, from struct to map), following the same restrictions as in `Merge()`. Keys are capitalized to find each corresponding exported field.
-
-```go
-if err := mergo.Map(&dst, srcMap); err != nil {
- // ...
-}
-```
-
-Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as `map[string]interface{}`. They will be just assigned as values.
-
-More information and examples in [godoc documentation](http://godoc.org/github.com/imdario/mergo).
-
-### Nice example
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/imdario/mergo"
-)
-
-type Foo struct {
- A string
- B int64
-}
-
-func main() {
- src := Foo{
- A: "one",
- B: 2,
- }
- dest := Foo{
- A: "two",
- }
- mergo.Merge(&dest, src)
- fmt.Println(dest)
- // Will print
- // {two 2}
-}
-```
-
-Note: if test are failing due missing package, please execute:
-
- go get gopkg.in/yaml.v2
-
-### Transformers
-
-Transformers allow to merge specific types differently than in the default behavior. In other words, now you can customize how some types are merged. For example, `time.Time` is a struct; it doesn't have zero value but IsZero can return true because it has fields with zero value. How can we merge a non-zero `time.Time`?
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/imdario/mergo"
- "reflect"
- "time"
-)
-
-type timeTransfomer struct {
-}
-
-func (t timeTransfomer) Transformer(typ reflect.Type) func(dst, src reflect.Value) error {
- if typ == reflect.TypeOf(time.Time{}) {
- return func(dst, src reflect.Value) error {
- if dst.CanSet() {
- isZero := dst.MethodByName("IsZero")
- result := isZero.Call([]reflect.Value{})
- if result[0].Bool() {
- dst.Set(src)
- }
- }
- return nil
- }
- }
- return nil
-}
-
-type Snapshot struct {
- Time time.Time
- // ...
-}
-
-func main() {
- src := Snapshot{time.Now()}
- dest := Snapshot{}
- mergo.Merge(&dest, src, mergo.WithTransformers(timeTransfomer{}))
- fmt.Println(dest)
- // Will print
- // { 2018-01-12 01:15:00 +0000 UTC m=+0.000000001 }
-}
-```
-
-
-## Contact me
-
-If I can help you, you have an idea or you are using Mergo in your projects, don't hesitate to drop me a line (or a pull request): [@im_dario](https://twitter.com/im_dario)
-
-## About
-
-Written by [Dario Castañé](http://dario.im).
-
-## License
-
-[BSD 3-Clause](http://opensource.org/licenses/BSD-3-Clause) license, as [Go language](http://golang.org/LICENSE).
diff --git a/vendor/github.com/imdario/mergo/doc.go b/vendor/github.com/imdario/mergo/doc.go
deleted file mode 100644
index 6e9aa7ba..00000000
--- a/vendor/github.com/imdario/mergo/doc.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2013 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package mergo merges same-type structs and maps by setting default values in zero-value fields.
-
-Mergo won't merge unexported (private) fields but will do recursively any exported one. It also won't merge structs inside maps (because they are not addressable using Go reflection).
-
-Usage
-
-From my own work-in-progress project:
-
- type networkConfig struct {
- Protocol string
- Address string
- ServerType string `json: "server_type"`
- Port uint16
- }
-
- type FssnConfig struct {
- Network networkConfig
- }
-
- var fssnDefault = FssnConfig {
- networkConfig {
- "tcp",
- "127.0.0.1",
- "http",
- 31560,
- },
- }
-
- // Inside a function [...]
-
- if err := mergo.Merge(&config, fssnDefault); err != nil {
- log.Fatal(err)
- }
-
- // More code [...]
-
-*/
-package mergo
diff --git a/vendor/github.com/imdario/mergo/map.go b/vendor/github.com/imdario/mergo/map.go
deleted file mode 100644
index 6ea38e63..00000000
--- a/vendor/github.com/imdario/mergo/map.go
+++ /dev/null
@@ -1,174 +0,0 @@
-// Copyright 2014 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Based on src/pkg/reflect/deepequal.go from official
-// golang's stdlib.
-
-package mergo
-
-import (
- "fmt"
- "reflect"
- "unicode"
- "unicode/utf8"
-)
-
-func changeInitialCase(s string, mapper func(rune) rune) string {
- if s == "" {
- return s
- }
- r, n := utf8.DecodeRuneInString(s)
- return string(mapper(r)) + s[n:]
-}
-
-func isExported(field reflect.StructField) bool {
- r, _ := utf8.DecodeRuneInString(field.Name)
- return r >= 'A' && r <= 'Z'
-}
-
-// Traverses recursively both values, assigning src's fields values to dst.
-// The map argument tracks comparisons that have already been seen, which allows
-// short circuiting on recursive types.
-func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) {
- overwrite := config.Overwrite
- if dst.CanAddr() {
- addr := dst.UnsafeAddr()
- h := 17 * addr
- seen := visited[h]
- typ := dst.Type()
- for p := seen; p != nil; p = p.next {
- if p.ptr == addr && p.typ == typ {
- return nil
- }
- }
- // Remember, remember...
- visited[h] = &visit{addr, typ, seen}
- }
- zeroValue := reflect.Value{}
- switch dst.Kind() {
- case reflect.Map:
- dstMap := dst.Interface().(map[string]interface{})
- for i, n := 0, src.NumField(); i < n; i++ {
- srcType := src.Type()
- field := srcType.Field(i)
- if !isExported(field) {
- continue
- }
- fieldName := field.Name
- fieldName = changeInitialCase(fieldName, unicode.ToLower)
- if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v)) || overwrite) {
- dstMap[fieldName] = src.Field(i).Interface()
- }
- }
- case reflect.Ptr:
- if dst.IsNil() {
- v := reflect.New(dst.Type().Elem())
- dst.Set(v)
- }
- dst = dst.Elem()
- fallthrough
- case reflect.Struct:
- srcMap := src.Interface().(map[string]interface{})
- for key := range srcMap {
- srcValue := srcMap[key]
- fieldName := changeInitialCase(key, unicode.ToUpper)
- dstElement := dst.FieldByName(fieldName)
- if dstElement == zeroValue {
- // We discard it because the field doesn't exist.
- continue
- }
- srcElement := reflect.ValueOf(srcValue)
- dstKind := dstElement.Kind()
- srcKind := srcElement.Kind()
- if srcKind == reflect.Ptr && dstKind != reflect.Ptr {
- srcElement = srcElement.Elem()
- srcKind = reflect.TypeOf(srcElement.Interface()).Kind()
- } else if dstKind == reflect.Ptr {
- // Can this work? I guess it can't.
- if srcKind != reflect.Ptr && srcElement.CanAddr() {
- srcPtr := srcElement.Addr()
- srcElement = reflect.ValueOf(srcPtr)
- srcKind = reflect.Ptr
- }
- }
-
- if !srcElement.IsValid() {
- continue
- }
- if srcKind == dstKind {
- if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil {
- return
- }
- } else if dstKind == reflect.Interface && dstElement.Kind() == reflect.Interface {
- if err = deepMerge(dstElement, srcElement, visited, depth+1, config); err != nil {
- return
- }
- } else if srcKind == reflect.Map {
- if err = deepMap(dstElement, srcElement, visited, depth+1, config); err != nil {
- return
- }
- } else {
- return fmt.Errorf("type mismatch on %s field: found %v, expected %v", fieldName, srcKind, dstKind)
- }
- }
- }
- return
-}
-
-// Map sets fields' values in dst from src.
-// src can be a map with string keys or a struct. dst must be the opposite:
-// if src is a map, dst must be a valid pointer to struct. If src is a struct,
-// dst must be map[string]interface{}.
-// It won't merge unexported (private) fields and will do recursively
-// any exported field.
-// If dst is a map, keys will be src fields' names in lower camel case.
-// Missing key in src that doesn't match a field in dst will be skipped. This
-// doesn't apply if dst is a map.
-// This is separated method from Merge because it is cleaner and it keeps sane
-// semantics: merging equal types, mapping different (restricted) types.
-func Map(dst, src interface{}, opts ...func(*Config)) error {
- return _map(dst, src, opts...)
-}
-
-// MapWithOverwrite will do the same as Map except that non-empty dst attributes will be overridden by
-// non-empty src attribute values.
-// Deprecated: Use Map(…) with WithOverride
-func MapWithOverwrite(dst, src interface{}, opts ...func(*Config)) error {
- return _map(dst, src, append(opts, WithOverride)...)
-}
-
-func _map(dst, src interface{}, opts ...func(*Config)) error {
- var (
- vDst, vSrc reflect.Value
- err error
- )
- config := &Config{}
-
- for _, opt := range opts {
- opt(config)
- }
-
- if vDst, vSrc, err = resolveValues(dst, src); err != nil {
- return err
- }
- // To be friction-less, we redirect equal-type arguments
- // to deepMerge. Only because arguments can be anything.
- if vSrc.Kind() == vDst.Kind() {
- return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config)
- }
- switch vSrc.Kind() {
- case reflect.Struct:
- if vDst.Kind() != reflect.Map {
- return ErrExpectedMapAsDestination
- }
- case reflect.Map:
- if vDst.Kind() != reflect.Struct {
- return ErrExpectedStructAsDestination
- }
- default:
- return ErrNotSupported
- }
- return deepMap(vDst, vSrc, make(map[uintptr]*visit), 0, config)
-}
diff --git a/vendor/github.com/imdario/mergo/merge.go b/vendor/github.com/imdario/mergo/merge.go
deleted file mode 100644
index 44f70a89..00000000
--- a/vendor/github.com/imdario/mergo/merge.go
+++ /dev/null
@@ -1,252 +0,0 @@
-// Copyright 2013 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Based on src/pkg/reflect/deepequal.go from official
-// golang's stdlib.
-
-package mergo
-
-import (
- "fmt"
- "reflect"
-)
-
-func hasExportedField(dst reflect.Value) (exported bool) {
- for i, n := 0, dst.NumField(); i < n; i++ {
- field := dst.Type().Field(i)
- if field.Anonymous && dst.Field(i).Kind() == reflect.Struct {
- exported = exported || hasExportedField(dst.Field(i))
- } else {
- exported = exported || len(field.PkgPath) == 0
- }
- }
- return
-}
-
-type Config struct {
- Overwrite bool
- AppendSlice bool
- Transformers Transformers
-}
-
-type Transformers interface {
- Transformer(reflect.Type) func(dst, src reflect.Value) error
-}
-
-// Traverses recursively both values, assigning src's fields values to dst.
-// The map argument tracks comparisons that have already been seen, which allows
-// short circuiting on recursive types.
-func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) {
- overwrite := config.Overwrite
-
- if !src.IsValid() {
- return
- }
- if dst.CanAddr() {
- addr := dst.UnsafeAddr()
- h := 17 * addr
- seen := visited[h]
- typ := dst.Type()
- for p := seen; p != nil; p = p.next {
- if p.ptr == addr && p.typ == typ {
- return nil
- }
- }
- // Remember, remember...
- visited[h] = &visit{addr, typ, seen}
- }
-
- if config.Transformers != nil && !isEmptyValue(dst) {
- if fn := config.Transformers.Transformer(dst.Type()); fn != nil {
- err = fn(dst, src)
- return
- }
- }
-
- switch dst.Kind() {
- case reflect.Struct:
- if hasExportedField(dst) {
- for i, n := 0, dst.NumField(); i < n; i++ {
- if err = deepMerge(dst.Field(i), src.Field(i), visited, depth+1, config); err != nil {
- return
- }
- }
- } else {
- if dst.CanSet() && !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) {
- dst.Set(src)
- }
- }
- case reflect.Map:
- if dst.IsNil() && !src.IsNil() {
- dst.Set(reflect.MakeMap(dst.Type()))
- }
- for _, key := range src.MapKeys() {
- srcElement := src.MapIndex(key)
- if !srcElement.IsValid() {
- continue
- }
- dstElement := dst.MapIndex(key)
- switch srcElement.Kind() {
- case reflect.Chan, reflect.Func, reflect.Map, reflect.Interface, reflect.Slice:
- if srcElement.IsNil() {
- continue
- }
- fallthrough
- default:
- if !srcElement.CanInterface() {
- continue
- }
- switch reflect.TypeOf(srcElement.Interface()).Kind() {
- case reflect.Struct:
- fallthrough
- case reflect.Ptr:
- fallthrough
- case reflect.Map:
- srcMapElm := srcElement
- dstMapElm := dstElement
- if srcMapElm.CanInterface() {
- srcMapElm = reflect.ValueOf(srcMapElm.Interface())
- if dstMapElm.IsValid() {
- dstMapElm = reflect.ValueOf(dstMapElm.Interface())
- }
- }
- if err = deepMerge(dstMapElm, srcMapElm, visited, depth+1, config); err != nil {
- return
- }
- case reflect.Slice:
- srcSlice := reflect.ValueOf(srcElement.Interface())
-
- var dstSlice reflect.Value
- if !dstElement.IsValid() || dstElement.IsNil() {
- dstSlice = reflect.MakeSlice(srcSlice.Type(), 0, srcSlice.Len())
- } else {
- dstSlice = reflect.ValueOf(dstElement.Interface())
- }
-
- if !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice {
- dstSlice = srcSlice
- } else if config.AppendSlice {
- if srcSlice.Type() != dstSlice.Type() {
- return fmt.Errorf("cannot append two slice with different type (%s, %s)", srcSlice.Type(), dstSlice.Type())
- }
- dstSlice = reflect.AppendSlice(dstSlice, srcSlice)
- }
- dst.SetMapIndex(key, dstSlice)
- }
- }
- if dstElement.IsValid() && reflect.TypeOf(srcElement.Interface()).Kind() == reflect.Map {
- continue
- }
-
- if srcElement.IsValid() && (overwrite || (!dstElement.IsValid() || isEmptyValue(dstElement))) {
- if dst.IsNil() {
- dst.Set(reflect.MakeMap(dst.Type()))
- }
- dst.SetMapIndex(key, srcElement)
- }
- }
- case reflect.Slice:
- if !dst.CanSet() {
- break
- }
- if !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) && !config.AppendSlice {
- dst.Set(src)
- } else if config.AppendSlice {
- if src.Type() != dst.Type() {
- return fmt.Errorf("cannot append two slice with different type (%s, %s)", src.Type(), dst.Type())
- }
- dst.Set(reflect.AppendSlice(dst, src))
- }
- case reflect.Ptr:
- fallthrough
- case reflect.Interface:
- if src.IsNil() {
- break
- }
- if src.Kind() != reflect.Interface {
- if dst.IsNil() || overwrite {
- if dst.CanSet() && (overwrite || isEmptyValue(dst)) {
- dst.Set(src)
- }
- } else if src.Kind() == reflect.Ptr {
- if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil {
- return
- }
- } else if dst.Elem().Type() == src.Type() {
- if err = deepMerge(dst.Elem(), src, visited, depth+1, config); err != nil {
- return
- }
- } else {
- return ErrDifferentArgumentsTypes
- }
- break
- }
- if dst.IsNil() || overwrite {
- if dst.CanSet() && (overwrite || isEmptyValue(dst)) {
- dst.Set(src)
- }
- } else if err = deepMerge(dst.Elem(), src.Elem(), visited, depth+1, config); err != nil {
- return
- }
- default:
- if dst.CanSet() && !isEmptyValue(src) && (overwrite || isEmptyValue(dst)) {
- dst.Set(src)
- }
- }
- return
-}
-
-// Merge will fill any empty for value type attributes on the dst struct using corresponding
-// src attributes if they themselves are not empty. dst and src must be valid same-type structs
-// and dst must be a pointer to struct.
-// It won't merge unexported (private) fields and will do recursively any exported field.
-func Merge(dst, src interface{}, opts ...func(*Config)) error {
- return merge(dst, src, opts...)
-}
-
-// MergeWithOverwrite will do the same as Merge except that non-empty dst attributes will be overriden by
-// non-empty src attribute values.
-// Deprecated: use Merge(…) with WithOverride
-func MergeWithOverwrite(dst, src interface{}, opts ...func(*Config)) error {
- return merge(dst, src, append(opts, WithOverride)...)
-}
-
-// WithTransformers adds transformers to merge, allowing to customize the merging of some types.
-func WithTransformers(transformers Transformers) func(*Config) {
- return func(config *Config) {
- config.Transformers = transformers
- }
-}
-
-// WithOverride will make merge override non-empty dst attributes with non-empty src attributes values.
-func WithOverride(config *Config) {
- config.Overwrite = true
-}
-
-// WithAppendSlice will make merge append slices instead of overwriting it
-func WithAppendSlice(config *Config) {
- config.AppendSlice = true
-}
-
-func merge(dst, src interface{}, opts ...func(*Config)) error {
- var (
- vDst, vSrc reflect.Value
- err error
- )
-
- config := &Config{}
-
- for _, opt := range opts {
- opt(config)
- }
-
- if vDst, vSrc, err = resolveValues(dst, src); err != nil {
- return err
- }
- if vDst.Type() != vSrc.Type() {
- return ErrDifferentArgumentsTypes
- }
- return deepMerge(vDst, vSrc, make(map[uintptr]*visit), 0, config)
-}
diff --git a/vendor/github.com/imdario/mergo/mergo.go b/vendor/github.com/imdario/mergo/mergo.go
deleted file mode 100644
index a82fea2f..00000000
--- a/vendor/github.com/imdario/mergo/mergo.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2013 Dario Castañé. All rights reserved.
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Based on src/pkg/reflect/deepequal.go from official
-// golang's stdlib.
-
-package mergo
-
-import (
- "errors"
- "reflect"
-)
-
-// Errors reported by Mergo when it finds invalid arguments.
-var (
- ErrNilArguments = errors.New("src and dst must not be nil")
- ErrDifferentArgumentsTypes = errors.New("src and dst must be of same type")
- ErrNotSupported = errors.New("only structs and maps are supported")
- ErrExpectedMapAsDestination = errors.New("dst was expected to be a map")
- ErrExpectedStructAsDestination = errors.New("dst was expected to be a struct")
-)
-
-// During deepMerge, must keep track of checks that are
-// in progress. The comparison algorithm assumes that all
-// checks in progress are true when it reencounters them.
-// Visited are stored in a map indexed by 17 * a1 + a2;
-type visit struct {
- ptr uintptr
- typ reflect.Type
- next *visit
-}
-
-// From src/pkg/encoding/json/encode.go.
-func isEmptyValue(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Array, reflect.Map, reflect.Slice, reflect.String:
- return v.Len() == 0
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Ptr:
- if v.IsNil() {
- return true
- }
- return isEmptyValue(v.Elem())
- case reflect.Func:
- return v.IsNil()
- case reflect.Invalid:
- return true
- }
- return false
-}
-
-func resolveValues(dst, src interface{}) (vDst, vSrc reflect.Value, err error) {
- if dst == nil || src == nil {
- err = ErrNilArguments
- return
- }
- vDst = reflect.ValueOf(dst).Elem()
- if vDst.Kind() != reflect.Struct && vDst.Kind() != reflect.Map {
- err = ErrNotSupported
- return
- }
- vSrc = reflect.ValueOf(src)
- // We check if vSrc is a pointer to dereference it.
- if vSrc.Kind() == reflect.Ptr {
- vSrc = vSrc.Elem()
- }
- return
-}
-
-// Traverses recursively both values, assigning src's fields values to dst.
-// The map argument tracks comparisons that have already been seen, which allows
-// short circuiting on recursive types.
-func deeper(dst, src reflect.Value, visited map[uintptr]*visit, depth int) (err error) {
- if dst.CanAddr() {
- addr := dst.UnsafeAddr()
- h := 17 * addr
- seen := visited[h]
- typ := dst.Type()
- for p := seen; p != nil; p = p.next {
- if p.ptr == addr && p.typ == typ {
- return nil
- }
- }
- // Remember, remember...
- visited[h] = &visit{addr, typ, seen}
- }
- return // TODO refactor
-}
diff --git a/vendor/github.com/imdario/mergo/testdata/license.yml b/vendor/github.com/imdario/mergo/testdata/license.yml
deleted file mode 100644
index 2f1ad008..00000000
--- a/vendor/github.com/imdario/mergo/testdata/license.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-import: ../../../../fossene/db/schema/thing.yml
-fields:
- site: string
- author: root
diff --git a/vendor/github.com/inconshreveable/mousetrap/LICENSE b/vendor/github.com/inconshreveable/mousetrap/LICENSE
deleted file mode 100644
index 5f0d1fb6..00000000
--- a/vendor/github.com/inconshreveable/mousetrap/LICENSE
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 2014 Alan Shreve
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/vendor/github.com/inconshreveable/mousetrap/README.md b/vendor/github.com/inconshreveable/mousetrap/README.md
deleted file mode 100644
index 7a950d17..00000000
--- a/vendor/github.com/inconshreveable/mousetrap/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# mousetrap
-
-mousetrap is a tiny library that answers a single question.
-
-On a Windows machine, was the process invoked by someone double clicking on
-the executable file while browsing in explorer?
-
-### Motivation
-
-Windows developers unfamiliar with command line tools will often "double-click"
-the executable for a tool. Because most CLI tools print the help and then exit
-when invoked without arguments, this is often very frustrating for those users.
-
-mousetrap provides a way to detect these invocations so that you can provide
-more helpful behavior and instructions on how to run the CLI tool. To see what
-this looks like, both from an organizational and a technical perspective, see
-https://inconshreveable.com/09-09-2014/sweat-the-small-stuff/
-
-### The interface
-
-The library exposes a single interface:
-
- func StartedByExplorer() (bool)
diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_others.go b/vendor/github.com/inconshreveable/mousetrap/trap_others.go
deleted file mode 100644
index 9d2d8a4b..00000000
--- a/vendor/github.com/inconshreveable/mousetrap/trap_others.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build !windows
-
-package mousetrap
-
-// StartedByExplorer returns true if the program was invoked by the user
-// double-clicking on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-//
-// On non-Windows platforms, it always returns false.
-func StartedByExplorer() bool {
- return false
-}
diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows.go
deleted file mode 100644
index 336142a5..00000000
--- a/vendor/github.com/inconshreveable/mousetrap/trap_windows.go
+++ /dev/null
@@ -1,98 +0,0 @@
-// +build windows
-// +build !go1.4
-
-package mousetrap
-
-import (
- "fmt"
- "os"
- "syscall"
- "unsafe"
-)
-
-const (
- // defined by the Win32 API
- th32cs_snapprocess uintptr = 0x2
-)
-
-var (
- kernel = syscall.MustLoadDLL("kernel32.dll")
- CreateToolhelp32Snapshot = kernel.MustFindProc("CreateToolhelp32Snapshot")
- Process32First = kernel.MustFindProc("Process32FirstW")
- Process32Next = kernel.MustFindProc("Process32NextW")
-)
-
-// ProcessEntry32 structure defined by the Win32 API
-type processEntry32 struct {
- dwSize uint32
- cntUsage uint32
- th32ProcessID uint32
- th32DefaultHeapID int
- th32ModuleID uint32
- cntThreads uint32
- th32ParentProcessID uint32
- pcPriClassBase int32
- dwFlags uint32
- szExeFile [syscall.MAX_PATH]uint16
-}
-
-func getProcessEntry(pid int) (pe *processEntry32, err error) {
- snapshot, _, e1 := CreateToolhelp32Snapshot.Call(th32cs_snapprocess, uintptr(0))
- if snapshot == uintptr(syscall.InvalidHandle) {
- err = fmt.Errorf("CreateToolhelp32Snapshot: %v", e1)
- return
- }
- defer syscall.CloseHandle(syscall.Handle(snapshot))
-
- var processEntry processEntry32
- processEntry.dwSize = uint32(unsafe.Sizeof(processEntry))
- ok, _, e1 := Process32First.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
- if ok == 0 {
- err = fmt.Errorf("Process32First: %v", e1)
- return
- }
-
- for {
- if processEntry.th32ProcessID == uint32(pid) {
- pe = &processEntry
- return
- }
-
- ok, _, e1 = Process32Next.Call(snapshot, uintptr(unsafe.Pointer(&processEntry)))
- if ok == 0 {
- err = fmt.Errorf("Process32Next: %v", e1)
- return
- }
- }
-}
-
-func getppid() (pid int, err error) {
- pe, err := getProcessEntry(os.Getpid())
- if err != nil {
- return
- }
-
- pid = int(pe.th32ParentProcessID)
- return
-}
-
-// StartedByExplorer returns true if the program was invoked by the user double-clicking
-// on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-func StartedByExplorer() bool {
- ppid, err := getppid()
- if err != nil {
- return false
- }
-
- pe, err := getProcessEntry(ppid)
- if err != nil {
- return false
- }
-
- name := syscall.UTF16ToString(pe.szExeFile[:])
- return name == "explorer.exe"
-}
diff --git a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go b/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
deleted file mode 100644
index 9a28e57c..00000000
--- a/vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// +build windows
-// +build go1.4
-
-package mousetrap
-
-import (
- "os"
- "syscall"
- "unsafe"
-)
-
-func getProcessEntry(pid int) (*syscall.ProcessEntry32, error) {
- snapshot, err := syscall.CreateToolhelp32Snapshot(syscall.TH32CS_SNAPPROCESS, 0)
- if err != nil {
- return nil, err
- }
- defer syscall.CloseHandle(snapshot)
- var procEntry syscall.ProcessEntry32
- procEntry.Size = uint32(unsafe.Sizeof(procEntry))
- if err = syscall.Process32First(snapshot, &procEntry); err != nil {
- return nil, err
- }
- for {
- if procEntry.ProcessID == uint32(pid) {
- return &procEntry, nil
- }
- err = syscall.Process32Next(snapshot, &procEntry)
- if err != nil {
- return nil, err
- }
- }
-}
-
-// StartedByExplorer returns true if the program was invoked by the user double-clicking
-// on the executable from explorer.exe
-//
-// It is conservative and returns false if any of the internal calls fail.
-// It does not guarantee that the program was run from a terminal. It only can tell you
-// whether it was launched from explorer.exe
-func StartedByExplorer() bool {
- pe, err := getProcessEntry(os.Getppid())
- if err != nil {
- return false
- }
- return "explorer.exe" == syscall.UTF16ToString(pe.ExeFile[:])
-}
diff --git a/vendor/github.com/json-iterator/go/.codecov.yml b/vendor/github.com/json-iterator/go/.codecov.yml
deleted file mode 100644
index 955dc0be..00000000
--- a/vendor/github.com/json-iterator/go/.codecov.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-ignore:
- - "output_tests/.*"
-
diff --git a/vendor/github.com/json-iterator/go/.gitignore b/vendor/github.com/json-iterator/go/.gitignore
deleted file mode 100644
index 15556530..00000000
--- a/vendor/github.com/json-iterator/go/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/vendor
-/bug_test.go
-/coverage.txt
-/.idea
diff --git a/vendor/github.com/json-iterator/go/.travis.yml b/vendor/github.com/json-iterator/go/.travis.yml
deleted file mode 100644
index 449e67cd..00000000
--- a/vendor/github.com/json-iterator/go/.travis.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-language: go
-
-go:
- - 1.8.x
- - 1.x
-
-before_install:
- - go get -t -v ./...
-
-script:
- - ./test.sh
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/json-iterator/go/Gopkg.lock b/vendor/github.com/json-iterator/go/Gopkg.lock
deleted file mode 100644
index c8a9fbb3..00000000
--- a/vendor/github.com/json-iterator/go/Gopkg.lock
+++ /dev/null
@@ -1,21 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- name = "github.com/modern-go/concurrent"
- packages = ["."]
- revision = "e0a39a4cb4216ea8db28e22a69f4ec25610d513a"
- version = "1.0.0"
-
-[[projects]]
- name = "github.com/modern-go/reflect2"
- packages = ["."]
- revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd"
- version = "1.0.1"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- inputs-digest = "ea54a775e5a354cb015502d2e7aa4b74230fc77e894f34a838b268c25ec8eeb8"
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/vendor/github.com/json-iterator/go/Gopkg.toml b/vendor/github.com/json-iterator/go/Gopkg.toml
deleted file mode 100644
index 313a0f88..00000000
--- a/vendor/github.com/json-iterator/go/Gopkg.toml
+++ /dev/null
@@ -1,26 +0,0 @@
-# Gopkg.toml example
-#
-# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-# name = "github.com/user/project"
-# version = "1.0.0"
-#
-# [[constraint]]
-# name = "github.com/user/project2"
-# branch = "dev"
-# source = "github.com/myfork/project2"
-#
-# [[override]]
-# name = "github.com/x/y"
-# version = "2.4.0"
-
-ignored = ["github.com/davecgh/go-spew*","github.com/google/gofuzz*","github.com/stretchr/testify*"]
-
-[[constraint]]
- name = "github.com/modern-go/reflect2"
- version = "1.0.1"
diff --git a/vendor/github.com/json-iterator/go/LICENSE b/vendor/github.com/json-iterator/go/LICENSE
deleted file mode 100644
index 2cf4f5ab..00000000
--- a/vendor/github.com/json-iterator/go/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2016 json-iterator
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/json-iterator/go/README.md b/vendor/github.com/json-iterator/go/README.md
deleted file mode 100644
index 54d5afe9..00000000
--- a/vendor/github.com/json-iterator/go/README.md
+++ /dev/null
@@ -1,91 +0,0 @@
-[](https://sourcegraph.com/github.com/json-iterator/go?badge)
-[](http://godoc.org/github.com/json-iterator/go)
-[](https://travis-ci.org/json-iterator/go)
-[](https://codecov.io/gh/json-iterator/go)
-[](https://goreportcard.com/report/github.com/json-iterator/go)
-[](https://raw.githubusercontent.com/json-iterator/go/master/LICENSE)
-[](https://gitter.im/json-iterator/Lobby)
-
-A high-performance 100% compatible drop-in replacement of "encoding/json"
-
-You can also use thrift like JSON using [thrift-iterator](https://github.com/thrift-iterator/go)
-
-```
-Go开发者们请加入我们,滴滴出行平台技术部 taowen@didichuxing.com
-```
-
-# Benchmark
-
-
-
-Source code: https://github.com/json-iterator/go-benchmark/blob/master/src/github.com/json-iterator/go-benchmark/benchmark_medium_payload_test.go
-
-Raw Result (easyjson requires static code generation)
-
-| | ns/op | allocation bytes | allocation times |
-| --- | --- | --- | --- |
-| std decode | 35510 ns/op | 1960 B/op | 99 allocs/op |
-| easyjson decode | 8499 ns/op | 160 B/op | 4 allocs/op |
-| jsoniter decode | 5623 ns/op | 160 B/op | 3 allocs/op |
-| std encode | 2213 ns/op | 712 B/op | 5 allocs/op |
-| easyjson encode | 883 ns/op | 576 B/op | 3 allocs/op |
-| jsoniter encode | 837 ns/op | 384 B/op | 4 allocs/op |
-
-Always benchmark with your own workload.
-The result depends heavily on the data input.
-
-# Usage
-
-100% compatibility with standard lib
-
-Replace
-
-```go
-import "encoding/json"
-json.Marshal(&data)
-```
-
-with
-
-```go
-import "github.com/json-iterator/go"
-
-var json = jsoniter.ConfigCompatibleWithStandardLibrary
-json.Marshal(&data)
-```
-
-Replace
-
-```go
-import "encoding/json"
-json.Unmarshal(input, &data)
-```
-
-with
-
-```go
-import "github.com/json-iterator/go"
-
-var json = jsoniter.ConfigCompatibleWithStandardLibrary
-json.Unmarshal(input, &data)
-```
-
-[More documentation](http://jsoniter.com/migrate-from-go-std.html)
-
-# How to get
-
-```
-go get github.com/json-iterator/go
-```
-
-# Contribution Welcomed !
-
-Contributors
-
-* [thockin](https://github.com/thockin)
-* [mattn](https://github.com/mattn)
-* [cch123](https://github.com/cch123)
-* [Oleg Shaldybin](https://github.com/olegshaldybin)
-* [Jason Toffaletti](https://github.com/toffaletti)
-
-Report issue or pull request, or email taowen@gmail.com, or [](https://gitter.im/json-iterator/Lobby)
diff --git a/vendor/github.com/json-iterator/go/adapter.go b/vendor/github.com/json-iterator/go/adapter.go
deleted file mode 100644
index e674d0f3..00000000
--- a/vendor/github.com/json-iterator/go/adapter.go
+++ /dev/null
@@ -1,150 +0,0 @@
-package jsoniter
-
-import (
- "bytes"
- "io"
-)
-
-// RawMessage to make replace json with jsoniter
-type RawMessage []byte
-
-// Unmarshal adapts to json/encoding Unmarshal API
-//
-// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v.
-// Refer to https://godoc.org/encoding/json#Unmarshal for more information
-func Unmarshal(data []byte, v interface{}) error {
- return ConfigDefault.Unmarshal(data, v)
-}
-
-// UnmarshalFromString convenient method to read from string instead of []byte
-func UnmarshalFromString(str string, v interface{}) error {
- return ConfigDefault.UnmarshalFromString(str, v)
-}
-
-// Get quick method to get value from deeply nested JSON structure
-func Get(data []byte, path ...interface{}) Any {
- return ConfigDefault.Get(data, path...)
-}
-
-// Marshal adapts to json/encoding Marshal API
-//
-// Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API
-// Refer to https://godoc.org/encoding/json#Marshal for more information
-func Marshal(v interface{}) ([]byte, error) {
- return ConfigDefault.Marshal(v)
-}
-
-// MarshalIndent same as json.MarshalIndent. Prefix is not supported.
-func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
- return ConfigDefault.MarshalIndent(v, prefix, indent)
-}
-
-// MarshalToString convenient method to write as string instead of []byte
-func MarshalToString(v interface{}) (string, error) {
- return ConfigDefault.MarshalToString(v)
-}
-
-// NewDecoder adapts to json/stream NewDecoder API.
-//
-// NewDecoder returns a new decoder that reads from r.
-//
-// Instead of a json/encoding Decoder, an Decoder is returned
-// Refer to https://godoc.org/encoding/json#NewDecoder for more information
-func NewDecoder(reader io.Reader) *Decoder {
- return ConfigDefault.NewDecoder(reader)
-}
-
-// Decoder reads and decodes JSON values from an input stream.
-// Decoder provides identical APIs with json/stream Decoder (Token() and UseNumber() are in progress)
-type Decoder struct {
- iter *Iterator
-}
-
-// Decode decode JSON into interface{}
-func (adapter *Decoder) Decode(obj interface{}) error {
- if adapter.iter.head == adapter.iter.tail && adapter.iter.reader != nil {
- if !adapter.iter.loadMore() {
- return io.EOF
- }
- }
- adapter.iter.ReadVal(obj)
- err := adapter.iter.Error
- if err == io.EOF {
- return nil
- }
- return adapter.iter.Error
-}
-
-// More is there more?
-func (adapter *Decoder) More() bool {
- iter := adapter.iter
- if iter.Error != nil {
- return false
- }
- c := iter.nextToken()
- if c == 0 {
- return false
- }
- iter.unreadByte()
- return c != ']' && c != '}'
-}
-
-// Buffered remaining buffer
-func (adapter *Decoder) Buffered() io.Reader {
- remaining := adapter.iter.buf[adapter.iter.head:adapter.iter.tail]
- return bytes.NewReader(remaining)
-}
-
-// UseNumber causes the Decoder to unmarshal a number into an interface{} as a
-// Number instead of as a float64.
-func (adapter *Decoder) UseNumber() {
- cfg := adapter.iter.cfg.configBeforeFrozen
- cfg.UseNumber = true
- adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions)
-}
-
-// DisallowUnknownFields causes the Decoder to return an error when the destination
-// is a struct and the input contains object keys which do not match any
-// non-ignored, exported fields in the destination.
-func (adapter *Decoder) DisallowUnknownFields() {
- cfg := adapter.iter.cfg.configBeforeFrozen
- cfg.DisallowUnknownFields = true
- adapter.iter.cfg = cfg.frozeWithCacheReuse(adapter.iter.cfg.extraExtensions)
-}
-
-// NewEncoder same as json.NewEncoder
-func NewEncoder(writer io.Writer) *Encoder {
- return ConfigDefault.NewEncoder(writer)
-}
-
-// Encoder same as json.Encoder
-type Encoder struct {
- stream *Stream
-}
-
-// Encode encode interface{} as JSON to io.Writer
-func (adapter *Encoder) Encode(val interface{}) error {
- adapter.stream.WriteVal(val)
- adapter.stream.WriteRaw("\n")
- adapter.stream.Flush()
- return adapter.stream.Error
-}
-
-// SetIndent set the indention. Prefix is not supported
-func (adapter *Encoder) SetIndent(prefix, indent string) {
- config := adapter.stream.cfg.configBeforeFrozen
- config.IndentionStep = len(indent)
- adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions)
-}
-
-// SetEscapeHTML escape html by default, set to false to disable
-func (adapter *Encoder) SetEscapeHTML(escapeHTML bool) {
- config := adapter.stream.cfg.configBeforeFrozen
- config.EscapeHTML = escapeHTML
- adapter.stream.cfg = config.frozeWithCacheReuse(adapter.stream.cfg.extraExtensions)
-}
-
-// Valid reports whether data is a valid JSON encoding.
-func Valid(data []byte) bool {
- return ConfigDefault.Valid(data)
-}
diff --git a/vendor/github.com/json-iterator/go/any.go b/vendor/github.com/json-iterator/go/any.go
deleted file mode 100644
index daecfed6..00000000
--- a/vendor/github.com/json-iterator/go/any.go
+++ /dev/null
@@ -1,321 +0,0 @@
-package jsoniter
-
-import (
- "errors"
- "fmt"
- "github.com/modern-go/reflect2"
- "io"
- "reflect"
- "strconv"
- "unsafe"
-)
-
-// Any generic object representation.
-// The lazy json implementation holds []byte and parse lazily.
-type Any interface {
- LastError() error
- ValueType() ValueType
- MustBeValid() Any
- ToBool() bool
- ToInt() int
- ToInt32() int32
- ToInt64() int64
- ToUint() uint
- ToUint32() uint32
- ToUint64() uint64
- ToFloat32() float32
- ToFloat64() float64
- ToString() string
- ToVal(val interface{})
- Get(path ...interface{}) Any
- Size() int
- Keys() []string
- GetInterface() interface{}
- WriteTo(stream *Stream)
-}
-
-type baseAny struct{}
-
-func (any *baseAny) Get(path ...interface{}) Any {
- return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)}
-}
-
-func (any *baseAny) Size() int {
- return 0
-}
-
-func (any *baseAny) Keys() []string {
- return []string{}
-}
-
-func (any *baseAny) ToVal(obj interface{}) {
- panic("not implemented")
-}
-
-// WrapInt32 turn int32 into Any interface
-func WrapInt32(val int32) Any {
- return &int32Any{baseAny{}, val}
-}
-
-// WrapInt64 turn int64 into Any interface
-func WrapInt64(val int64) Any {
- return &int64Any{baseAny{}, val}
-}
-
-// WrapUint32 turn uint32 into Any interface
-func WrapUint32(val uint32) Any {
- return &uint32Any{baseAny{}, val}
-}
-
-// WrapUint64 turn uint64 into Any interface
-func WrapUint64(val uint64) Any {
- return &uint64Any{baseAny{}, val}
-}
-
-// WrapFloat64 turn float64 into Any interface
-func WrapFloat64(val float64) Any {
- return &floatAny{baseAny{}, val}
-}
-
-// WrapString turn string into Any interface
-func WrapString(val string) Any {
- return &stringAny{baseAny{}, val}
-}
-
-// Wrap turn a go object into Any interface
-func Wrap(val interface{}) Any {
- if val == nil {
- return &nilAny{}
- }
- asAny, isAny := val.(Any)
- if isAny {
- return asAny
- }
- typ := reflect2.TypeOf(val)
- switch typ.Kind() {
- case reflect.Slice:
- return wrapArray(val)
- case reflect.Struct:
- return wrapStruct(val)
- case reflect.Map:
- return wrapMap(val)
- case reflect.String:
- return WrapString(val.(string))
- case reflect.Int:
- if strconv.IntSize == 32 {
- return WrapInt32(int32(val.(int)))
- }
- return WrapInt64(int64(val.(int)))
- case reflect.Int8:
- return WrapInt32(int32(val.(int8)))
- case reflect.Int16:
- return WrapInt32(int32(val.(int16)))
- case reflect.Int32:
- return WrapInt32(val.(int32))
- case reflect.Int64:
- return WrapInt64(val.(int64))
- case reflect.Uint:
- if strconv.IntSize == 32 {
- return WrapUint32(uint32(val.(uint)))
- }
- return WrapUint64(uint64(val.(uint)))
- case reflect.Uintptr:
- if ptrSize == 32 {
- return WrapUint32(uint32(val.(uintptr)))
- }
- return WrapUint64(uint64(val.(uintptr)))
- case reflect.Uint8:
- return WrapUint32(uint32(val.(uint8)))
- case reflect.Uint16:
- return WrapUint32(uint32(val.(uint16)))
- case reflect.Uint32:
- return WrapUint32(uint32(val.(uint32)))
- case reflect.Uint64:
- return WrapUint64(val.(uint64))
- case reflect.Float32:
- return WrapFloat64(float64(val.(float32)))
- case reflect.Float64:
- return WrapFloat64(val.(float64))
- case reflect.Bool:
- if val.(bool) == true {
- return &trueAny{}
- }
- return &falseAny{}
- }
- return &invalidAny{baseAny{}, fmt.Errorf("unsupported type: %v", typ)}
-}
-
-// ReadAny read next JSON element as an Any object. It is a better json.RawMessage.
-func (iter *Iterator) ReadAny() Any {
- return iter.readAny()
-}
-
-func (iter *Iterator) readAny() Any {
- c := iter.nextToken()
- switch c {
- case '"':
- iter.unreadByte()
- return &stringAny{baseAny{}, iter.ReadString()}
- case 'n':
- iter.skipThreeBytes('u', 'l', 'l') // null
- return &nilAny{}
- case 't':
- iter.skipThreeBytes('r', 'u', 'e') // true
- return &trueAny{}
- case 'f':
- iter.skipFourBytes('a', 'l', 's', 'e') // false
- return &falseAny{}
- case '{':
- return iter.readObjectAny()
- case '[':
- return iter.readArrayAny()
- case '-':
- return iter.readNumberAny(false)
- case 0:
- return &invalidAny{baseAny{}, errors.New("input is empty")}
- default:
- return iter.readNumberAny(true)
- }
-}
-
-func (iter *Iterator) readNumberAny(positive bool) Any {
- iter.startCapture(iter.head - 1)
- iter.skipNumber()
- lazyBuf := iter.stopCapture()
- return &numberLazyAny{baseAny{}, iter.cfg, lazyBuf, nil}
-}
-
-func (iter *Iterator) readObjectAny() Any {
- iter.startCapture(iter.head - 1)
- iter.skipObject()
- lazyBuf := iter.stopCapture()
- return &objectLazyAny{baseAny{}, iter.cfg, lazyBuf, nil}
-}
-
-func (iter *Iterator) readArrayAny() Any {
- iter.startCapture(iter.head - 1)
- iter.skipArray()
- lazyBuf := iter.stopCapture()
- return &arrayLazyAny{baseAny{}, iter.cfg, lazyBuf, nil}
-}
-
-func locateObjectField(iter *Iterator, target string) []byte {
- var found []byte
- iter.ReadObjectCB(func(iter *Iterator, field string) bool {
- if field == target {
- found = iter.SkipAndReturnBytes()
- return false
- }
- iter.Skip()
- return true
- })
- return found
-}
-
-func locateArrayElement(iter *Iterator, target int) []byte {
- var found []byte
- n := 0
- iter.ReadArrayCB(func(iter *Iterator) bool {
- if n == target {
- found = iter.SkipAndReturnBytes()
- return false
- }
- iter.Skip()
- n++
- return true
- })
- return found
-}
-
-func locatePath(iter *Iterator, path []interface{}) Any {
- for i, pathKeyObj := range path {
- switch pathKey := pathKeyObj.(type) {
- case string:
- valueBytes := locateObjectField(iter, pathKey)
- if valueBytes == nil {
- return newInvalidAny(path[i:])
- }
- iter.ResetBytes(valueBytes)
- case int:
- valueBytes := locateArrayElement(iter, pathKey)
- if valueBytes == nil {
- return newInvalidAny(path[i:])
- }
- iter.ResetBytes(valueBytes)
- case int32:
- if '*' == pathKey {
- return iter.readAny().Get(path[i:]...)
- }
- return newInvalidAny(path[i:])
- default:
- return newInvalidAny(path[i:])
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- return &invalidAny{baseAny{}, iter.Error}
- }
- return iter.readAny()
-}
-
-var anyType = reflect2.TypeOfPtr((*Any)(nil)).Elem()
-
-func createDecoderOfAny(ctx *ctx, typ reflect2.Type) ValDecoder {
- if typ == anyType {
- return &directAnyCodec{}
- }
- if typ.Implements(anyType) {
- return &anyCodec{
- valType: typ,
- }
- }
- return nil
-}
-
-func createEncoderOfAny(ctx *ctx, typ reflect2.Type) ValEncoder {
- if typ == anyType {
- return &directAnyCodec{}
- }
- if typ.Implements(anyType) {
- return &anyCodec{
- valType: typ,
- }
- }
- return nil
-}
-
-type anyCodec struct {
- valType reflect2.Type
-}
-
-func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- panic("not implemented")
-}
-
-func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
- obj := codec.valType.UnsafeIndirect(ptr)
- any := obj.(Any)
- any.WriteTo(stream)
-}
-
-func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool {
- obj := codec.valType.UnsafeIndirect(ptr)
- any := obj.(Any)
- return any.Size() == 0
-}
-
-type directAnyCodec struct {
-}
-
-func (codec *directAnyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- *(*Any)(ptr) = iter.readAny()
-}
-
-func (codec *directAnyCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
- any := *(*Any)(ptr)
- any.WriteTo(stream)
-}
-
-func (codec *directAnyCodec) IsEmpty(ptr unsafe.Pointer) bool {
- any := *(*Any)(ptr)
- return any.Size() == 0
-}
diff --git a/vendor/github.com/json-iterator/go/any_array.go b/vendor/github.com/json-iterator/go/any_array.go
deleted file mode 100644
index 0449e9aa..00000000
--- a/vendor/github.com/json-iterator/go/any_array.go
+++ /dev/null
@@ -1,278 +0,0 @@
-package jsoniter
-
-import (
- "reflect"
- "unsafe"
-)
-
-type arrayLazyAny struct {
- baseAny
- cfg *frozenConfig
- buf []byte
- err error
-}
-
-func (any *arrayLazyAny) ValueType() ValueType {
- return ArrayValue
-}
-
-func (any *arrayLazyAny) MustBeValid() Any {
- return any
-}
-
-func (any *arrayLazyAny) LastError() error {
- return any.err
-}
-
-func (any *arrayLazyAny) ToBool() bool {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- return iter.ReadArray()
-}
-
-func (any *arrayLazyAny) ToInt() int {
- if any.ToBool() {
- return 1
- }
- return 0
-}
-
-func (any *arrayLazyAny) ToInt32() int32 {
- if any.ToBool() {
- return 1
- }
- return 0
-}
-
-func (any *arrayLazyAny) ToInt64() int64 {
- if any.ToBool() {
- return 1
- }
- return 0
-}
-
-func (any *arrayLazyAny) ToUint() uint {
- if any.ToBool() {
- return 1
- }
- return 0
-}
-
-func (any *arrayLazyAny) ToUint32() uint32 {
- if any.ToBool() {
- return 1
- }
- return 0
-}
-
-func (any *arrayLazyAny) ToUint64() uint64 {
- if any.ToBool() {
- return 1
- }
- return 0
-}
-
-func (any *arrayLazyAny) ToFloat32() float32 {
- if any.ToBool() {
- return 1
- }
- return 0
-}
-
-func (any *arrayLazyAny) ToFloat64() float64 {
- if any.ToBool() {
- return 1
- }
- return 0
-}
-
-func (any *arrayLazyAny) ToString() string {
- return *(*string)(unsafe.Pointer(&any.buf))
-}
-
-func (any *arrayLazyAny) ToVal(val interface{}) {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- iter.ReadVal(val)
-}
-
-func (any *arrayLazyAny) Get(path ...interface{}) Any {
- if len(path) == 0 {
- return any
- }
- switch firstPath := path[0].(type) {
- case int:
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- valueBytes := locateArrayElement(iter, firstPath)
- if valueBytes == nil {
- return newInvalidAny(path)
- }
- iter.ResetBytes(valueBytes)
- return locatePath(iter, path[1:])
- case int32:
- if '*' == firstPath {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- arr := make([]Any, 0)
- iter.ReadArrayCB(func(iter *Iterator) bool {
- found := iter.readAny().Get(path[1:]...)
- if found.ValueType() != InvalidValue {
- arr = append(arr, found)
- }
- return true
- })
- return wrapArray(arr)
- }
- return newInvalidAny(path)
- default:
- return newInvalidAny(path)
- }
-}
-
-func (any *arrayLazyAny) Size() int {
- size := 0
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- iter.ReadArrayCB(func(iter *Iterator) bool {
- size++
- iter.Skip()
- return true
- })
- return size
-}
-
-func (any *arrayLazyAny) WriteTo(stream *Stream) {
- stream.Write(any.buf)
-}
-
-func (any *arrayLazyAny) GetInterface() interface{} {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- return iter.Read()
-}
-
-type arrayAny struct {
- baseAny
- val reflect.Value
-}
-
-func wrapArray(val interface{}) *arrayAny {
- return &arrayAny{baseAny{}, reflect.ValueOf(val)}
-}
-
-func (any *arrayAny) ValueType() ValueType {
- return ArrayValue
-}
-
-func (any *arrayAny) MustBeValid() Any {
- return any
-}
-
-func (any *arrayAny) LastError() error {
- return nil
-}
-
-func (any *arrayAny) ToBool() bool {
- return any.val.Len() != 0
-}
-
-func (any *arrayAny) ToInt() int {
- if any.val.Len() == 0 {
- return 0
- }
- return 1
-}
-
-func (any *arrayAny) ToInt32() int32 {
- if any.val.Len() == 0 {
- return 0
- }
- return 1
-}
-
-func (any *arrayAny) ToInt64() int64 {
- if any.val.Len() == 0 {
- return 0
- }
- return 1
-}
-
-func (any *arrayAny) ToUint() uint {
- if any.val.Len() == 0 {
- return 0
- }
- return 1
-}
-
-func (any *arrayAny) ToUint32() uint32 {
- if any.val.Len() == 0 {
- return 0
- }
- return 1
-}
-
-func (any *arrayAny) ToUint64() uint64 {
- if any.val.Len() == 0 {
- return 0
- }
- return 1
-}
-
-func (any *arrayAny) ToFloat32() float32 {
- if any.val.Len() == 0 {
- return 0
- }
- return 1
-}
-
-func (any *arrayAny) ToFloat64() float64 {
- if any.val.Len() == 0 {
- return 0
- }
- return 1
-}
-
-func (any *arrayAny) ToString() string {
- str, _ := MarshalToString(any.val.Interface())
- return str
-}
-
-func (any *arrayAny) Get(path ...interface{}) Any {
- if len(path) == 0 {
- return any
- }
- switch firstPath := path[0].(type) {
- case int:
- if firstPath < 0 || firstPath >= any.val.Len() {
- return newInvalidAny(path)
- }
- return Wrap(any.val.Index(firstPath).Interface())
- case int32:
- if '*' == firstPath {
- mappedAll := make([]Any, 0)
- for i := 0; i < any.val.Len(); i++ {
- mapped := Wrap(any.val.Index(i).Interface()).Get(path[1:]...)
- if mapped.ValueType() != InvalidValue {
- mappedAll = append(mappedAll, mapped)
- }
- }
- return wrapArray(mappedAll)
- }
- return newInvalidAny(path)
- default:
- return newInvalidAny(path)
- }
-}
-
-func (any *arrayAny) Size() int {
- return any.val.Len()
-}
-
-func (any *arrayAny) WriteTo(stream *Stream) {
- stream.WriteVal(any.val)
-}
-
-func (any *arrayAny) GetInterface() interface{} {
- return any.val.Interface()
-}
diff --git a/vendor/github.com/json-iterator/go/any_bool.go b/vendor/github.com/json-iterator/go/any_bool.go
deleted file mode 100644
index 9452324a..00000000
--- a/vendor/github.com/json-iterator/go/any_bool.go
+++ /dev/null
@@ -1,137 +0,0 @@
-package jsoniter
-
-type trueAny struct {
- baseAny
-}
-
-func (any *trueAny) LastError() error {
- return nil
-}
-
-func (any *trueAny) ToBool() bool {
- return true
-}
-
-func (any *trueAny) ToInt() int {
- return 1
-}
-
-func (any *trueAny) ToInt32() int32 {
- return 1
-}
-
-func (any *trueAny) ToInt64() int64 {
- return 1
-}
-
-func (any *trueAny) ToUint() uint {
- return 1
-}
-
-func (any *trueAny) ToUint32() uint32 {
- return 1
-}
-
-func (any *trueAny) ToUint64() uint64 {
- return 1
-}
-
-func (any *trueAny) ToFloat32() float32 {
- return 1
-}
-
-func (any *trueAny) ToFloat64() float64 {
- return 1
-}
-
-func (any *trueAny) ToString() string {
- return "true"
-}
-
-func (any *trueAny) WriteTo(stream *Stream) {
- stream.WriteTrue()
-}
-
-func (any *trueAny) Parse() *Iterator {
- return nil
-}
-
-func (any *trueAny) GetInterface() interface{} {
- return true
-}
-
-func (any *trueAny) ValueType() ValueType {
- return BoolValue
-}
-
-func (any *trueAny) MustBeValid() Any {
- return any
-}
-
-type falseAny struct {
- baseAny
-}
-
-func (any *falseAny) LastError() error {
- return nil
-}
-
-func (any *falseAny) ToBool() bool {
- return false
-}
-
-func (any *falseAny) ToInt() int {
- return 0
-}
-
-func (any *falseAny) ToInt32() int32 {
- return 0
-}
-
-func (any *falseAny) ToInt64() int64 {
- return 0
-}
-
-func (any *falseAny) ToUint() uint {
- return 0
-}
-
-func (any *falseAny) ToUint32() uint32 {
- return 0
-}
-
-func (any *falseAny) ToUint64() uint64 {
- return 0
-}
-
-func (any *falseAny) ToFloat32() float32 {
- return 0
-}
-
-func (any *falseAny) ToFloat64() float64 {
- return 0
-}
-
-func (any *falseAny) ToString() string {
- return "false"
-}
-
-func (any *falseAny) WriteTo(stream *Stream) {
- stream.WriteFalse()
-}
-
-func (any *falseAny) Parse() *Iterator {
- return nil
-}
-
-func (any *falseAny) GetInterface() interface{} {
- return false
-}
-
-func (any *falseAny) ValueType() ValueType {
- return BoolValue
-}
-
-func (any *falseAny) MustBeValid() Any {
- return any
-}
diff --git a/vendor/github.com/json-iterator/go/any_float.go b/vendor/github.com/json-iterator/go/any_float.go
deleted file mode 100644
index 35fdb094..00000000
--- a/vendor/github.com/json-iterator/go/any_float.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package jsoniter
-
-import (
- "strconv"
-)
-
-type floatAny struct {
- baseAny
- val float64
-}
-
-func (any *floatAny) Parse() *Iterator {
- return nil
-}
-
-func (any *floatAny) ValueType() ValueType {
- return NumberValue
-}
-
-func (any *floatAny) MustBeValid() Any {
- return any
-}
-
-func (any *floatAny) LastError() error {
- return nil
-}
-
-func (any *floatAny) ToBool() bool {
- return any.ToFloat64() != 0
-}
-
-func (any *floatAny) ToInt() int {
- return int(any.val)
-}
-
-func (any *floatAny) ToInt32() int32 {
- return int32(any.val)
-}
-
-func (any *floatAny) ToInt64() int64 {
- return int64(any.val)
-}
-
-func (any *floatAny) ToUint() uint {
- if any.val > 0 {
- return uint(any.val)
- }
- return 0
-}
-
-func (any *floatAny) ToUint32() uint32 {
- if any.val > 0 {
- return uint32(any.val)
- }
- return 0
-}
-
-func (any *floatAny) ToUint64() uint64 {
- if any.val > 0 {
- return uint64(any.val)
- }
- return 0
-}
-
-func (any *floatAny) ToFloat32() float32 {
- return float32(any.val)
-}
-
-func (any *floatAny) ToFloat64() float64 {
- return any.val
-}
-
-func (any *floatAny) ToString() string {
- return strconv.FormatFloat(any.val, 'E', -1, 64)
-}
-
-func (any *floatAny) WriteTo(stream *Stream) {
- stream.WriteFloat64(any.val)
-}
-
-func (any *floatAny) GetInterface() interface{} {
- return any.val
-}
diff --git a/vendor/github.com/json-iterator/go/any_int32.go b/vendor/github.com/json-iterator/go/any_int32.go
deleted file mode 100644
index 1b56f399..00000000
--- a/vendor/github.com/json-iterator/go/any_int32.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package jsoniter
-
-import (
- "strconv"
-)
-
-type int32Any struct {
- baseAny
- val int32
-}
-
-func (any *int32Any) LastError() error {
- return nil
-}
-
-func (any *int32Any) ValueType() ValueType {
- return NumberValue
-}
-
-func (any *int32Any) MustBeValid() Any {
- return any
-}
-
-func (any *int32Any) ToBool() bool {
- return any.val != 0
-}
-
-func (any *int32Any) ToInt() int {
- return int(any.val)
-}
-
-func (any *int32Any) ToInt32() int32 {
- return any.val
-}
-
-func (any *int32Any) ToInt64() int64 {
- return int64(any.val)
-}
-
-func (any *int32Any) ToUint() uint {
- return uint(any.val)
-}
-
-func (any *int32Any) ToUint32() uint32 {
- return uint32(any.val)
-}
-
-func (any *int32Any) ToUint64() uint64 {
- return uint64(any.val)
-}
-
-func (any *int32Any) ToFloat32() float32 {
- return float32(any.val)
-}
-
-func (any *int32Any) ToFloat64() float64 {
- return float64(any.val)
-}
-
-func (any *int32Any) ToString() string {
- return strconv.FormatInt(int64(any.val), 10)
-}
-
-func (any *int32Any) WriteTo(stream *Stream) {
- stream.WriteInt32(any.val)
-}
-
-func (any *int32Any) Parse() *Iterator {
- return nil
-}
-
-func (any *int32Any) GetInterface() interface{} {
- return any.val
-}
diff --git a/vendor/github.com/json-iterator/go/any_int64.go b/vendor/github.com/json-iterator/go/any_int64.go
deleted file mode 100644
index c440d72b..00000000
--- a/vendor/github.com/json-iterator/go/any_int64.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package jsoniter
-
-import (
- "strconv"
-)
-
-type int64Any struct {
- baseAny
- val int64
-}
-
-func (any *int64Any) LastError() error {
- return nil
-}
-
-func (any *int64Any) ValueType() ValueType {
- return NumberValue
-}
-
-func (any *int64Any) MustBeValid() Any {
- return any
-}
-
-func (any *int64Any) ToBool() bool {
- return any.val != 0
-}
-
-func (any *int64Any) ToInt() int {
- return int(any.val)
-}
-
-func (any *int64Any) ToInt32() int32 {
- return int32(any.val)
-}
-
-func (any *int64Any) ToInt64() int64 {
- return any.val
-}
-
-func (any *int64Any) ToUint() uint {
- return uint(any.val)
-}
-
-func (any *int64Any) ToUint32() uint32 {
- return uint32(any.val)
-}
-
-func (any *int64Any) ToUint64() uint64 {
- return uint64(any.val)
-}
-
-func (any *int64Any) ToFloat32() float32 {
- return float32(any.val)
-}
-
-func (any *int64Any) ToFloat64() float64 {
- return float64(any.val)
-}
-
-func (any *int64Any) ToString() string {
- return strconv.FormatInt(any.val, 10)
-}
-
-func (any *int64Any) WriteTo(stream *Stream) {
- stream.WriteInt64(any.val)
-}
-
-func (any *int64Any) Parse() *Iterator {
- return nil
-}
-
-func (any *int64Any) GetInterface() interface{} {
- return any.val
-}
diff --git a/vendor/github.com/json-iterator/go/any_invalid.go b/vendor/github.com/json-iterator/go/any_invalid.go
deleted file mode 100644
index 1d859eac..00000000
--- a/vendor/github.com/json-iterator/go/any_invalid.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package jsoniter
-
-import "fmt"
-
-type invalidAny struct {
- baseAny
- err error
-}
-
-func newInvalidAny(path []interface{}) *invalidAny {
- return &invalidAny{baseAny{}, fmt.Errorf("%v not found", path)}
-}
-
-func (any *invalidAny) LastError() error {
- return any.err
-}
-
-func (any *invalidAny) ValueType() ValueType {
- return InvalidValue
-}
-
-func (any *invalidAny) MustBeValid() Any {
- panic(any.err)
-}
-
-func (any *invalidAny) ToBool() bool {
- return false
-}
-
-func (any *invalidAny) ToInt() int {
- return 0
-}
-
-func (any *invalidAny) ToInt32() int32 {
- return 0
-}
-
-func (any *invalidAny) ToInt64() int64 {
- return 0
-}
-
-func (any *invalidAny) ToUint() uint {
- return 0
-}
-
-func (any *invalidAny) ToUint32() uint32 {
- return 0
-}
-
-func (any *invalidAny) ToUint64() uint64 {
- return 0
-}
-
-func (any *invalidAny) ToFloat32() float32 {
- return 0
-}
-
-func (any *invalidAny) ToFloat64() float64 {
- return 0
-}
-
-func (any *invalidAny) ToString() string {
- return ""
-}
-
-func (any *invalidAny) WriteTo(stream *Stream) {
-}
-
-func (any *invalidAny) Get(path ...interface{}) Any {
- if any.err == nil {
- return &invalidAny{baseAny{}, fmt.Errorf("get %v from invalid", path)}
- }
- return &invalidAny{baseAny{}, fmt.Errorf("%v, get %v from invalid", any.err, path)}
-}
-
-func (any *invalidAny) Parse() *Iterator {
- return nil
-}
-
-func (any *invalidAny) GetInterface() interface{} {
- return nil
-}
diff --git a/vendor/github.com/json-iterator/go/any_nil.go b/vendor/github.com/json-iterator/go/any_nil.go
deleted file mode 100644
index d04cb54c..00000000
--- a/vendor/github.com/json-iterator/go/any_nil.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package jsoniter
-
-type nilAny struct {
- baseAny
-}
-
-func (any *nilAny) LastError() error {
- return nil
-}
-
-func (any *nilAny) ValueType() ValueType {
- return NilValue
-}
-
-func (any *nilAny) MustBeValid() Any {
- return any
-}
-
-func (any *nilAny) ToBool() bool {
- return false
-}
-
-func (any *nilAny) ToInt() int {
- return 0
-}
-
-func (any *nilAny) ToInt32() int32 {
- return 0
-}
-
-func (any *nilAny) ToInt64() int64 {
- return 0
-}
-
-func (any *nilAny) ToUint() uint {
- return 0
-}
-
-func (any *nilAny) ToUint32() uint32 {
- return 0
-}
-
-func (any *nilAny) ToUint64() uint64 {
- return 0
-}
-
-func (any *nilAny) ToFloat32() float32 {
- return 0
-}
-
-func (any *nilAny) ToFloat64() float64 {
- return 0
-}
-
-func (any *nilAny) ToString() string {
- return ""
-}
-
-func (any *nilAny) WriteTo(stream *Stream) {
- stream.WriteNil()
-}
-
-func (any *nilAny) Parse() *Iterator {
- return nil
-}
-
-func (any *nilAny) GetInterface() interface{} {
- return nil
-}
diff --git a/vendor/github.com/json-iterator/go/any_number.go b/vendor/github.com/json-iterator/go/any_number.go
deleted file mode 100644
index 9d1e901a..00000000
--- a/vendor/github.com/json-iterator/go/any_number.go
+++ /dev/null
@@ -1,123 +0,0 @@
-package jsoniter
-
-import (
- "io"
- "unsafe"
-)
-
-type numberLazyAny struct {
- baseAny
- cfg *frozenConfig
- buf []byte
- err error
-}
-
-func (any *numberLazyAny) ValueType() ValueType {
- return NumberValue
-}
-
-func (any *numberLazyAny) MustBeValid() Any {
- return any
-}
-
-func (any *numberLazyAny) LastError() error {
- return any.err
-}
-
-func (any *numberLazyAny) ToBool() bool {
- return any.ToFloat64() != 0
-}
-
-func (any *numberLazyAny) ToInt() int {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- val := iter.ReadInt()
- if iter.Error != nil && iter.Error != io.EOF {
- any.err = iter.Error
- }
- return val
-}
-
-func (any *numberLazyAny) ToInt32() int32 {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- val := iter.ReadInt32()
- if iter.Error != nil && iter.Error != io.EOF {
- any.err = iter.Error
- }
- return val
-}
-
-func (any *numberLazyAny) ToInt64() int64 {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- val := iter.ReadInt64()
- if iter.Error != nil && iter.Error != io.EOF {
- any.err = iter.Error
- }
- return val
-}
-
-func (any *numberLazyAny) ToUint() uint {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- val := iter.ReadUint()
- if iter.Error != nil && iter.Error != io.EOF {
- any.err = iter.Error
- }
- return val
-}
-
-func (any *numberLazyAny) ToUint32() uint32 {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- val := iter.ReadUint32()
- if iter.Error != nil && iter.Error != io.EOF {
- any.err = iter.Error
- }
- return val
-}
-
-func (any *numberLazyAny) ToUint64() uint64 {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- val := iter.ReadUint64()
- if iter.Error != nil && iter.Error != io.EOF {
- any.err = iter.Error
- }
- return val
-}
-
-func (any *numberLazyAny) ToFloat32() float32 {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- val := iter.ReadFloat32()
- if iter.Error != nil && iter.Error != io.EOF {
- any.err = iter.Error
- }
- return val
-}
-
-func (any *numberLazyAny) ToFloat64() float64 {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- val := iter.ReadFloat64()
- if iter.Error != nil && iter.Error != io.EOF {
- any.err = iter.Error
- }
- return val
-}
-
-func (any *numberLazyAny) ToString() string {
- return *(*string)(unsafe.Pointer(&any.buf))
-}
-
-func (any *numberLazyAny) WriteTo(stream *Stream) {
- stream.Write(any.buf)
-}
-
-func (any *numberLazyAny) GetInterface() interface{} {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- return iter.Read()
-}
diff --git a/vendor/github.com/json-iterator/go/any_object.go b/vendor/github.com/json-iterator/go/any_object.go
deleted file mode 100644
index c44ef5c9..00000000
--- a/vendor/github.com/json-iterator/go/any_object.go
+++ /dev/null
@@ -1,374 +0,0 @@
-package jsoniter
-
-import (
- "reflect"
- "unsafe"
-)
-
-type objectLazyAny struct {
- baseAny
- cfg *frozenConfig
- buf []byte
- err error
-}
-
-func (any *objectLazyAny) ValueType() ValueType {
- return ObjectValue
-}
-
-func (any *objectLazyAny) MustBeValid() Any {
- return any
-}
-
-func (any *objectLazyAny) LastError() error {
- return any.err
-}
-
-func (any *objectLazyAny) ToBool() bool {
- return true
-}
-
-func (any *objectLazyAny) ToInt() int {
- return 0
-}
-
-func (any *objectLazyAny) ToInt32() int32 {
- return 0
-}
-
-func (any *objectLazyAny) ToInt64() int64 {
- return 0
-}
-
-func (any *objectLazyAny) ToUint() uint {
- return 0
-}
-
-func (any *objectLazyAny) ToUint32() uint32 {
- return 0
-}
-
-func (any *objectLazyAny) ToUint64() uint64 {
- return 0
-}
-
-func (any *objectLazyAny) ToFloat32() float32 {
- return 0
-}
-
-func (any *objectLazyAny) ToFloat64() float64 {
- return 0
-}
-
-func (any *objectLazyAny) ToString() string {
- return *(*string)(unsafe.Pointer(&any.buf))
-}
-
-func (any *objectLazyAny) ToVal(obj interface{}) {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- iter.ReadVal(obj)
-}
-
-func (any *objectLazyAny) Get(path ...interface{}) Any {
- if len(path) == 0 {
- return any
- }
- switch firstPath := path[0].(type) {
- case string:
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- valueBytes := locateObjectField(iter, firstPath)
- if valueBytes == nil {
- return newInvalidAny(path)
- }
- iter.ResetBytes(valueBytes)
- return locatePath(iter, path[1:])
- case int32:
- if '*' == firstPath {
- mappedAll := map[string]Any{}
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- iter.ReadMapCB(func(iter *Iterator, field string) bool {
- mapped := locatePath(iter, path[1:])
- if mapped.ValueType() != InvalidValue {
- mappedAll[field] = mapped
- }
- return true
- })
- return wrapMap(mappedAll)
- }
- return newInvalidAny(path)
- default:
- return newInvalidAny(path)
- }
-}
-
-func (any *objectLazyAny) Keys() []string {
- keys := []string{}
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- iter.ReadMapCB(func(iter *Iterator, field string) bool {
- iter.Skip()
- keys = append(keys, field)
- return true
- })
- return keys
-}
-
-func (any *objectLazyAny) Size() int {
- size := 0
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- iter.ReadObjectCB(func(iter *Iterator, field string) bool {
- iter.Skip()
- size++
- return true
- })
- return size
-}
-
-func (any *objectLazyAny) WriteTo(stream *Stream) {
- stream.Write(any.buf)
-}
-
-func (any *objectLazyAny) GetInterface() interface{} {
- iter := any.cfg.BorrowIterator(any.buf)
- defer any.cfg.ReturnIterator(iter)
- return iter.Read()
-}
-
-type objectAny struct {
- baseAny
- err error
- val reflect.Value
-}
-
-func wrapStruct(val interface{}) *objectAny {
- return &objectAny{baseAny{}, nil, reflect.ValueOf(val)}
-}
-
-func (any *objectAny) ValueType() ValueType {
- return ObjectValue
-}
-
-func (any *objectAny) MustBeValid() Any {
- return any
-}
-
-func (any *objectAny) Parse() *Iterator {
- return nil
-}
-
-func (any *objectAny) LastError() error {
- return any.err
-}
-
-func (any *objectAny) ToBool() bool {
- return any.val.NumField() != 0
-}
-
-func (any *objectAny) ToInt() int {
- return 0
-}
-
-func (any *objectAny) ToInt32() int32 {
- return 0
-}
-
-func (any *objectAny) ToInt64() int64 {
- return 0
-}
-
-func (any *objectAny) ToUint() uint {
- return 0
-}
-
-func (any *objectAny) ToUint32() uint32 {
- return 0
-}
-
-func (any *objectAny) ToUint64() uint64 {
- return 0
-}
-
-func (any *objectAny) ToFloat32() float32 {
- return 0
-}
-
-func (any *objectAny) ToFloat64() float64 {
- return 0
-}
-
-func (any *objectAny) ToString() string {
- str, err := MarshalToString(any.val.Interface())
- any.err = err
- return str
-}
-
-func (any *objectAny) Get(path ...interface{}) Any {
- if len(path) == 0 {
- return any
- }
- switch firstPath := path[0].(type) {
- case string:
- field := any.val.FieldByName(firstPath)
- if !field.IsValid() {
- return newInvalidAny(path)
- }
- return Wrap(field.Interface())
- case int32:
- if '*' == firstPath {
- mappedAll := map[string]Any{}
- for i := 0; i < any.val.NumField(); i++ {
- field := any.val.Field(i)
- if field.CanInterface() {
- mapped := Wrap(field.Interface()).Get(path[1:]...)
- if mapped.ValueType() != InvalidValue {
- mappedAll[any.val.Type().Field(i).Name] = mapped
- }
- }
- }
- return wrapMap(mappedAll)
- }
- return newInvalidAny(path)
- default:
- return newInvalidAny(path)
- }
-}
-
-func (any *objectAny) Keys() []string {
- keys := make([]string, 0, any.val.NumField())
- for i := 0; i < any.val.NumField(); i++ {
- keys = append(keys, any.val.Type().Field(i).Name)
- }
- return keys
-}
-
-func (any *objectAny) Size() int {
- return any.val.NumField()
-}
-
-func (any *objectAny) WriteTo(stream *Stream) {
- stream.WriteVal(any.val)
-}
-
-func (any *objectAny) GetInterface() interface{} {
- return any.val.Interface()
-}
-
-type mapAny struct {
- baseAny
- err error
- val reflect.Value
-}
-
-func wrapMap(val interface{}) *mapAny {
- return &mapAny{baseAny{}, nil, reflect.ValueOf(val)}
-}
-
-func (any *mapAny) ValueType() ValueType {
- return ObjectValue
-}
-
-func (any *mapAny) MustBeValid() Any {
- return any
-}
-
-func (any *mapAny) Parse() *Iterator {
- return nil
-}
-
-func (any *mapAny) LastError() error {
- return any.err
-}
-
-func (any *mapAny) ToBool() bool {
- return true
-}
-
-func (any *mapAny) ToInt() int {
- return 0
-}
-
-func (any *mapAny) ToInt32() int32 {
- return 0
-}
-
-func (any *mapAny) ToInt64() int64 {
- return 0
-}
-
-func (any *mapAny) ToUint() uint {
- return 0
-}
-
-func (any *mapAny) ToUint32() uint32 {
- return 0
-}
-
-func (any *mapAny) ToUint64() uint64 {
- return 0
-}
-
-func (any *mapAny) ToFloat32() float32 {
- return 0
-}
-
-func (any *mapAny) ToFloat64() float64 {
- return 0
-}
-
-func (any *mapAny) ToString() string {
- str, err := MarshalToString(any.val.Interface())
- any.err = err
- return str
-}
-
-func (any *mapAny) Get(path ...interface{}) Any {
- if len(path) == 0 {
- return any
- }
- switch firstPath := path[0].(type) {
- case int32:
- if '*' == firstPath {
- mappedAll := map[string]Any{}
- for _, key := range any.val.MapKeys() {
- keyAsStr := key.String()
- element := Wrap(any.val.MapIndex(key).Interface())
- mapped := element.Get(path[1:]...)
- if mapped.ValueType() != InvalidValue {
- mappedAll[keyAsStr] = mapped
- }
- }
- return wrapMap(mappedAll)
- }
- return newInvalidAny(path)
- default:
- value := any.val.MapIndex(reflect.ValueOf(firstPath))
- if !value.IsValid() {
- return newInvalidAny(path)
- }
- return Wrap(value.Interface())
- }
-}
-
-func (any *mapAny) Keys() []string {
- keys := make([]string, 0, any.val.Len())
- for _, key := range any.val.MapKeys() {
- keys = append(keys, key.String())
- }
- return keys
-}
-
-func (any *mapAny) Size() int {
- return any.val.Len()
-}
-
-func (any *mapAny) WriteTo(stream *Stream) {
- stream.WriteVal(any.val)
-}
-
-func (any *mapAny) GetInterface() interface{} {
- return any.val.Interface()
-}
diff --git a/vendor/github.com/json-iterator/go/any_str.go b/vendor/github.com/json-iterator/go/any_str.go
deleted file mode 100644
index a4b93c78..00000000
--- a/vendor/github.com/json-iterator/go/any_str.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "strconv"
-)
-
-type stringAny struct {
- baseAny
- val string
-}
-
-func (any *stringAny) Get(path ...interface{}) Any {
- if len(path) == 0 {
- return any
- }
- return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)}
-}
-
-func (any *stringAny) Parse() *Iterator {
- return nil
-}
-
-func (any *stringAny) ValueType() ValueType {
- return StringValue
-}
-
-func (any *stringAny) MustBeValid() Any {
- return any
-}
-
-func (any *stringAny) LastError() error {
- return nil
-}
-
-func (any *stringAny) ToBool() bool {
- str := any.ToString()
- if str == "0" {
- return false
- }
- for _, c := range str {
- switch c {
- case ' ', '\n', '\r', '\t':
- default:
- return true
- }
- }
- return false
-}
-
-func (any *stringAny) ToInt() int {
- return int(any.ToInt64())
-
-}
-
-func (any *stringAny) ToInt32() int32 {
- return int32(any.ToInt64())
-}
-
-func (any *stringAny) ToInt64() int64 {
- if any.val == "" {
- return 0
- }
-
- flag := 1
- startPos := 0
- endPos := 0
- if any.val[0] == '+' || any.val[0] == '-' {
- startPos = 1
- }
-
- if any.val[0] == '-' {
- flag = -1
- }
-
- for i := startPos; i < len(any.val); i++ {
- if any.val[i] >= '0' && any.val[i] <= '9' {
- endPos = i + 1
- } else {
- break
- }
- }
- parsed, _ := strconv.ParseInt(any.val[startPos:endPos], 10, 64)
- return int64(flag) * parsed
-}
-
-func (any *stringAny) ToUint() uint {
- return uint(any.ToUint64())
-}
-
-func (any *stringAny) ToUint32() uint32 {
- return uint32(any.ToUint64())
-}
-
-func (any *stringAny) ToUint64() uint64 {
- if any.val == "" {
- return 0
- }
-
- startPos := 0
- endPos := 0
-
- if any.val[0] == '-' {
- return 0
- }
- if any.val[0] == '+' {
- startPos = 1
- }
-
- for i := startPos; i < len(any.val); i++ {
- if any.val[i] >= '0' && any.val[i] <= '9' {
- endPos = i + 1
- } else {
- break
- }
- }
- parsed, _ := strconv.ParseUint(any.val[startPos:endPos], 10, 64)
- return parsed
-}
-
-func (any *stringAny) ToFloat32() float32 {
- return float32(any.ToFloat64())
-}
-
-func (any *stringAny) ToFloat64() float64 {
- if len(any.val) == 0 {
- return 0
- }
-
- // first char invalid
- if any.val[0] != '+' && any.val[0] != '-' && (any.val[0] > '9' || any.val[0] < '0') {
- return 0
- }
-
- // extract valid num expression from string
- // eg 123true => 123, -12.12xxa => -12.12
- endPos := 1
- for i := 1; i < len(any.val); i++ {
- if any.val[i] == '.' || any.val[i] == 'e' || any.val[i] == 'E' || any.val[i] == '+' || any.val[i] == '-' {
- endPos = i + 1
- continue
- }
-
- // end position is the first char which is not digit
- if any.val[i] >= '0' && any.val[i] <= '9' {
- endPos = i + 1
- } else {
- endPos = i
- break
- }
- }
- parsed, _ := strconv.ParseFloat(any.val[:endPos], 64)
- return parsed
-}
-
-func (any *stringAny) ToString() string {
- return any.val
-}
-
-func (any *stringAny) WriteTo(stream *Stream) {
- stream.WriteString(any.val)
-}
-
-func (any *stringAny) GetInterface() interface{} {
- return any.val
-}
diff --git a/vendor/github.com/json-iterator/go/any_uint32.go b/vendor/github.com/json-iterator/go/any_uint32.go
deleted file mode 100644
index 656bbd33..00000000
--- a/vendor/github.com/json-iterator/go/any_uint32.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package jsoniter
-
-import (
- "strconv"
-)
-
-type uint32Any struct {
- baseAny
- val uint32
-}
-
-func (any *uint32Any) LastError() error {
- return nil
-}
-
-func (any *uint32Any) ValueType() ValueType {
- return NumberValue
-}
-
-func (any *uint32Any) MustBeValid() Any {
- return any
-}
-
-func (any *uint32Any) ToBool() bool {
- return any.val != 0
-}
-
-func (any *uint32Any) ToInt() int {
- return int(any.val)
-}
-
-func (any *uint32Any) ToInt32() int32 {
- return int32(any.val)
-}
-
-func (any *uint32Any) ToInt64() int64 {
- return int64(any.val)
-}
-
-func (any *uint32Any) ToUint() uint {
- return uint(any.val)
-}
-
-func (any *uint32Any) ToUint32() uint32 {
- return any.val
-}
-
-func (any *uint32Any) ToUint64() uint64 {
- return uint64(any.val)
-}
-
-func (any *uint32Any) ToFloat32() float32 {
- return float32(any.val)
-}
-
-func (any *uint32Any) ToFloat64() float64 {
- return float64(any.val)
-}
-
-func (any *uint32Any) ToString() string {
- return strconv.FormatInt(int64(any.val), 10)
-}
-
-func (any *uint32Any) WriteTo(stream *Stream) {
- stream.WriteUint32(any.val)
-}
-
-func (any *uint32Any) Parse() *Iterator {
- return nil
-}
-
-func (any *uint32Any) GetInterface() interface{} {
- return any.val
-}
diff --git a/vendor/github.com/json-iterator/go/any_uint64.go b/vendor/github.com/json-iterator/go/any_uint64.go
deleted file mode 100644
index 7df2fce3..00000000
--- a/vendor/github.com/json-iterator/go/any_uint64.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package jsoniter
-
-import (
- "strconv"
-)
-
-type uint64Any struct {
- baseAny
- val uint64
-}
-
-func (any *uint64Any) LastError() error {
- return nil
-}
-
-func (any *uint64Any) ValueType() ValueType {
- return NumberValue
-}
-
-func (any *uint64Any) MustBeValid() Any {
- return any
-}
-
-func (any *uint64Any) ToBool() bool {
- return any.val != 0
-}
-
-func (any *uint64Any) ToInt() int {
- return int(any.val)
-}
-
-func (any *uint64Any) ToInt32() int32 {
- return int32(any.val)
-}
-
-func (any *uint64Any) ToInt64() int64 {
- return int64(any.val)
-}
-
-func (any *uint64Any) ToUint() uint {
- return uint(any.val)
-}
-
-func (any *uint64Any) ToUint32() uint32 {
- return uint32(any.val)
-}
-
-func (any *uint64Any) ToUint64() uint64 {
- return any.val
-}
-
-func (any *uint64Any) ToFloat32() float32 {
- return float32(any.val)
-}
-
-func (any *uint64Any) ToFloat64() float64 {
- return float64(any.val)
-}
-
-func (any *uint64Any) ToString() string {
- return strconv.FormatUint(any.val, 10)
-}
-
-func (any *uint64Any) WriteTo(stream *Stream) {
- stream.WriteUint64(any.val)
-}
-
-func (any *uint64Any) Parse() *Iterator {
- return nil
-}
-
-func (any *uint64Any) GetInterface() interface{} {
- return any.val
-}
diff --git a/vendor/github.com/json-iterator/go/build.sh b/vendor/github.com/json-iterator/go/build.sh
deleted file mode 100755
index b45ef688..00000000
--- a/vendor/github.com/json-iterator/go/build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-set -e
-set -x
-
-if [ ! -d /tmp/build-golang/src/github.com/json-iterator ]; then
- mkdir -p /tmp/build-golang/src/github.com/json-iterator
- ln -s $PWD /tmp/build-golang/src/github.com/json-iterator/go
-fi
-export GOPATH=/tmp/build-golang
-go get -u github.com/golang/dep/cmd/dep
-cd /tmp/build-golang/src/github.com/json-iterator/go
-exec $GOPATH/bin/dep ensure -update
diff --git a/vendor/github.com/json-iterator/go/config.go b/vendor/github.com/json-iterator/go/config.go
deleted file mode 100644
index 8c58fcba..00000000
--- a/vendor/github.com/json-iterator/go/config.go
+++ /dev/null
@@ -1,375 +0,0 @@
-package jsoniter
-
-import (
- "encoding/json"
- "io"
- "reflect"
- "sync"
- "unsafe"
-
- "github.com/modern-go/concurrent"
- "github.com/modern-go/reflect2"
-)
-
-// Config customize how the API should behave.
-// The API is created from Config by Froze.
-type Config struct {
- IndentionStep int
- MarshalFloatWith6Digits bool
- EscapeHTML bool
- SortMapKeys bool
- UseNumber bool
- DisallowUnknownFields bool
- TagKey string
- OnlyTaggedField bool
- ValidateJsonRawMessage bool
- ObjectFieldMustBeSimpleString bool
- CaseSensitive bool
-}
-
-// API the public interface of this package.
-// Primary Marshal and Unmarshal.
-type API interface {
- IteratorPool
- StreamPool
- MarshalToString(v interface{}) (string, error)
- Marshal(v interface{}) ([]byte, error)
- MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
- UnmarshalFromString(str string, v interface{}) error
- Unmarshal(data []byte, v interface{}) error
- Get(data []byte, path ...interface{}) Any
- NewEncoder(writer io.Writer) *Encoder
- NewDecoder(reader io.Reader) *Decoder
- Valid(data []byte) bool
- RegisterExtension(extension Extension)
- DecoderOf(typ reflect2.Type) ValDecoder
- EncoderOf(typ reflect2.Type) ValEncoder
-}
-
-// ConfigDefault the default API
-var ConfigDefault = Config{
- EscapeHTML: true,
-}.Froze()
-
-// ConfigCompatibleWithStandardLibrary tries to be 100% compatible with standard library behavior
-var ConfigCompatibleWithStandardLibrary = Config{
- EscapeHTML: true,
- SortMapKeys: true,
- ValidateJsonRawMessage: true,
-}.Froze()
-
-// ConfigFastest marshals float with only 6 digits precision
-var ConfigFastest = Config{
- EscapeHTML: false,
- MarshalFloatWith6Digits: true, // will lose precession
- ObjectFieldMustBeSimpleString: true, // do not unescape object field
-}.Froze()
-
-type frozenConfig struct {
- configBeforeFrozen Config
- sortMapKeys bool
- indentionStep int
- objectFieldMustBeSimpleString bool
- onlyTaggedField bool
- disallowUnknownFields bool
- decoderCache *concurrent.Map
- encoderCache *concurrent.Map
- encoderExtension Extension
- decoderExtension Extension
- extraExtensions []Extension
- streamPool *sync.Pool
- iteratorPool *sync.Pool
- caseSensitive bool
-}
-
-func (cfg *frozenConfig) initCache() {
- cfg.decoderCache = concurrent.NewMap()
- cfg.encoderCache = concurrent.NewMap()
-}
-
-func (cfg *frozenConfig) addDecoderToCache(cacheKey uintptr, decoder ValDecoder) {
- cfg.decoderCache.Store(cacheKey, decoder)
-}
-
-func (cfg *frozenConfig) addEncoderToCache(cacheKey uintptr, encoder ValEncoder) {
- cfg.encoderCache.Store(cacheKey, encoder)
-}
-
-func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder {
- decoder, found := cfg.decoderCache.Load(cacheKey)
- if found {
- return decoder.(ValDecoder)
- }
- return nil
-}
-
-func (cfg *frozenConfig) getEncoderFromCache(cacheKey uintptr) ValEncoder {
- encoder, found := cfg.encoderCache.Load(cacheKey)
- if found {
- return encoder.(ValEncoder)
- }
- return nil
-}
-
-var cfgCache = concurrent.NewMap()
-
-func getFrozenConfigFromCache(cfg Config) *frozenConfig {
- obj, found := cfgCache.Load(cfg)
- if found {
- return obj.(*frozenConfig)
- }
- return nil
-}
-
-func addFrozenConfigToCache(cfg Config, frozenConfig *frozenConfig) {
- cfgCache.Store(cfg, frozenConfig)
-}
-
-// Froze forge API from config
-func (cfg Config) Froze() API {
- api := &frozenConfig{
- sortMapKeys: cfg.SortMapKeys,
- indentionStep: cfg.IndentionStep,
- objectFieldMustBeSimpleString: cfg.ObjectFieldMustBeSimpleString,
- onlyTaggedField: cfg.OnlyTaggedField,
- disallowUnknownFields: cfg.DisallowUnknownFields,
- caseSensitive: cfg.CaseSensitive,
- }
- api.streamPool = &sync.Pool{
- New: func() interface{} {
- return NewStream(api, nil, 512)
- },
- }
- api.iteratorPool = &sync.Pool{
- New: func() interface{} {
- return NewIterator(api)
- },
- }
- api.initCache()
- encoderExtension := EncoderExtension{}
- decoderExtension := DecoderExtension{}
- if cfg.MarshalFloatWith6Digits {
- api.marshalFloatWith6Digits(encoderExtension)
- }
- if cfg.EscapeHTML {
- api.escapeHTML(encoderExtension)
- }
- if cfg.UseNumber {
- api.useNumber(decoderExtension)
- }
- if cfg.ValidateJsonRawMessage {
- api.validateJsonRawMessage(encoderExtension)
- }
- api.encoderExtension = encoderExtension
- api.decoderExtension = decoderExtension
- api.configBeforeFrozen = cfg
- return api
-}
-
-func (cfg Config) frozeWithCacheReuse(extraExtensions []Extension) *frozenConfig {
- api := getFrozenConfigFromCache(cfg)
- if api != nil {
- return api
- }
- api = cfg.Froze().(*frozenConfig)
- for _, extension := range extraExtensions {
- api.RegisterExtension(extension)
- }
- addFrozenConfigToCache(cfg, api)
- return api
-}
-
-func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) {
- encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) {
- rawMessage := *(*json.RawMessage)(ptr)
- iter := cfg.BorrowIterator([]byte(rawMessage))
- iter.Read()
- if iter.Error != nil {
- stream.WriteRaw("null")
- } else {
- cfg.ReturnIterator(iter)
- stream.WriteRaw(string(rawMessage))
- }
- }, func(ptr unsafe.Pointer) bool {
- return len(*((*json.RawMessage)(ptr))) == 0
- }}
- extension[reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()] = encoder
- extension[reflect2.TypeOfPtr((*RawMessage)(nil)).Elem()] = encoder
-}
-
-func (cfg *frozenConfig) useNumber(extension DecoderExtension) {
- extension[reflect2.TypeOfPtr((*interface{})(nil)).Elem()] = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) {
- exitingValue := *((*interface{})(ptr))
- if exitingValue != nil && reflect.TypeOf(exitingValue).Kind() == reflect.Ptr {
- iter.ReadVal(exitingValue)
- return
- }
- if iter.WhatIsNext() == NumberValue {
- *((*interface{})(ptr)) = json.Number(iter.readNumberAsString())
- } else {
- *((*interface{})(ptr)) = iter.Read()
- }
- }}
-}
-func (cfg *frozenConfig) getTagKey() string {
- tagKey := cfg.configBeforeFrozen.TagKey
- if tagKey == "" {
- return "json"
- }
- return tagKey
-}
-
-func (cfg *frozenConfig) RegisterExtension(extension Extension) {
- cfg.extraExtensions = append(cfg.extraExtensions, extension)
- copied := cfg.configBeforeFrozen
- cfg.configBeforeFrozen = copied
-}
-
-type lossyFloat32Encoder struct {
-}
-
-func (encoder *lossyFloat32Encoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteFloat32Lossy(*((*float32)(ptr)))
-}
-
-func (encoder *lossyFloat32Encoder) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*float32)(ptr)) == 0
-}
-
-type lossyFloat64Encoder struct {
-}
-
-func (encoder *lossyFloat64Encoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteFloat64Lossy(*((*float64)(ptr)))
-}
-
-func (encoder *lossyFloat64Encoder) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*float64)(ptr)) == 0
-}
-
-// EnableLossyFloatMarshalling keeps 10**(-6) precision
-// for float variables for better performance.
-func (cfg *frozenConfig) marshalFloatWith6Digits(extension EncoderExtension) {
- // for better performance
- extension[reflect2.TypeOfPtr((*float32)(nil)).Elem()] = &lossyFloat32Encoder{}
- extension[reflect2.TypeOfPtr((*float64)(nil)).Elem()] = &lossyFloat64Encoder{}
-}
-
-type htmlEscapedStringEncoder struct {
-}
-
-func (encoder *htmlEscapedStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- str := *((*string)(ptr))
- stream.WriteStringWithHTMLEscaped(str)
-}
-
-func (encoder *htmlEscapedStringEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*string)(ptr)) == ""
-}
-
-func (cfg *frozenConfig) escapeHTML(encoderExtension EncoderExtension) {
- encoderExtension[reflect2.TypeOfPtr((*string)(nil)).Elem()] = &htmlEscapedStringEncoder{}
-}
-
-func (cfg *frozenConfig) cleanDecoders() {
- typeDecoders = map[string]ValDecoder{}
- fieldDecoders = map[string]ValDecoder{}
- *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig))
-}
-
-func (cfg *frozenConfig) cleanEncoders() {
- typeEncoders = map[string]ValEncoder{}
- fieldEncoders = map[string]ValEncoder{}
- *cfg = *(cfg.configBeforeFrozen.Froze().(*frozenConfig))
-}
-
-func (cfg *frozenConfig) MarshalToString(v interface{}) (string, error) {
- stream := cfg.BorrowStream(nil)
- defer cfg.ReturnStream(stream)
- stream.WriteVal(v)
- if stream.Error != nil {
- return "", stream.Error
- }
- return string(stream.Buffer()), nil
-}
-
-func (cfg *frozenConfig) Marshal(v interface{}) ([]byte, error) {
- stream := cfg.BorrowStream(nil)
- defer cfg.ReturnStream(stream)
- stream.WriteVal(v)
- if stream.Error != nil {
- return nil, stream.Error
- }
- result := stream.Buffer()
- copied := make([]byte, len(result))
- copy(copied, result)
- return copied, nil
-}
-
-func (cfg *frozenConfig) MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
- if prefix != "" {
- panic("prefix is not supported")
- }
- for _, r := range indent {
- if r != ' ' {
- panic("indent can only be space")
- }
- }
- newCfg := cfg.configBeforeFrozen
- newCfg.IndentionStep = len(indent)
- return newCfg.frozeWithCacheReuse(cfg.extraExtensions).Marshal(v)
-}
-
-func (cfg *frozenConfig) UnmarshalFromString(str string, v interface{}) error {
- data := []byte(str)
- iter := cfg.BorrowIterator(data)
- defer cfg.ReturnIterator(iter)
- iter.ReadVal(v)
- c := iter.nextToken()
- if c == 0 {
- if iter.Error == io.EOF {
- return nil
- }
- return iter.Error
- }
- iter.ReportError("Unmarshal", "there are bytes left after unmarshal")
- return iter.Error
-}
-
-func (cfg *frozenConfig) Get(data []byte, path ...interface{}) Any {
- iter := cfg.BorrowIterator(data)
- defer cfg.ReturnIterator(iter)
- return locatePath(iter, path)
-}
-
-func (cfg *frozenConfig) Unmarshal(data []byte, v interface{}) error {
- iter := cfg.BorrowIterator(data)
- defer cfg.ReturnIterator(iter)
- iter.ReadVal(v)
- c := iter.nextToken()
- if c == 0 {
- if iter.Error == io.EOF {
- return nil
- }
- return iter.Error
- }
- iter.ReportError("Unmarshal", "there are bytes left after unmarshal")
- return iter.Error
-}
-
-func (cfg *frozenConfig) NewEncoder(writer io.Writer) *Encoder {
- stream := NewStream(cfg, writer, 512)
- return &Encoder{stream}
-}
-
-func (cfg *frozenConfig) NewDecoder(reader io.Reader) *Decoder {
- iter := Parse(cfg, reader, 512)
- return &Decoder{iter}
-}
-
-func (cfg *frozenConfig) Valid(data []byte) bool {
- iter := cfg.BorrowIterator(data)
- defer cfg.ReturnIterator(iter)
- iter.Skip()
- return iter.Error == nil
-}
diff --git a/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md b/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md
deleted file mode 100644
index 3095662b..00000000
--- a/vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md
+++ /dev/null
@@ -1,7 +0,0 @@
-| json type \ dest type | bool | int | uint | float |string|
-| --- | --- | --- | --- |--|--|
-| number | positive => true negative => true zero => false| 23.2 => 23 -32.1 => -32| 12.1 => 12 -12.1 => 0|as normal|same as origin|
-| string | empty string => false string "0" => false other strings => true | "123.32" => 123 "-123.4" => -123 "123.23xxxw" => 123 "abcde12" => 0 "-32.1" => -32| 13.2 => 13 -1.1 => 0 |12.1 => 12.1 -12.3 => -12.3 12.4xxa => 12.4 +1.1e2 =>110 |same as origin|
-| bool | true => true false => false| true => 1 false => 0 | true => 1 false => 0 |true => 1 false => 0|true => "true" false => "false"|
-| object | true | 0 | 0 |0|originnal json|
-| array | empty array => false nonempty array => true| [] => 0 [1,2] => 1 | [] => 0 [1,2] => 1 |[] => 0 [1,2] => 1|original json|
\ No newline at end of file
diff --git a/vendor/github.com/json-iterator/go/iter.go b/vendor/github.com/json-iterator/go/iter.go
deleted file mode 100644
index 95ae54fb..00000000
--- a/vendor/github.com/json-iterator/go/iter.go
+++ /dev/null
@@ -1,322 +0,0 @@
-package jsoniter
-
-import (
- "encoding/json"
- "fmt"
- "io"
-)
-
-// ValueType the type for JSON element
-type ValueType int
-
-const (
- // InvalidValue invalid JSON element
- InvalidValue ValueType = iota
- // StringValue JSON element "string"
- StringValue
- // NumberValue JSON element 100 or 0.10
- NumberValue
- // NilValue JSON element null
- NilValue
- // BoolValue JSON element true or false
- BoolValue
- // ArrayValue JSON element []
- ArrayValue
- // ObjectValue JSON element {}
- ObjectValue
-)
-
-var hexDigits []byte
-var valueTypes []ValueType
-
-func init() {
- hexDigits = make([]byte, 256)
- for i := 0; i < len(hexDigits); i++ {
- hexDigits[i] = 255
- }
- for i := '0'; i <= '9'; i++ {
- hexDigits[i] = byte(i - '0')
- }
- for i := 'a'; i <= 'f'; i++ {
- hexDigits[i] = byte((i - 'a') + 10)
- }
- for i := 'A'; i <= 'F'; i++ {
- hexDigits[i] = byte((i - 'A') + 10)
- }
- valueTypes = make([]ValueType, 256)
- for i := 0; i < len(valueTypes); i++ {
- valueTypes[i] = InvalidValue
- }
- valueTypes['"'] = StringValue
- valueTypes['-'] = NumberValue
- valueTypes['0'] = NumberValue
- valueTypes['1'] = NumberValue
- valueTypes['2'] = NumberValue
- valueTypes['3'] = NumberValue
- valueTypes['4'] = NumberValue
- valueTypes['5'] = NumberValue
- valueTypes['6'] = NumberValue
- valueTypes['7'] = NumberValue
- valueTypes['8'] = NumberValue
- valueTypes['9'] = NumberValue
- valueTypes['t'] = BoolValue
- valueTypes['f'] = BoolValue
- valueTypes['n'] = NilValue
- valueTypes['['] = ArrayValue
- valueTypes['{'] = ObjectValue
-}
-
-// Iterator is a io.Reader like object, with JSON specific read functions.
-// Error is not returned as return value, but stored as Error member on this iterator instance.
-type Iterator struct {
- cfg *frozenConfig
- reader io.Reader
- buf []byte
- head int
- tail int
- captureStartedAt int
- captured []byte
- Error error
- Attachment interface{} // open for customized decoder
-}
-
-// NewIterator creates an empty Iterator instance
-func NewIterator(cfg API) *Iterator {
- return &Iterator{
- cfg: cfg.(*frozenConfig),
- reader: nil,
- buf: nil,
- head: 0,
- tail: 0,
- }
-}
-
-// Parse creates an Iterator instance from io.Reader
-func Parse(cfg API, reader io.Reader, bufSize int) *Iterator {
- return &Iterator{
- cfg: cfg.(*frozenConfig),
- reader: reader,
- buf: make([]byte, bufSize),
- head: 0,
- tail: 0,
- }
-}
-
-// ParseBytes creates an Iterator instance from byte array
-func ParseBytes(cfg API, input []byte) *Iterator {
- return &Iterator{
- cfg: cfg.(*frozenConfig),
- reader: nil,
- buf: input,
- head: 0,
- tail: len(input),
- }
-}
-
-// ParseString creates an Iterator instance from string
-func ParseString(cfg API, input string) *Iterator {
- return ParseBytes(cfg, []byte(input))
-}
-
-// Pool returns a pool can provide more iterator with same configuration
-func (iter *Iterator) Pool() IteratorPool {
- return iter.cfg
-}
-
-// Reset reuse iterator instance by specifying another reader
-func (iter *Iterator) Reset(reader io.Reader) *Iterator {
- iter.reader = reader
- iter.head = 0
- iter.tail = 0
- return iter
-}
-
-// ResetBytes reuse iterator instance by specifying another byte array as input
-func (iter *Iterator) ResetBytes(input []byte) *Iterator {
- iter.reader = nil
- iter.buf = input
- iter.head = 0
- iter.tail = len(input)
- return iter
-}
-
-// WhatIsNext gets ValueType of relatively next json element
-func (iter *Iterator) WhatIsNext() ValueType {
- valueType := valueTypes[iter.nextToken()]
- iter.unreadByte()
- return valueType
-}
-
-func (iter *Iterator) skipWhitespacesWithoutLoadMore() bool {
- for i := iter.head; i < iter.tail; i++ {
- c := iter.buf[i]
- switch c {
- case ' ', '\n', '\t', '\r':
- continue
- }
- iter.head = i
- return false
- }
- return true
-}
-
-func (iter *Iterator) isObjectEnd() bool {
- c := iter.nextToken()
- if c == ',' {
- return false
- }
- if c == '}' {
- return true
- }
- iter.ReportError("isObjectEnd", "object ended prematurely, unexpected char "+string([]byte{c}))
- return true
-}
-
-func (iter *Iterator) nextToken() byte {
- // a variation of skip whitespaces, returning the next non-whitespace token
- for {
- for i := iter.head; i < iter.tail; i++ {
- c := iter.buf[i]
- switch c {
- case ' ', '\n', '\t', '\r':
- continue
- }
- iter.head = i + 1
- return c
- }
- if !iter.loadMore() {
- return 0
- }
- }
-}
-
-// ReportError record a error in iterator instance with current position.
-func (iter *Iterator) ReportError(operation string, msg string) {
- if iter.Error != nil {
- if iter.Error != io.EOF {
- return
- }
- }
- peekStart := iter.head - 10
- if peekStart < 0 {
- peekStart = 0
- }
- peekEnd := iter.head + 10
- if peekEnd > iter.tail {
- peekEnd = iter.tail
- }
- parsing := string(iter.buf[peekStart:peekEnd])
- contextStart := iter.head - 50
- if contextStart < 0 {
- contextStart = 0
- }
- contextEnd := iter.head + 50
- if contextEnd > iter.tail {
- contextEnd = iter.tail
- }
- context := string(iter.buf[contextStart:contextEnd])
- iter.Error = fmt.Errorf("%s: %s, error found in #%v byte of ...|%s|..., bigger context ...|%s|...",
- operation, msg, iter.head-peekStart, parsing, context)
-}
-
-// CurrentBuffer gets current buffer as string for debugging purpose
-func (iter *Iterator) CurrentBuffer() string {
- peekStart := iter.head - 10
- if peekStart < 0 {
- peekStart = 0
- }
- return fmt.Sprintf("parsing #%v byte, around ...|%s|..., whole buffer ...|%s|...", iter.head,
- string(iter.buf[peekStart:iter.head]), string(iter.buf[0:iter.tail]))
-}
-
-func (iter *Iterator) readByte() (ret byte) {
- if iter.head == iter.tail {
- if iter.loadMore() {
- ret = iter.buf[iter.head]
- iter.head++
- return ret
- }
- return 0
- }
- ret = iter.buf[iter.head]
- iter.head++
- return ret
-}
-
-func (iter *Iterator) loadMore() bool {
- if iter.reader == nil {
- if iter.Error == nil {
- iter.head = iter.tail
- iter.Error = io.EOF
- }
- return false
- }
- if iter.captured != nil {
- iter.captured = append(iter.captured,
- iter.buf[iter.captureStartedAt:iter.tail]...)
- iter.captureStartedAt = 0
- }
- for {
- n, err := iter.reader.Read(iter.buf)
- if n == 0 {
- if err != nil {
- if iter.Error == nil {
- iter.Error = err
- }
- return false
- }
- } else {
- iter.head = 0
- iter.tail = n
- return true
- }
- }
-}
-
-func (iter *Iterator) unreadByte() {
- if iter.Error != nil {
- return
- }
- iter.head--
- return
-}
-
-// Read read the next JSON element as generic interface{}.
-func (iter *Iterator) Read() interface{} {
- valueType := iter.WhatIsNext()
- switch valueType {
- case StringValue:
- return iter.ReadString()
- case NumberValue:
- if iter.cfg.configBeforeFrozen.UseNumber {
- return json.Number(iter.readNumberAsString())
- }
- return iter.ReadFloat64()
- case NilValue:
- iter.skipFourBytes('n', 'u', 'l', 'l')
- return nil
- case BoolValue:
- return iter.ReadBool()
- case ArrayValue:
- arr := []interface{}{}
- iter.ReadArrayCB(func(iter *Iterator) bool {
- var elem interface{}
- iter.ReadVal(&elem)
- arr = append(arr, elem)
- return true
- })
- return arr
- case ObjectValue:
- obj := map[string]interface{}{}
- iter.ReadMapCB(func(Iter *Iterator, field string) bool {
- var elem interface{}
- iter.ReadVal(&elem)
- obj[field] = elem
- return true
- })
- return obj
- default:
- iter.ReportError("Read", fmt.Sprintf("unexpected value type: %v", valueType))
- return nil
- }
-}
diff --git a/vendor/github.com/json-iterator/go/iter_array.go b/vendor/github.com/json-iterator/go/iter_array.go
deleted file mode 100644
index 6188cb45..00000000
--- a/vendor/github.com/json-iterator/go/iter_array.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package jsoniter
-
-// ReadArray read array element, tells if the array has more element to read.
-func (iter *Iterator) ReadArray() (ret bool) {
- c := iter.nextToken()
- switch c {
- case 'n':
- iter.skipThreeBytes('u', 'l', 'l')
- return false // null
- case '[':
- c = iter.nextToken()
- if c != ']' {
- iter.unreadByte()
- return true
- }
- return false
- case ']':
- return false
- case ',':
- return true
- default:
- iter.ReportError("ReadArray", "expect [ or , or ] or n, but found "+string([]byte{c}))
- return
- }
-}
-
-// ReadArrayCB read array with callback
-func (iter *Iterator) ReadArrayCB(callback func(*Iterator) bool) (ret bool) {
- c := iter.nextToken()
- if c == '[' {
- c = iter.nextToken()
- if c != ']' {
- iter.unreadByte()
- if !callback(iter) {
- return false
- }
- c = iter.nextToken()
- for c == ',' {
- if !callback(iter) {
- return false
- }
- c = iter.nextToken()
- }
- if c != ']' {
- iter.ReportError("ReadArrayCB", "expect ] in the end, but found "+string([]byte{c}))
- return false
- }
- return true
- }
- return true
- }
- if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l')
- return true // null
- }
- iter.ReportError("ReadArrayCB", "expect [ or n, but found "+string([]byte{c}))
- return false
-}
diff --git a/vendor/github.com/json-iterator/go/iter_float.go b/vendor/github.com/json-iterator/go/iter_float.go
deleted file mode 100644
index 4f883c09..00000000
--- a/vendor/github.com/json-iterator/go/iter_float.go
+++ /dev/null
@@ -1,347 +0,0 @@
-package jsoniter
-
-import (
- "encoding/json"
- "io"
- "math/big"
- "strconv"
- "strings"
- "unsafe"
-)
-
-var floatDigits []int8
-
-const invalidCharForNumber = int8(-1)
-const endOfNumber = int8(-2)
-const dotInNumber = int8(-3)
-
-func init() {
- floatDigits = make([]int8, 256)
- for i := 0; i < len(floatDigits); i++ {
- floatDigits[i] = invalidCharForNumber
- }
- for i := int8('0'); i <= int8('9'); i++ {
- floatDigits[i] = i - int8('0')
- }
- floatDigits[','] = endOfNumber
- floatDigits[']'] = endOfNumber
- floatDigits['}'] = endOfNumber
- floatDigits[' '] = endOfNumber
- floatDigits['\t'] = endOfNumber
- floatDigits['\n'] = endOfNumber
- floatDigits['.'] = dotInNumber
-}
-
-// ReadBigFloat read big.Float
-func (iter *Iterator) ReadBigFloat() (ret *big.Float) {
- str := iter.readNumberAsString()
- if iter.Error != nil && iter.Error != io.EOF {
- return nil
- }
- prec := 64
- if len(str) > prec {
- prec = len(str)
- }
- val, _, err := big.ParseFloat(str, 10, uint(prec), big.ToZero)
- if err != nil {
- iter.Error = err
- return nil
- }
- return val
-}
-
-// ReadBigInt read big.Int
-func (iter *Iterator) ReadBigInt() (ret *big.Int) {
- str := iter.readNumberAsString()
- if iter.Error != nil && iter.Error != io.EOF {
- return nil
- }
- ret = big.NewInt(0)
- var success bool
- ret, success = ret.SetString(str, 10)
- if !success {
- iter.ReportError("ReadBigInt", "invalid big int")
- return nil
- }
- return ret
-}
-
-//ReadFloat32 read float32
-func (iter *Iterator) ReadFloat32() (ret float32) {
- c := iter.nextToken()
- if c == '-' {
- return -iter.readPositiveFloat32()
- }
- iter.unreadByte()
- return iter.readPositiveFloat32()
-}
-
-func (iter *Iterator) readPositiveFloat32() (ret float32) {
- value := uint64(0)
- c := byte(' ')
- i := iter.head
- // first char
- if i == iter.tail {
- return iter.readFloat32SlowPath()
- }
- c = iter.buf[i]
- i++
- ind := floatDigits[c]
- switch ind {
- case invalidCharForNumber:
- return iter.readFloat32SlowPath()
- case endOfNumber:
- iter.ReportError("readFloat32", "empty number")
- return
- case dotInNumber:
- iter.ReportError("readFloat32", "leading dot is invalid")
- return
- case 0:
- if i == iter.tail {
- return iter.readFloat32SlowPath()
- }
- c = iter.buf[i]
- switch c {
- case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- iter.ReportError("readFloat32", "leading zero is invalid")
- return
- }
- }
- value = uint64(ind)
- // chars before dot
-non_decimal_loop:
- for ; i < iter.tail; i++ {
- c = iter.buf[i]
- ind := floatDigits[c]
- switch ind {
- case invalidCharForNumber:
- return iter.readFloat32SlowPath()
- case endOfNumber:
- iter.head = i
- return float32(value)
- case dotInNumber:
- break non_decimal_loop
- }
- if value > uint64SafeToMultiple10 {
- return iter.readFloat32SlowPath()
- }
- value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind;
- }
- // chars after dot
- if c == '.' {
- i++
- decimalPlaces := 0
- if i == iter.tail {
- return iter.readFloat32SlowPath()
- }
- for ; i < iter.tail; i++ {
- c = iter.buf[i]
- ind := floatDigits[c]
- switch ind {
- case endOfNumber:
- if decimalPlaces > 0 && decimalPlaces < len(pow10) {
- iter.head = i
- return float32(float64(value) / float64(pow10[decimalPlaces]))
- }
- // too many decimal places
- return iter.readFloat32SlowPath()
- case invalidCharForNumber:
- fallthrough
- case dotInNumber:
- return iter.readFloat32SlowPath()
- }
- decimalPlaces++
- if value > uint64SafeToMultiple10 {
- return iter.readFloat32SlowPath()
- }
- value = (value << 3) + (value << 1) + uint64(ind)
- }
- }
- return iter.readFloat32SlowPath()
-}
-
-func (iter *Iterator) readNumberAsString() (ret string) {
- strBuf := [16]byte{}
- str := strBuf[0:0]
-load_loop:
- for {
- for i := iter.head; i < iter.tail; i++ {
- c := iter.buf[i]
- switch c {
- case '+', '-', '.', 'e', 'E', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- str = append(str, c)
- continue
- default:
- iter.head = i
- break load_loop
- }
- }
- if !iter.loadMore() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- return
- }
- if len(str) == 0 {
- iter.ReportError("readNumberAsString", "invalid number")
- }
- return *(*string)(unsafe.Pointer(&str))
-}
-
-func (iter *Iterator) readFloat32SlowPath() (ret float32) {
- str := iter.readNumberAsString()
- if iter.Error != nil && iter.Error != io.EOF {
- return
- }
- errMsg := validateFloat(str)
- if errMsg != "" {
- iter.ReportError("readFloat32SlowPath", errMsg)
- return
- }
- val, err := strconv.ParseFloat(str, 32)
- if err != nil {
- iter.Error = err
- return
- }
- return float32(val)
-}
-
-// ReadFloat64 read float64
-func (iter *Iterator) ReadFloat64() (ret float64) {
- c := iter.nextToken()
- if c == '-' {
- return -iter.readPositiveFloat64()
- }
- iter.unreadByte()
- return iter.readPositiveFloat64()
-}
-
-func (iter *Iterator) readPositiveFloat64() (ret float64) {
- value := uint64(0)
- c := byte(' ')
- i := iter.head
- // first char
- if i == iter.tail {
- return iter.readFloat64SlowPath()
- }
- c = iter.buf[i]
- i++
- ind := floatDigits[c]
- switch ind {
- case invalidCharForNumber:
- return iter.readFloat64SlowPath()
- case endOfNumber:
- iter.ReportError("readFloat64", "empty number")
- return
- case dotInNumber:
- iter.ReportError("readFloat64", "leading dot is invalid")
- return
- case 0:
- if i == iter.tail {
- return iter.readFloat64SlowPath()
- }
- c = iter.buf[i]
- switch c {
- case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- iter.ReportError("readFloat64", "leading zero is invalid")
- return
- }
- }
- value = uint64(ind)
- // chars before dot
-non_decimal_loop:
- for ; i < iter.tail; i++ {
- c = iter.buf[i]
- ind := floatDigits[c]
- switch ind {
- case invalidCharForNumber:
- return iter.readFloat64SlowPath()
- case endOfNumber:
- iter.head = i
- return float64(value)
- case dotInNumber:
- break non_decimal_loop
- }
- if value > uint64SafeToMultiple10 {
- return iter.readFloat64SlowPath()
- }
- value = (value << 3) + (value << 1) + uint64(ind) // value = value * 10 + ind;
- }
- // chars after dot
- if c == '.' {
- i++
- decimalPlaces := 0
- if i == iter.tail {
- return iter.readFloat64SlowPath()
- }
- for ; i < iter.tail; i++ {
- c = iter.buf[i]
- ind := floatDigits[c]
- switch ind {
- case endOfNumber:
- if decimalPlaces > 0 && decimalPlaces < len(pow10) {
- iter.head = i
- return float64(value) / float64(pow10[decimalPlaces])
- }
- // too many decimal places
- return iter.readFloat64SlowPath()
- case invalidCharForNumber:
- fallthrough
- case dotInNumber:
- return iter.readFloat64SlowPath()
- }
- decimalPlaces++
- if value > uint64SafeToMultiple10 {
- return iter.readFloat64SlowPath()
- }
- value = (value << 3) + (value << 1) + uint64(ind)
- }
- }
- return iter.readFloat64SlowPath()
-}
-
-func (iter *Iterator) readFloat64SlowPath() (ret float64) {
- str := iter.readNumberAsString()
- if iter.Error != nil && iter.Error != io.EOF {
- return
- }
- errMsg := validateFloat(str)
- if errMsg != "" {
- iter.ReportError("readFloat64SlowPath", errMsg)
- return
- }
- val, err := strconv.ParseFloat(str, 64)
- if err != nil {
- iter.Error = err
- return
- }
- return val
-}
-
-func validateFloat(str string) string {
- // strconv.ParseFloat is not validating `1.` or `1.e1`
- if len(str) == 0 {
- return "empty number"
- }
- if str[0] == '-' {
- return "-- is not valid"
- }
- dotPos := strings.IndexByte(str, '.')
- if dotPos != -1 {
- if dotPos == len(str)-1 {
- return "dot can not be last character"
- }
- switch str[dotPos+1] {
- case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- default:
- return "missing digit after dot"
- }
- }
- return ""
-}
-
-// ReadNumber read json.Number
-func (iter *Iterator) ReadNumber() (ret json.Number) {
- return json.Number(iter.readNumberAsString())
-}
diff --git a/vendor/github.com/json-iterator/go/iter_int.go b/vendor/github.com/json-iterator/go/iter_int.go
deleted file mode 100644
index 21423203..00000000
--- a/vendor/github.com/json-iterator/go/iter_int.go
+++ /dev/null
@@ -1,345 +0,0 @@
-package jsoniter
-
-import (
- "math"
- "strconv"
-)
-
-var intDigits []int8
-
-const uint32SafeToMultiply10 = uint32(0xffffffff)/10 - 1
-const uint64SafeToMultiple10 = uint64(0xffffffffffffffff)/10 - 1
-
-func init() {
- intDigits = make([]int8, 256)
- for i := 0; i < len(intDigits); i++ {
- intDigits[i] = invalidCharForNumber
- }
- for i := int8('0'); i <= int8('9'); i++ {
- intDigits[i] = i - int8('0')
- }
-}
-
-// ReadUint read uint
-func (iter *Iterator) ReadUint() uint {
- if strconv.IntSize == 32 {
- return uint(iter.ReadUint32())
- }
- return uint(iter.ReadUint64())
-}
-
-// ReadInt read int
-func (iter *Iterator) ReadInt() int {
- if strconv.IntSize == 32 {
- return int(iter.ReadInt32())
- }
- return int(iter.ReadInt64())
-}
-
-// ReadInt8 read int8
-func (iter *Iterator) ReadInt8() (ret int8) {
- c := iter.nextToken()
- if c == '-' {
- val := iter.readUint32(iter.readByte())
- if val > math.MaxInt8+1 {
- iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10))
- return
- }
- return -int8(val)
- }
- val := iter.readUint32(c)
- if val > math.MaxInt8 {
- iter.ReportError("ReadInt8", "overflow: "+strconv.FormatInt(int64(val), 10))
- return
- }
- return int8(val)
-}
-
-// ReadUint8 read uint8
-func (iter *Iterator) ReadUint8() (ret uint8) {
- val := iter.readUint32(iter.nextToken())
- if val > math.MaxUint8 {
- iter.ReportError("ReadUint8", "overflow: "+strconv.FormatInt(int64(val), 10))
- return
- }
- return uint8(val)
-}
-
-// ReadInt16 read int16
-func (iter *Iterator) ReadInt16() (ret int16) {
- c := iter.nextToken()
- if c == '-' {
- val := iter.readUint32(iter.readByte())
- if val > math.MaxInt16+1 {
- iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10))
- return
- }
- return -int16(val)
- }
- val := iter.readUint32(c)
- if val > math.MaxInt16 {
- iter.ReportError("ReadInt16", "overflow: "+strconv.FormatInt(int64(val), 10))
- return
- }
- return int16(val)
-}
-
-// ReadUint16 read uint16
-func (iter *Iterator) ReadUint16() (ret uint16) {
- val := iter.readUint32(iter.nextToken())
- if val > math.MaxUint16 {
- iter.ReportError("ReadUint16", "overflow: "+strconv.FormatInt(int64(val), 10))
- return
- }
- return uint16(val)
-}
-
-// ReadInt32 read int32
-func (iter *Iterator) ReadInt32() (ret int32) {
- c := iter.nextToken()
- if c == '-' {
- val := iter.readUint32(iter.readByte())
- if val > math.MaxInt32+1 {
- iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10))
- return
- }
- return -int32(val)
- }
- val := iter.readUint32(c)
- if val > math.MaxInt32 {
- iter.ReportError("ReadInt32", "overflow: "+strconv.FormatInt(int64(val), 10))
- return
- }
- return int32(val)
-}
-
-// ReadUint32 read uint32
-func (iter *Iterator) ReadUint32() (ret uint32) {
- return iter.readUint32(iter.nextToken())
-}
-
-func (iter *Iterator) readUint32(c byte) (ret uint32) {
- ind := intDigits[c]
- if ind == 0 {
- iter.assertInteger()
- return 0 // single zero
- }
- if ind == invalidCharForNumber {
- iter.ReportError("readUint32", "unexpected character: "+string([]byte{byte(ind)}))
- return
- }
- value := uint32(ind)
- if iter.tail-iter.head > 10 {
- i := iter.head
- ind2 := intDigits[iter.buf[i]]
- if ind2 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value
- }
- i++
- ind3 := intDigits[iter.buf[i]]
- if ind3 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*10 + uint32(ind2)
- }
- //iter.head = i + 1
- //value = value * 100 + uint32(ind2) * 10 + uint32(ind3)
- i++
- ind4 := intDigits[iter.buf[i]]
- if ind4 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*100 + uint32(ind2)*10 + uint32(ind3)
- }
- i++
- ind5 := intDigits[iter.buf[i]]
- if ind5 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*1000 + uint32(ind2)*100 + uint32(ind3)*10 + uint32(ind4)
- }
- i++
- ind6 := intDigits[iter.buf[i]]
- if ind6 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*10000 + uint32(ind2)*1000 + uint32(ind3)*100 + uint32(ind4)*10 + uint32(ind5)
- }
- i++
- ind7 := intDigits[iter.buf[i]]
- if ind7 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*100000 + uint32(ind2)*10000 + uint32(ind3)*1000 + uint32(ind4)*100 + uint32(ind5)*10 + uint32(ind6)
- }
- i++
- ind8 := intDigits[iter.buf[i]]
- if ind8 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*1000000 + uint32(ind2)*100000 + uint32(ind3)*10000 + uint32(ind4)*1000 + uint32(ind5)*100 + uint32(ind6)*10 + uint32(ind7)
- }
- i++
- ind9 := intDigits[iter.buf[i]]
- value = value*10000000 + uint32(ind2)*1000000 + uint32(ind3)*100000 + uint32(ind4)*10000 + uint32(ind5)*1000 + uint32(ind6)*100 + uint32(ind7)*10 + uint32(ind8)
- iter.head = i
- if ind9 == invalidCharForNumber {
- iter.assertInteger()
- return value
- }
- }
- for {
- for i := iter.head; i < iter.tail; i++ {
- ind = intDigits[iter.buf[i]]
- if ind == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value
- }
- if value > uint32SafeToMultiply10 {
- value2 := (value << 3) + (value << 1) + uint32(ind)
- if value2 < value {
- iter.ReportError("readUint32", "overflow")
- return
- }
- value = value2
- continue
- }
- value = (value << 3) + (value << 1) + uint32(ind)
- }
- if !iter.loadMore() {
- iter.assertInteger()
- return value
- }
- }
-}
-
-// ReadInt64 read int64
-func (iter *Iterator) ReadInt64() (ret int64) {
- c := iter.nextToken()
- if c == '-' {
- val := iter.readUint64(iter.readByte())
- if val > math.MaxInt64+1 {
- iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10))
- return
- }
- return -int64(val)
- }
- val := iter.readUint64(c)
- if val > math.MaxInt64 {
- iter.ReportError("ReadInt64", "overflow: "+strconv.FormatUint(uint64(val), 10))
- return
- }
- return int64(val)
-}
-
-// ReadUint64 read uint64
-func (iter *Iterator) ReadUint64() uint64 {
- return iter.readUint64(iter.nextToken())
-}
-
-func (iter *Iterator) readUint64(c byte) (ret uint64) {
- ind := intDigits[c]
- if ind == 0 {
- iter.assertInteger()
- return 0 // single zero
- }
- if ind == invalidCharForNumber {
- iter.ReportError("readUint64", "unexpected character: "+string([]byte{byte(ind)}))
- return
- }
- value := uint64(ind)
- if iter.tail-iter.head > 10 {
- i := iter.head
- ind2 := intDigits[iter.buf[i]]
- if ind2 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value
- }
- i++
- ind3 := intDigits[iter.buf[i]]
- if ind3 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*10 + uint64(ind2)
- }
- //iter.head = i + 1
- //value = value * 100 + uint32(ind2) * 10 + uint32(ind3)
- i++
- ind4 := intDigits[iter.buf[i]]
- if ind4 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*100 + uint64(ind2)*10 + uint64(ind3)
- }
- i++
- ind5 := intDigits[iter.buf[i]]
- if ind5 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*1000 + uint64(ind2)*100 + uint64(ind3)*10 + uint64(ind4)
- }
- i++
- ind6 := intDigits[iter.buf[i]]
- if ind6 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*10000 + uint64(ind2)*1000 + uint64(ind3)*100 + uint64(ind4)*10 + uint64(ind5)
- }
- i++
- ind7 := intDigits[iter.buf[i]]
- if ind7 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*100000 + uint64(ind2)*10000 + uint64(ind3)*1000 + uint64(ind4)*100 + uint64(ind5)*10 + uint64(ind6)
- }
- i++
- ind8 := intDigits[iter.buf[i]]
- if ind8 == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value*1000000 + uint64(ind2)*100000 + uint64(ind3)*10000 + uint64(ind4)*1000 + uint64(ind5)*100 + uint64(ind6)*10 + uint64(ind7)
- }
- i++
- ind9 := intDigits[iter.buf[i]]
- value = value*10000000 + uint64(ind2)*1000000 + uint64(ind3)*100000 + uint64(ind4)*10000 + uint64(ind5)*1000 + uint64(ind6)*100 + uint64(ind7)*10 + uint64(ind8)
- iter.head = i
- if ind9 == invalidCharForNumber {
- iter.assertInteger()
- return value
- }
- }
- for {
- for i := iter.head; i < iter.tail; i++ {
- ind = intDigits[iter.buf[i]]
- if ind == invalidCharForNumber {
- iter.head = i
- iter.assertInteger()
- return value
- }
- if value > uint64SafeToMultiple10 {
- value2 := (value << 3) + (value << 1) + uint64(ind)
- if value2 < value {
- iter.ReportError("readUint64", "overflow")
- return
- }
- value = value2
- continue
- }
- value = (value << 3) + (value << 1) + uint64(ind)
- }
- if !iter.loadMore() {
- iter.assertInteger()
- return value
- }
- }
-}
-
-func (iter *Iterator) assertInteger() {
- if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' {
- iter.ReportError("assertInteger", "can not decode float as int")
- }
-}
diff --git a/vendor/github.com/json-iterator/go/iter_object.go b/vendor/github.com/json-iterator/go/iter_object.go
deleted file mode 100644
index 1c575767..00000000
--- a/vendor/github.com/json-iterator/go/iter_object.go
+++ /dev/null
@@ -1,251 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "strings"
-)
-
-// ReadObject read one field from object.
-// If object ended, returns empty string.
-// Otherwise, returns the field name.
-func (iter *Iterator) ReadObject() (ret string) {
- c := iter.nextToken()
- switch c {
- case 'n':
- iter.skipThreeBytes('u', 'l', 'l')
- return "" // null
- case '{':
- c = iter.nextToken()
- if c == '"' {
- iter.unreadByte()
- field := iter.ReadString()
- c = iter.nextToken()
- if c != ':' {
- iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c}))
- }
- return field
- }
- if c == '}' {
- return "" // end of object
- }
- iter.ReportError("ReadObject", `expect " after {, but found `+string([]byte{c}))
- return
- case ',':
- field := iter.ReadString()
- c = iter.nextToken()
- if c != ':' {
- iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c}))
- }
- return field
- case '}':
- return "" // end of object
- default:
- iter.ReportError("ReadObject", fmt.Sprintf(`expect { or , or } or n, but found %s`, string([]byte{c})))
- return
- }
-}
-
-// CaseInsensitive
-func (iter *Iterator) readFieldHash() int64 {
- hash := int64(0x811c9dc5)
- c := iter.nextToken()
- if c != '"' {
- iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c}))
- return 0
- }
- for {
- for i := iter.head; i < iter.tail; i++ {
- // require ascii string and no escape
- b := iter.buf[i]
- if b == '\\' {
- iter.head = i
- for _, b := range iter.readStringSlowPath() {
- if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive {
- b += 'a' - 'A'
- }
- hash ^= int64(b)
- hash *= 0x1000193
- }
- c = iter.nextToken()
- if c != ':' {
- iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c}))
- return 0
- }
- return hash
- }
- if b == '"' {
- iter.head = i + 1
- c = iter.nextToken()
- if c != ':' {
- iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c}))
- return 0
- }
- return hash
- }
- if 'A' <= b && b <= 'Z' && !iter.cfg.caseSensitive {
- b += 'a' - 'A'
- }
- hash ^= int64(b)
- hash *= 0x1000193
- }
- if !iter.loadMore() {
- iter.ReportError("readFieldHash", `incomplete field name`)
- return 0
- }
- }
-}
-
-func calcHash(str string, caseSensitive bool) int64 {
- if !caseSensitive {
- str = strings.ToLower(str)
- }
- hash := int64(0x811c9dc5)
- for _, b := range []byte(str) {
- hash ^= int64(b)
- hash *= 0x1000193
- }
- return int64(hash)
-}
-
-// ReadObjectCB read object with callback, the key is ascii only and field name not copied
-func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool {
- c := iter.nextToken()
- var field string
- if c == '{' {
- c = iter.nextToken()
- if c == '"' {
- iter.unreadByte()
- field = iter.ReadString()
- c = iter.nextToken()
- if c != ':' {
- iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c}))
- }
- if !callback(iter, field) {
- return false
- }
- c = iter.nextToken()
- for c == ',' {
- field = iter.ReadString()
- c = iter.nextToken()
- if c != ':' {
- iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c}))
- }
- if !callback(iter, field) {
- return false
- }
- c = iter.nextToken()
- }
- if c != '}' {
- iter.ReportError("ReadObjectCB", `object not ended with }`)
- return false
- }
- return true
- }
- if c == '}' {
- return true
- }
- iter.ReportError("ReadObjectCB", `expect " after }, but found `+string([]byte{c}))
- return false
- }
- if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l')
- return true // null
- }
- iter.ReportError("ReadObjectCB", `expect { or n, but found `+string([]byte{c}))
- return false
-}
-
-// ReadMapCB read map with callback, the key can be any string
-func (iter *Iterator) ReadMapCB(callback func(*Iterator, string) bool) bool {
- c := iter.nextToken()
- if c == '{' {
- c = iter.nextToken()
- if c == '"' {
- iter.unreadByte()
- field := iter.ReadString()
- if iter.nextToken() != ':' {
- iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c}))
- return false
- }
- if !callback(iter, field) {
- return false
- }
- c = iter.nextToken()
- for c == ',' {
- field = iter.ReadString()
- if iter.nextToken() != ':' {
- iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c}))
- return false
- }
- if !callback(iter, field) {
- return false
- }
- c = iter.nextToken()
- }
- if c != '}' {
- iter.ReportError("ReadMapCB", `object not ended with }`)
- return false
- }
- return true
- }
- if c == '}' {
- return true
- }
- iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c}))
- return false
- }
- if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l')
- return true // null
- }
- iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c}))
- return false
-}
-
-func (iter *Iterator) readObjectStart() bool {
- c := iter.nextToken()
- if c == '{' {
- c = iter.nextToken()
- if c == '}' {
- return false
- }
- iter.unreadByte()
- return true
- } else if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l')
- return false
- }
- iter.ReportError("readObjectStart", "expect { or n, but found "+string([]byte{c}))
- return false
-}
-
-func (iter *Iterator) readObjectFieldAsBytes() (ret []byte) {
- str := iter.ReadStringAsSlice()
- if iter.skipWhitespacesWithoutLoadMore() {
- if ret == nil {
- ret = make([]byte, len(str))
- copy(ret, str)
- }
- if !iter.loadMore() {
- return
- }
- }
- if iter.buf[iter.head] != ':' {
- iter.ReportError("readObjectFieldAsBytes", "expect : after object field, but found "+string([]byte{iter.buf[iter.head]}))
- return
- }
- iter.head++
- if iter.skipWhitespacesWithoutLoadMore() {
- if ret == nil {
- ret = make([]byte, len(str))
- copy(ret, str)
- }
- if !iter.loadMore() {
- return
- }
- }
- if ret == nil {
- return str
- }
- return ret
-}
diff --git a/vendor/github.com/json-iterator/go/iter_skip.go b/vendor/github.com/json-iterator/go/iter_skip.go
deleted file mode 100644
index f58beb91..00000000
--- a/vendor/github.com/json-iterator/go/iter_skip.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package jsoniter
-
-import "fmt"
-
-// ReadNil reads a json object as nil and
-// returns whether it's a nil or not
-func (iter *Iterator) ReadNil() (ret bool) {
- c := iter.nextToken()
- if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l') // null
- return true
- }
- iter.unreadByte()
- return false
-}
-
-// ReadBool reads a json object as BoolValue
-func (iter *Iterator) ReadBool() (ret bool) {
- c := iter.nextToken()
- if c == 't' {
- iter.skipThreeBytes('r', 'u', 'e')
- return true
- }
- if c == 'f' {
- iter.skipFourBytes('a', 'l', 's', 'e')
- return false
- }
- iter.ReportError("ReadBool", "expect t or f, but found "+string([]byte{c}))
- return
-}
-
-// SkipAndReturnBytes skip next JSON element, and return its content as []byte.
-// The []byte can be kept, it is a copy of data.
-func (iter *Iterator) SkipAndReturnBytes() []byte {
- iter.startCapture(iter.head)
- iter.Skip()
- return iter.stopCapture()
-}
-
-type captureBuffer struct {
- startedAt int
- captured []byte
-}
-
-func (iter *Iterator) startCapture(captureStartedAt int) {
- if iter.captured != nil {
- panic("already in capture mode")
- }
- iter.captureStartedAt = captureStartedAt
- iter.captured = make([]byte, 0, 32)
-}
-
-func (iter *Iterator) stopCapture() []byte {
- if iter.captured == nil {
- panic("not in capture mode")
- }
- captured := iter.captured
- remaining := iter.buf[iter.captureStartedAt:iter.head]
- iter.captureStartedAt = -1
- iter.captured = nil
- if len(captured) == 0 {
- copied := make([]byte, len(remaining))
- copy(copied, remaining)
- return copied
- }
- captured = append(captured, remaining...)
- return captured
-}
-
-// Skip skips a json object and positions to relatively the next json object
-func (iter *Iterator) Skip() {
- c := iter.nextToken()
- switch c {
- case '"':
- iter.skipString()
- case 'n':
- iter.skipThreeBytes('u', 'l', 'l') // null
- case 't':
- iter.skipThreeBytes('r', 'u', 'e') // true
- case 'f':
- iter.skipFourBytes('a', 'l', 's', 'e') // false
- case '0':
- iter.unreadByte()
- iter.ReadFloat32()
- case '-', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- iter.skipNumber()
- case '[':
- iter.skipArray()
- case '{':
- iter.skipObject()
- default:
- iter.ReportError("Skip", fmt.Sprintf("do not know how to skip: %v", c))
- return
- }
-}
-
-func (iter *Iterator) skipFourBytes(b1, b2, b3, b4 byte) {
- if iter.readByte() != b1 {
- iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4})))
- return
- }
- if iter.readByte() != b2 {
- iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4})))
- return
- }
- if iter.readByte() != b3 {
- iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4})))
- return
- }
- if iter.readByte() != b4 {
- iter.ReportError("skipFourBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3, b4})))
- return
- }
-}
-
-func (iter *Iterator) skipThreeBytes(b1, b2, b3 byte) {
- if iter.readByte() != b1 {
- iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3})))
- return
- }
- if iter.readByte() != b2 {
- iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3})))
- return
- }
- if iter.readByte() != b3 {
- iter.ReportError("skipThreeBytes", fmt.Sprintf("expect %s", string([]byte{b1, b2, b3})))
- return
- }
-}
diff --git a/vendor/github.com/json-iterator/go/iter_skip_sloppy.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy.go
deleted file mode 100644
index 8fcdc3b6..00000000
--- a/vendor/github.com/json-iterator/go/iter_skip_sloppy.go
+++ /dev/null
@@ -1,144 +0,0 @@
-//+build jsoniter_sloppy
-
-package jsoniter
-
-// sloppy but faster implementation, do not validate the input json
-
-func (iter *Iterator) skipNumber() {
- for {
- for i := iter.head; i < iter.tail; i++ {
- c := iter.buf[i]
- switch c {
- case ' ', '\n', '\r', '\t', ',', '}', ']':
- iter.head = i
- return
- }
- }
- if !iter.loadMore() {
- return
- }
- }
-}
-
-func (iter *Iterator) skipArray() {
- level := 1
- for {
- for i := iter.head; i < iter.tail; i++ {
- switch iter.buf[i] {
- case '"': // If inside string, skip it
- iter.head = i + 1
- iter.skipString()
- i = iter.head - 1 // it will be i++ soon
- case '[': // If open symbol, increase level
- level++
- case ']': // If close symbol, increase level
- level--
-
- // If we have returned to the original level, we're done
- if level == 0 {
- iter.head = i + 1
- return
- }
- }
- }
- if !iter.loadMore() {
- iter.ReportError("skipObject", "incomplete array")
- return
- }
- }
-}
-
-func (iter *Iterator) skipObject() {
- level := 1
- for {
- for i := iter.head; i < iter.tail; i++ {
- switch iter.buf[i] {
- case '"': // If inside string, skip it
- iter.head = i + 1
- iter.skipString()
- i = iter.head - 1 // it will be i++ soon
- case '{': // If open symbol, increase level
- level++
- case '}': // If close symbol, increase level
- level--
-
- // If we have returned to the original level, we're done
- if level == 0 {
- iter.head = i + 1
- return
- }
- }
- }
- if !iter.loadMore() {
- iter.ReportError("skipObject", "incomplete object")
- return
- }
- }
-}
-
-func (iter *Iterator) skipString() {
- for {
- end, escaped := iter.findStringEnd()
- if end == -1 {
- if !iter.loadMore() {
- iter.ReportError("skipString", "incomplete string")
- return
- }
- if escaped {
- iter.head = 1 // skip the first char as last char read is \
- }
- } else {
- iter.head = end
- return
- }
- }
-}
-
-// adapted from: https://github.com/buger/jsonparser/blob/master/parser.go
-// Tries to find the end of string
-// Support if string contains escaped quote symbols.
-func (iter *Iterator) findStringEnd() (int, bool) {
- escaped := false
- for i := iter.head; i < iter.tail; i++ {
- c := iter.buf[i]
- if c == '"' {
- if !escaped {
- return i + 1, false
- }
- j := i - 1
- for {
- if j < iter.head || iter.buf[j] != '\\' {
- // even number of backslashes
- // either end of buffer, or " found
- return i + 1, true
- }
- j--
- if j < iter.head || iter.buf[j] != '\\' {
- // odd number of backslashes
- // it is \" or \\\"
- break
- }
- j--
- }
- } else if c == '\\' {
- escaped = true
- }
- }
- j := iter.tail - 1
- for {
- if j < iter.head || iter.buf[j] != '\\' {
- // even number of backslashes
- // either end of buffer, or " found
- return -1, false // do not end with \
- }
- j--
- if j < iter.head || iter.buf[j] != '\\' {
- // odd number of backslashes
- // it is \" or \\\"
- break
- }
- j--
-
- }
- return -1, true // end with \
-}
diff --git a/vendor/github.com/json-iterator/go/iter_skip_strict.go b/vendor/github.com/json-iterator/go/iter_skip_strict.go
deleted file mode 100644
index f67bc2e8..00000000
--- a/vendor/github.com/json-iterator/go/iter_skip_strict.go
+++ /dev/null
@@ -1,89 +0,0 @@
-//+build !jsoniter_sloppy
-
-package jsoniter
-
-import "fmt"
-
-func (iter *Iterator) skipNumber() {
- if !iter.trySkipNumber() {
- iter.unreadByte()
- iter.ReadFloat32()
- }
-}
-
-func (iter *Iterator) trySkipNumber() bool {
- dotFound := false
- for i := iter.head; i < iter.tail; i++ {
- c := iter.buf[i]
- switch c {
- case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- case '.':
- if dotFound {
- iter.ReportError("validateNumber", `more than one dot found in number`)
- return true // already failed
- }
- if i+1 == iter.tail {
- return false
- }
- c = iter.buf[i+1]
- switch c {
- case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- default:
- iter.ReportError("validateNumber", `missing digit after dot`)
- return true // already failed
- }
- dotFound = true
- default:
- switch c {
- case ',', ']', '}', ' ', '\t', '\n', '\r':
- if iter.head == i {
- return false // if - without following digits
- }
- iter.head = i
- return true // must be valid
- }
- return false // may be invalid
- }
- }
- return false
-}
-
-func (iter *Iterator) skipString() {
- if !iter.trySkipString() {
- iter.unreadByte()
- iter.ReadString()
- }
-}
-
-func (iter *Iterator) trySkipString() bool {
- for i := iter.head; i < iter.tail; i++ {
- c := iter.buf[i]
- if c == '"' {
- iter.head = i + 1
- return true // valid
- } else if c == '\\' {
- return false
- } else if c < ' ' {
- iter.ReportError("trySkipString",
- fmt.Sprintf(`invalid control character found: %d`, c))
- return true // already failed
- }
- }
- return false
-}
-
-func (iter *Iterator) skipObject() {
- iter.unreadByte()
- iter.ReadObjectCB(func(iter *Iterator, field string) bool {
- iter.Skip()
- return true
- })
-}
-
-func (iter *Iterator) skipArray() {
- iter.unreadByte()
- iter.ReadArrayCB(func(iter *Iterator) bool {
- iter.Skip()
- return true
- })
-}
diff --git a/vendor/github.com/json-iterator/go/iter_str.go b/vendor/github.com/json-iterator/go/iter_str.go
deleted file mode 100644
index adc487ea..00000000
--- a/vendor/github.com/json-iterator/go/iter_str.go
+++ /dev/null
@@ -1,215 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "unicode/utf16"
-)
-
-// ReadString read string from iterator
-func (iter *Iterator) ReadString() (ret string) {
- c := iter.nextToken()
- if c == '"' {
- for i := iter.head; i < iter.tail; i++ {
- c := iter.buf[i]
- if c == '"' {
- ret = string(iter.buf[iter.head:i])
- iter.head = i + 1
- return ret
- } else if c == '\\' {
- break
- } else if c < ' ' {
- iter.ReportError("ReadString",
- fmt.Sprintf(`invalid control character found: %d`, c))
- return
- }
- }
- return iter.readStringSlowPath()
- } else if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l')
- return ""
- }
- iter.ReportError("ReadString", `expects " or n, but found `+string([]byte{c}))
- return
-}
-
-func (iter *Iterator) readStringSlowPath() (ret string) {
- var str []byte
- var c byte
- for iter.Error == nil {
- c = iter.readByte()
- if c == '"' {
- return string(str)
- }
- if c == '\\' {
- c = iter.readByte()
- str = iter.readEscapedChar(c, str)
- } else {
- str = append(str, c)
- }
- }
- iter.ReportError("readStringSlowPath", "unexpected end of input")
- return
-}
-
-func (iter *Iterator) readEscapedChar(c byte, str []byte) []byte {
- switch c {
- case 'u':
- r := iter.readU4()
- if utf16.IsSurrogate(r) {
- c = iter.readByte()
- if iter.Error != nil {
- return nil
- }
- if c != '\\' {
- iter.unreadByte()
- str = appendRune(str, r)
- return str
- }
- c = iter.readByte()
- if iter.Error != nil {
- return nil
- }
- if c != 'u' {
- str = appendRune(str, r)
- return iter.readEscapedChar(c, str)
- }
- r2 := iter.readU4()
- if iter.Error != nil {
- return nil
- }
- combined := utf16.DecodeRune(r, r2)
- if combined == '\uFFFD' {
- str = appendRune(str, r)
- str = appendRune(str, r2)
- } else {
- str = appendRune(str, combined)
- }
- } else {
- str = appendRune(str, r)
- }
- case '"':
- str = append(str, '"')
- case '\\':
- str = append(str, '\\')
- case '/':
- str = append(str, '/')
- case 'b':
- str = append(str, '\b')
- case 'f':
- str = append(str, '\f')
- case 'n':
- str = append(str, '\n')
- case 'r':
- str = append(str, '\r')
- case 't':
- str = append(str, '\t')
- default:
- iter.ReportError("readEscapedChar",
- `invalid escape char after \`)
- return nil
- }
- return str
-}
-
-// ReadStringAsSlice read string from iterator without copying into string form.
-// The []byte can not be kept, as it will change after next iterator call.
-func (iter *Iterator) ReadStringAsSlice() (ret []byte) {
- c := iter.nextToken()
- if c == '"' {
- for i := iter.head; i < iter.tail; i++ {
- // require ascii string and no escape
- // for: field name, base64, number
- if iter.buf[i] == '"' {
- // fast path: reuse the underlying buffer
- ret = iter.buf[iter.head:i]
- iter.head = i + 1
- return ret
- }
- }
- readLen := iter.tail - iter.head
- copied := make([]byte, readLen, readLen*2)
- copy(copied, iter.buf[iter.head:iter.tail])
- iter.head = iter.tail
- for iter.Error == nil {
- c := iter.readByte()
- if c == '"' {
- return copied
- }
- copied = append(copied, c)
- }
- return copied
- }
- iter.ReportError("ReadStringAsSlice", `expects " or n, but found `+string([]byte{c}))
- return
-}
-
-func (iter *Iterator) readU4() (ret rune) {
- for i := 0; i < 4; i++ {
- c := iter.readByte()
- if iter.Error != nil {
- return
- }
- if c >= '0' && c <= '9' {
- ret = ret*16 + rune(c-'0')
- } else if c >= 'a' && c <= 'f' {
- ret = ret*16 + rune(c-'a'+10)
- } else if c >= 'A' && c <= 'F' {
- ret = ret*16 + rune(c-'A'+10)
- } else {
- iter.ReportError("readU4", "expects 0~9 or a~f, but found "+string([]byte{c}))
- return
- }
- }
- return ret
-}
-
-const (
- t1 = 0x00 // 0000 0000
- tx = 0x80 // 1000 0000
- t2 = 0xC0 // 1100 0000
- t3 = 0xE0 // 1110 0000
- t4 = 0xF0 // 1111 0000
- t5 = 0xF8 // 1111 1000
-
- maskx = 0x3F // 0011 1111
- mask2 = 0x1F // 0001 1111
- mask3 = 0x0F // 0000 1111
- mask4 = 0x07 // 0000 0111
-
- rune1Max = 1<<7 - 1
- rune2Max = 1<<11 - 1
- rune3Max = 1<<16 - 1
-
- surrogateMin = 0xD800
- surrogateMax = 0xDFFF
-
- maxRune = '\U0010FFFF' // Maximum valid Unicode code point.
- runeError = '\uFFFD' // the "error" Rune or "Unicode replacement character"
-)
-
-func appendRune(p []byte, r rune) []byte {
- // Negative values are erroneous. Making it unsigned addresses the problem.
- switch i := uint32(r); {
- case i <= rune1Max:
- p = append(p, byte(r))
- return p
- case i <= rune2Max:
- p = append(p, t2|byte(r>>6))
- p = append(p, tx|byte(r)&maskx)
- return p
- case i > maxRune, surrogateMin <= i && i <= surrogateMax:
- r = runeError
- fallthrough
- case i <= rune3Max:
- p = append(p, t3|byte(r>>12))
- p = append(p, tx|byte(r>>6)&maskx)
- p = append(p, tx|byte(r)&maskx)
- return p
- default:
- p = append(p, t4|byte(r>>18))
- p = append(p, tx|byte(r>>12)&maskx)
- p = append(p, tx|byte(r>>6)&maskx)
- p = append(p, tx|byte(r)&maskx)
- return p
- }
-}
diff --git a/vendor/github.com/json-iterator/go/jsoniter.go b/vendor/github.com/json-iterator/go/jsoniter.go
deleted file mode 100644
index c2934f91..00000000
--- a/vendor/github.com/json-iterator/go/jsoniter.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// Package jsoniter implements encoding and decoding of JSON as defined in
-// RFC 4627 and provides interfaces with identical syntax of standard lib encoding/json.
-// Converting from encoding/json to jsoniter is no more than replacing the package with jsoniter
-// and variable type declarations (if any).
-// jsoniter interfaces gives 100% compatibility with code using standard lib.
-//
-// "JSON and Go"
-// (https://golang.org/doc/articles/json_and_go.html)
-// gives a description of how Marshal/Unmarshal operate
-// between arbitrary or predefined json objects and bytes,
-// and it applies to jsoniter.Marshal/Unmarshal as well.
-//
-// Besides, jsoniter.Iterator provides a different set of interfaces
-// iterating given bytes/string/reader
-// and yielding parsed elements one by one.
-// This set of interfaces reads input as required and gives
-// better performance.
-package jsoniter
diff --git a/vendor/github.com/json-iterator/go/pool.go b/vendor/github.com/json-iterator/go/pool.go
deleted file mode 100644
index e2389b56..00000000
--- a/vendor/github.com/json-iterator/go/pool.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package jsoniter
-
-import (
- "io"
-)
-
-// IteratorPool a thread safe pool of iterators with same configuration
-type IteratorPool interface {
- BorrowIterator(data []byte) *Iterator
- ReturnIterator(iter *Iterator)
-}
-
-// StreamPool a thread safe pool of streams with same configuration
-type StreamPool interface {
- BorrowStream(writer io.Writer) *Stream
- ReturnStream(stream *Stream)
-}
-
-func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream {
- stream := cfg.streamPool.Get().(*Stream)
- stream.Reset(writer)
- return stream
-}
-
-func (cfg *frozenConfig) ReturnStream(stream *Stream) {
- stream.out = nil
- stream.Error = nil
- stream.Attachment = nil
- cfg.streamPool.Put(stream)
-}
-
-func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator {
- iter := cfg.iteratorPool.Get().(*Iterator)
- iter.ResetBytes(data)
- return iter
-}
-
-func (cfg *frozenConfig) ReturnIterator(iter *Iterator) {
- iter.Error = nil
- iter.Attachment = nil
- cfg.iteratorPool.Put(iter)
-}
diff --git a/vendor/github.com/json-iterator/go/reflect.go b/vendor/github.com/json-iterator/go/reflect.go
deleted file mode 100644
index 4459e203..00000000
--- a/vendor/github.com/json-iterator/go/reflect.go
+++ /dev/null
@@ -1,332 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "reflect"
- "unsafe"
-
- "github.com/modern-go/reflect2"
-)
-
-// ValDecoder is an internal type registered to cache as needed.
-// Don't confuse jsoniter.ValDecoder with json.Decoder.
-// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link).
-//
-// Reflection on type to create decoders, which is then cached
-// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions
-// 1. create instance of new value, for example *int will need a int to be allocated
-// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New
-// 3. assignment to map, both key and value will be reflect.Value
-// For a simple struct binding, it will be reflect.Value free and allocation free
-type ValDecoder interface {
- Decode(ptr unsafe.Pointer, iter *Iterator)
-}
-
-// ValEncoder is an internal type registered to cache as needed.
-// Don't confuse jsoniter.ValEncoder with json.Encoder.
-// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link).
-type ValEncoder interface {
- IsEmpty(ptr unsafe.Pointer) bool
- Encode(ptr unsafe.Pointer, stream *Stream)
-}
-
-type checkIsEmpty interface {
- IsEmpty(ptr unsafe.Pointer) bool
-}
-
-type ctx struct {
- *frozenConfig
- prefix string
- encoders map[reflect2.Type]ValEncoder
- decoders map[reflect2.Type]ValDecoder
-}
-
-func (b *ctx) caseSensitive() bool {
- if b.frozenConfig == nil {
- // default is case-insensitive
- return false
- }
- return b.frozenConfig.caseSensitive
-}
-
-func (b *ctx) append(prefix string) *ctx {
- return &ctx{
- frozenConfig: b.frozenConfig,
- prefix: b.prefix + " " + prefix,
- encoders: b.encoders,
- decoders: b.decoders,
- }
-}
-
-// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal
-func (iter *Iterator) ReadVal(obj interface{}) {
- cacheKey := reflect2.RTypeOf(obj)
- decoder := iter.cfg.getDecoderFromCache(cacheKey)
- if decoder == nil {
- typ := reflect2.TypeOf(obj)
- if typ.Kind() != reflect.Ptr {
- iter.ReportError("ReadVal", "can only unmarshal into pointer")
- return
- }
- decoder = iter.cfg.DecoderOf(typ)
- }
- ptr := reflect2.PtrOf(obj)
- if ptr == nil {
- iter.ReportError("ReadVal", "can not read into nil pointer")
- return
- }
- decoder.Decode(ptr, iter)
-}
-
-// WriteVal copy the go interface into underlying JSON, same as json.Marshal
-func (stream *Stream) WriteVal(val interface{}) {
- if nil == val {
- stream.WriteNil()
- return
- }
- cacheKey := reflect2.RTypeOf(val)
- encoder := stream.cfg.getEncoderFromCache(cacheKey)
- if encoder == nil {
- typ := reflect2.TypeOf(val)
- encoder = stream.cfg.EncoderOf(typ)
- }
- encoder.Encode(reflect2.PtrOf(val), stream)
-}
-
-func (cfg *frozenConfig) DecoderOf(typ reflect2.Type) ValDecoder {
- cacheKey := typ.RType()
- decoder := cfg.getDecoderFromCache(cacheKey)
- if decoder != nil {
- return decoder
- }
- ctx := &ctx{
- frozenConfig: cfg,
- prefix: "",
- decoders: map[reflect2.Type]ValDecoder{},
- encoders: map[reflect2.Type]ValEncoder{},
- }
- ptrType := typ.(*reflect2.UnsafePtrType)
- decoder = decoderOfType(ctx, ptrType.Elem())
- cfg.addDecoderToCache(cacheKey, decoder)
- return decoder
-}
-
-func decoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder {
- decoder := getTypeDecoderFromExtension(ctx, typ)
- if decoder != nil {
- return decoder
- }
- decoder = createDecoderOfType(ctx, typ)
- for _, extension := range extensions {
- decoder = extension.DecorateDecoder(typ, decoder)
- }
- decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder)
- for _, extension := range ctx.extraExtensions {
- decoder = extension.DecorateDecoder(typ, decoder)
- }
- return decoder
-}
-
-func createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder {
- decoder := ctx.decoders[typ]
- if decoder != nil {
- return decoder
- }
- placeholder := &placeholderDecoder{}
- ctx.decoders[typ] = placeholder
- decoder = _createDecoderOfType(ctx, typ)
- placeholder.decoder = decoder
- return decoder
-}
-
-func _createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder {
- decoder := createDecoderOfJsonRawMessage(ctx, typ)
- if decoder != nil {
- return decoder
- }
- decoder = createDecoderOfJsonNumber(ctx, typ)
- if decoder != nil {
- return decoder
- }
- decoder = createDecoderOfMarshaler(ctx, typ)
- if decoder != nil {
- return decoder
- }
- decoder = createDecoderOfAny(ctx, typ)
- if decoder != nil {
- return decoder
- }
- decoder = createDecoderOfNative(ctx, typ)
- if decoder != nil {
- return decoder
- }
- switch typ.Kind() {
- case reflect.Interface:
- ifaceType, isIFace := typ.(*reflect2.UnsafeIFaceType)
- if isIFace {
- return &ifaceDecoder{valType: ifaceType}
- }
- return &efaceDecoder{}
- case reflect.Struct:
- return decoderOfStruct(ctx, typ)
- case reflect.Array:
- return decoderOfArray(ctx, typ)
- case reflect.Slice:
- return decoderOfSlice(ctx, typ)
- case reflect.Map:
- return decoderOfMap(ctx, typ)
- case reflect.Ptr:
- return decoderOfOptional(ctx, typ)
- default:
- return &lazyErrorDecoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())}
- }
-}
-
-func (cfg *frozenConfig) EncoderOf(typ reflect2.Type) ValEncoder {
- cacheKey := typ.RType()
- encoder := cfg.getEncoderFromCache(cacheKey)
- if encoder != nil {
- return encoder
- }
- ctx := &ctx{
- frozenConfig: cfg,
- prefix: "",
- decoders: map[reflect2.Type]ValDecoder{},
- encoders: map[reflect2.Type]ValEncoder{},
- }
- encoder = encoderOfType(ctx, typ)
- if typ.LikePtr() {
- encoder = &onePtrEncoder{encoder}
- }
- cfg.addEncoderToCache(cacheKey, encoder)
- return encoder
-}
-
-type onePtrEncoder struct {
- encoder ValEncoder
-}
-
-func (encoder *onePtrEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr))
-}
-
-func (encoder *onePtrEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- encoder.encoder.Encode(unsafe.Pointer(&ptr), stream)
-}
-
-func encoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder {
- encoder := getTypeEncoderFromExtension(ctx, typ)
- if encoder != nil {
- return encoder
- }
- encoder = createEncoderOfType(ctx, typ)
- for _, extension := range extensions {
- encoder = extension.DecorateEncoder(typ, encoder)
- }
- encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder)
- for _, extension := range ctx.extraExtensions {
- encoder = extension.DecorateEncoder(typ, encoder)
- }
- return encoder
-}
-
-func createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder {
- encoder := ctx.encoders[typ]
- if encoder != nil {
- return encoder
- }
- placeholder := &placeholderEncoder{}
- ctx.encoders[typ] = placeholder
- encoder = _createEncoderOfType(ctx, typ)
- placeholder.encoder = encoder
- return encoder
-}
-func _createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder {
- encoder := createEncoderOfJsonRawMessage(ctx, typ)
- if encoder != nil {
- return encoder
- }
- encoder = createEncoderOfJsonNumber(ctx, typ)
- if encoder != nil {
- return encoder
- }
- encoder = createEncoderOfMarshaler(ctx, typ)
- if encoder != nil {
- return encoder
- }
- encoder = createEncoderOfAny(ctx, typ)
- if encoder != nil {
- return encoder
- }
- encoder = createEncoderOfNative(ctx, typ)
- if encoder != nil {
- return encoder
- }
- kind := typ.Kind()
- switch kind {
- case reflect.Interface:
- return &dynamicEncoder{typ}
- case reflect.Struct:
- return encoderOfStruct(ctx, typ)
- case reflect.Array:
- return encoderOfArray(ctx, typ)
- case reflect.Slice:
- return encoderOfSlice(ctx, typ)
- case reflect.Map:
- return encoderOfMap(ctx, typ)
- case reflect.Ptr:
- return encoderOfOptional(ctx, typ)
- default:
- return &lazyErrorEncoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())}
- }
-}
-
-type lazyErrorDecoder struct {
- err error
-}
-
-func (decoder *lazyErrorDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if iter.WhatIsNext() != NilValue {
- if iter.Error == nil {
- iter.Error = decoder.err
- }
- } else {
- iter.Skip()
- }
-}
-
-type lazyErrorEncoder struct {
- err error
-}
-
-func (encoder *lazyErrorEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- if ptr == nil {
- stream.WriteNil()
- } else if stream.Error == nil {
- stream.Error = encoder.err
- }
-}
-
-func (encoder *lazyErrorEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return false
-}
-
-type placeholderDecoder struct {
- decoder ValDecoder
-}
-
-func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- decoder.decoder.Decode(ptr, iter)
-}
-
-type placeholderEncoder struct {
- encoder ValEncoder
-}
-
-func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- encoder.encoder.Encode(ptr, stream)
-}
-
-func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.encoder.IsEmpty(ptr)
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_array.go b/vendor/github.com/json-iterator/go/reflect_array.go
deleted file mode 100644
index 13a0b7b0..00000000
--- a/vendor/github.com/json-iterator/go/reflect_array.go
+++ /dev/null
@@ -1,104 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "github.com/modern-go/reflect2"
- "io"
- "unsafe"
-)
-
-func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder {
- arrayType := typ.(*reflect2.UnsafeArrayType)
- decoder := decoderOfType(ctx.append("[arrayElem]"), arrayType.Elem())
- return &arrayDecoder{arrayType, decoder}
-}
-
-func encoderOfArray(ctx *ctx, typ reflect2.Type) ValEncoder {
- arrayType := typ.(*reflect2.UnsafeArrayType)
- if arrayType.Len() == 0 {
- return emptyArrayEncoder{}
- }
- encoder := encoderOfType(ctx.append("[arrayElem]"), arrayType.Elem())
- return &arrayEncoder{arrayType, encoder}
-}
-
-type emptyArrayEncoder struct{}
-
-func (encoder emptyArrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteEmptyArray()
-}
-
-func (encoder emptyArrayEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return true
-}
-
-type arrayEncoder struct {
- arrayType *reflect2.UnsafeArrayType
- elemEncoder ValEncoder
-}
-
-func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteArrayStart()
- elemPtr := unsafe.Pointer(ptr)
- encoder.elemEncoder.Encode(elemPtr, stream)
- for i := 1; i < encoder.arrayType.Len(); i++ {
- stream.WriteMore()
- elemPtr = encoder.arrayType.UnsafeGetIndex(ptr, i)
- encoder.elemEncoder.Encode(elemPtr, stream)
- }
- stream.WriteArrayEnd()
- if stream.Error != nil && stream.Error != io.EOF {
- stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error())
- }
-}
-
-func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return false
-}
-
-type arrayDecoder struct {
- arrayType *reflect2.UnsafeArrayType
- elemDecoder ValDecoder
-}
-
-func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- decoder.doDecode(ptr, iter)
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error())
- }
-}
-
-func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) {
- c := iter.nextToken()
- arrayType := decoder.arrayType
- if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l')
- return
- }
- if c != '[' {
- iter.ReportError("decode array", "expect [ or n, but found "+string([]byte{c}))
- return
- }
- c = iter.nextToken()
- if c == ']' {
- return
- }
- iter.unreadByte()
- elemPtr := arrayType.UnsafeGetIndex(ptr, 0)
- decoder.elemDecoder.Decode(elemPtr, iter)
- length := 1
- for c = iter.nextToken(); c == ','; c = iter.nextToken() {
- if length >= arrayType.Len() {
- iter.Skip()
- continue
- }
- idx := length
- length += 1
- elemPtr = arrayType.UnsafeGetIndex(ptr, idx)
- decoder.elemDecoder.Decode(elemPtr, iter)
- }
- if c != ']' {
- iter.ReportError("decode array", "expect ], but found "+string([]byte{c}))
- return
- }
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_dynamic.go b/vendor/github.com/json-iterator/go/reflect_dynamic.go
deleted file mode 100644
index 8b6bc8b4..00000000
--- a/vendor/github.com/json-iterator/go/reflect_dynamic.go
+++ /dev/null
@@ -1,70 +0,0 @@
-package jsoniter
-
-import (
- "github.com/modern-go/reflect2"
- "reflect"
- "unsafe"
-)
-
-type dynamicEncoder struct {
- valType reflect2.Type
-}
-
-func (encoder *dynamicEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- obj := encoder.valType.UnsafeIndirect(ptr)
- stream.WriteVal(obj)
-}
-
-func (encoder *dynamicEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.valType.UnsafeIndirect(ptr) == nil
-}
-
-type efaceDecoder struct {
-}
-
-func (decoder *efaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- pObj := (*interface{})(ptr)
- obj := *pObj
- if obj == nil {
- *pObj = iter.Read()
- return
- }
- typ := reflect2.TypeOf(obj)
- if typ.Kind() != reflect.Ptr {
- *pObj = iter.Read()
- return
- }
- ptrType := typ.(*reflect2.UnsafePtrType)
- ptrElemType := ptrType.Elem()
- if iter.WhatIsNext() == NilValue {
- if ptrElemType.Kind() != reflect.Ptr {
- iter.skipFourBytes('n', 'u', 'l', 'l')
- *pObj = nil
- return
- }
- }
- if reflect2.IsNil(obj) {
- obj := ptrElemType.New()
- iter.ReadVal(obj)
- *pObj = obj
- return
- }
- iter.ReadVal(obj)
-}
-
-type ifaceDecoder struct {
- valType *reflect2.UnsafeIFaceType
-}
-
-func (decoder *ifaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if iter.ReadNil() {
- decoder.valType.UnsafeSet(ptr, decoder.valType.UnsafeNew())
- return
- }
- obj := decoder.valType.UnsafeIndirect(ptr)
- if reflect2.IsNil(obj) {
- iter.ReportError("decode non empty interface", "can not unmarshal into nil")
- return
- }
- iter.ReadVal(obj)
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_extension.go b/vendor/github.com/json-iterator/go/reflect_extension.go
deleted file mode 100644
index 04f68756..00000000
--- a/vendor/github.com/json-iterator/go/reflect_extension.go
+++ /dev/null
@@ -1,483 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "github.com/modern-go/reflect2"
- "reflect"
- "sort"
- "strings"
- "unicode"
- "unsafe"
-)
-
-var typeDecoders = map[string]ValDecoder{}
-var fieldDecoders = map[string]ValDecoder{}
-var typeEncoders = map[string]ValEncoder{}
-var fieldEncoders = map[string]ValEncoder{}
-var extensions = []Extension{}
-
-// StructDescriptor describe how should we encode/decode the struct
-type StructDescriptor struct {
- Type reflect2.Type
- Fields []*Binding
-}
-
-// GetField get one field from the descriptor by its name.
-// Can not use map here to keep field orders.
-func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding {
- for _, binding := range structDescriptor.Fields {
- if binding.Field.Name() == fieldName {
- return binding
- }
- }
- return nil
-}
-
-// Binding describe how should we encode/decode the struct field
-type Binding struct {
- levels []int
- Field reflect2.StructField
- FromNames []string
- ToNames []string
- Encoder ValEncoder
- Decoder ValDecoder
-}
-
-// Extension the one for all SPI. Customize encoding/decoding by specifying alternate encoder/decoder.
-// Can also rename fields by UpdateStructDescriptor.
-type Extension interface {
- UpdateStructDescriptor(structDescriptor *StructDescriptor)
- CreateMapKeyDecoder(typ reflect2.Type) ValDecoder
- CreateMapKeyEncoder(typ reflect2.Type) ValEncoder
- CreateDecoder(typ reflect2.Type) ValDecoder
- CreateEncoder(typ reflect2.Type) ValEncoder
- DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder
- DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder
-}
-
-// DummyExtension embed this type get dummy implementation for all methods of Extension
-type DummyExtension struct {
-}
-
-// UpdateStructDescriptor No-op
-func (extension *DummyExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) {
-}
-
-// CreateMapKeyDecoder No-op
-func (extension *DummyExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder {
- return nil
-}
-
-// CreateMapKeyEncoder No-op
-func (extension *DummyExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder {
- return nil
-}
-
-// CreateDecoder No-op
-func (extension *DummyExtension) CreateDecoder(typ reflect2.Type) ValDecoder {
- return nil
-}
-
-// CreateEncoder No-op
-func (extension *DummyExtension) CreateEncoder(typ reflect2.Type) ValEncoder {
- return nil
-}
-
-// DecorateDecoder No-op
-func (extension *DummyExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder {
- return decoder
-}
-
-// DecorateEncoder No-op
-func (extension *DummyExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder {
- return encoder
-}
-
-type EncoderExtension map[reflect2.Type]ValEncoder
-
-// UpdateStructDescriptor No-op
-func (extension EncoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) {
-}
-
-// CreateDecoder No-op
-func (extension EncoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder {
- return nil
-}
-
-// CreateEncoder get encoder from map
-func (extension EncoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder {
- return extension[typ]
-}
-
-// CreateMapKeyDecoder No-op
-func (extension EncoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder {
- return nil
-}
-
-// CreateMapKeyEncoder No-op
-func (extension EncoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder {
- return nil
-}
-
-// DecorateDecoder No-op
-func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder {
- return decoder
-}
-
-// DecorateEncoder No-op
-func (extension EncoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder {
- return encoder
-}
-
-type DecoderExtension map[reflect2.Type]ValDecoder
-
-// UpdateStructDescriptor No-op
-func (extension DecoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) {
-}
-
-// CreateMapKeyDecoder No-op
-func (extension DecoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder {
- return nil
-}
-
-// CreateMapKeyEncoder No-op
-func (extension DecoderExtension) CreateMapKeyEncoder(typ reflect2.Type) ValEncoder {
- return nil
-}
-
-// CreateDecoder get decoder from map
-func (extension DecoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder {
- return extension[typ]
-}
-
-// CreateEncoder No-op
-func (extension DecoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder {
- return nil
-}
-
-// DecorateDecoder No-op
-func (extension DecoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder {
- return decoder
-}
-
-// DecorateEncoder No-op
-func (extension DecoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder {
- return encoder
-}
-
-type funcDecoder struct {
- fun DecoderFunc
-}
-
-func (decoder *funcDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- decoder.fun(ptr, iter)
-}
-
-type funcEncoder struct {
- fun EncoderFunc
- isEmptyFunc func(ptr unsafe.Pointer) bool
-}
-
-func (encoder *funcEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- encoder.fun(ptr, stream)
-}
-
-func (encoder *funcEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- if encoder.isEmptyFunc == nil {
- return false
- }
- return encoder.isEmptyFunc(ptr)
-}
-
-// DecoderFunc the function form of TypeDecoder
-type DecoderFunc func(ptr unsafe.Pointer, iter *Iterator)
-
-// EncoderFunc the function form of TypeEncoder
-type EncoderFunc func(ptr unsafe.Pointer, stream *Stream)
-
-// RegisterTypeDecoderFunc register TypeDecoder for a type with function
-func RegisterTypeDecoderFunc(typ string, fun DecoderFunc) {
- typeDecoders[typ] = &funcDecoder{fun}
-}
-
-// RegisterTypeDecoder register TypeDecoder for a typ
-func RegisterTypeDecoder(typ string, decoder ValDecoder) {
- typeDecoders[typ] = decoder
-}
-
-// RegisterFieldDecoderFunc register TypeDecoder for a struct field with function
-func RegisterFieldDecoderFunc(typ string, field string, fun DecoderFunc) {
- RegisterFieldDecoder(typ, field, &funcDecoder{fun})
-}
-
-// RegisterFieldDecoder register TypeDecoder for a struct field
-func RegisterFieldDecoder(typ string, field string, decoder ValDecoder) {
- fieldDecoders[fmt.Sprintf("%s/%s", typ, field)] = decoder
-}
-
-// RegisterTypeEncoderFunc register TypeEncoder for a type with encode/isEmpty function
-func RegisterTypeEncoderFunc(typ string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) {
- typeEncoders[typ] = &funcEncoder{fun, isEmptyFunc}
-}
-
-// RegisterTypeEncoder register TypeEncoder for a type
-func RegisterTypeEncoder(typ string, encoder ValEncoder) {
- typeEncoders[typ] = encoder
-}
-
-// RegisterFieldEncoderFunc register TypeEncoder for a struct field with encode/isEmpty function
-func RegisterFieldEncoderFunc(typ string, field string, fun EncoderFunc, isEmptyFunc func(unsafe.Pointer) bool) {
- RegisterFieldEncoder(typ, field, &funcEncoder{fun, isEmptyFunc})
-}
-
-// RegisterFieldEncoder register TypeEncoder for a struct field
-func RegisterFieldEncoder(typ string, field string, encoder ValEncoder) {
- fieldEncoders[fmt.Sprintf("%s/%s", typ, field)] = encoder
-}
-
-// RegisterExtension register extension
-func RegisterExtension(extension Extension) {
- extensions = append(extensions, extension)
-}
-
-func getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder {
- decoder := _getTypeDecoderFromExtension(ctx, typ)
- if decoder != nil {
- for _, extension := range extensions {
- decoder = extension.DecorateDecoder(typ, decoder)
- }
- decoder = ctx.decoderExtension.DecorateDecoder(typ, decoder)
- for _, extension := range ctx.extraExtensions {
- decoder = extension.DecorateDecoder(typ, decoder)
- }
- }
- return decoder
-}
-func _getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder {
- for _, extension := range extensions {
- decoder := extension.CreateDecoder(typ)
- if decoder != nil {
- return decoder
- }
- }
- decoder := ctx.decoderExtension.CreateDecoder(typ)
- if decoder != nil {
- return decoder
- }
- for _, extension := range ctx.extraExtensions {
- decoder := extension.CreateDecoder(typ)
- if decoder != nil {
- return decoder
- }
- }
- typeName := typ.String()
- decoder = typeDecoders[typeName]
- if decoder != nil {
- return decoder
- }
- if typ.Kind() == reflect.Ptr {
- ptrType := typ.(*reflect2.UnsafePtrType)
- decoder := typeDecoders[ptrType.Elem().String()]
- if decoder != nil {
- return &OptionalDecoder{ptrType.Elem(), decoder}
- }
- }
- return nil
-}
-
-func getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder {
- encoder := _getTypeEncoderFromExtension(ctx, typ)
- if encoder != nil {
- for _, extension := range extensions {
- encoder = extension.DecorateEncoder(typ, encoder)
- }
- encoder = ctx.encoderExtension.DecorateEncoder(typ, encoder)
- for _, extension := range ctx.extraExtensions {
- encoder = extension.DecorateEncoder(typ, encoder)
- }
- }
- return encoder
-}
-
-func _getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder {
- for _, extension := range extensions {
- encoder := extension.CreateEncoder(typ)
- if encoder != nil {
- return encoder
- }
- }
- encoder := ctx.encoderExtension.CreateEncoder(typ)
- if encoder != nil {
- return encoder
- }
- for _, extension := range ctx.extraExtensions {
- encoder := extension.CreateEncoder(typ)
- if encoder != nil {
- return encoder
- }
- }
- typeName := typ.String()
- encoder = typeEncoders[typeName]
- if encoder != nil {
- return encoder
- }
- if typ.Kind() == reflect.Ptr {
- typePtr := typ.(*reflect2.UnsafePtrType)
- encoder := typeEncoders[typePtr.Elem().String()]
- if encoder != nil {
- return &OptionalEncoder{encoder}
- }
- }
- return nil
-}
-
-func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor {
- structType := typ.(*reflect2.UnsafeStructType)
- embeddedBindings := []*Binding{}
- bindings := []*Binding{}
- for i := 0; i < structType.NumField(); i++ {
- field := structType.Field(i)
- tag, hastag := field.Tag().Lookup(ctx.getTagKey())
- if ctx.onlyTaggedField && !hastag {
- continue
- }
- tagParts := strings.Split(tag, ",")
- if tag == "-" {
- continue
- }
- if field.Anonymous() && (tag == "" || tagParts[0] == "") {
- if field.Type().Kind() == reflect.Struct {
- structDescriptor := describeStruct(ctx, field.Type())
- for _, binding := range structDescriptor.Fields {
- binding.levels = append([]int{i}, binding.levels...)
- omitempty := binding.Encoder.(*structFieldEncoder).omitempty
- binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty}
- binding.Decoder = &structFieldDecoder{field, binding.Decoder}
- embeddedBindings = append(embeddedBindings, binding)
- }
- continue
- } else if field.Type().Kind() == reflect.Ptr {
- ptrType := field.Type().(*reflect2.UnsafePtrType)
- if ptrType.Elem().Kind() == reflect.Struct {
- structDescriptor := describeStruct(ctx, ptrType.Elem())
- for _, binding := range structDescriptor.Fields {
- binding.levels = append([]int{i}, binding.levels...)
- omitempty := binding.Encoder.(*structFieldEncoder).omitempty
- binding.Encoder = &dereferenceEncoder{binding.Encoder}
- binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty}
- binding.Decoder = &dereferenceDecoder{ptrType.Elem(), binding.Decoder}
- binding.Decoder = &structFieldDecoder{field, binding.Decoder}
- embeddedBindings = append(embeddedBindings, binding)
- }
- continue
- }
- }
- }
- fieldNames := calcFieldNames(field.Name(), tagParts[0], tag)
- fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name())
- decoder := fieldDecoders[fieldCacheKey]
- if decoder == nil {
- decoder = decoderOfType(ctx.append(field.Name()), field.Type())
- }
- encoder := fieldEncoders[fieldCacheKey]
- if encoder == nil {
- encoder = encoderOfType(ctx.append(field.Name()), field.Type())
- }
- binding := &Binding{
- Field: field,
- FromNames: fieldNames,
- ToNames: fieldNames,
- Decoder: decoder,
- Encoder: encoder,
- }
- binding.levels = []int{i}
- bindings = append(bindings, binding)
- }
- return createStructDescriptor(ctx, typ, bindings, embeddedBindings)
-}
-func createStructDescriptor(ctx *ctx, typ reflect2.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor {
- structDescriptor := &StructDescriptor{
- Type: typ,
- Fields: bindings,
- }
- for _, extension := range extensions {
- extension.UpdateStructDescriptor(structDescriptor)
- }
- ctx.encoderExtension.UpdateStructDescriptor(structDescriptor)
- ctx.decoderExtension.UpdateStructDescriptor(structDescriptor)
- for _, extension := range ctx.extraExtensions {
- extension.UpdateStructDescriptor(structDescriptor)
- }
- processTags(structDescriptor, ctx.frozenConfig)
- // merge normal & embedded bindings & sort with original order
- allBindings := sortableBindings(append(embeddedBindings, structDescriptor.Fields...))
- sort.Sort(allBindings)
- structDescriptor.Fields = allBindings
- return structDescriptor
-}
-
-type sortableBindings []*Binding
-
-func (bindings sortableBindings) Len() int {
- return len(bindings)
-}
-
-func (bindings sortableBindings) Less(i, j int) bool {
- left := bindings[i].levels
- right := bindings[j].levels
- k := 0
- for {
- if left[k] < right[k] {
- return true
- } else if left[k] > right[k] {
- return false
- }
- k++
- }
-}
-
-func (bindings sortableBindings) Swap(i, j int) {
- bindings[i], bindings[j] = bindings[j], bindings[i]
-}
-
-func processTags(structDescriptor *StructDescriptor, cfg *frozenConfig) {
- for _, binding := range structDescriptor.Fields {
- shouldOmitEmpty := false
- tagParts := strings.Split(binding.Field.Tag().Get(cfg.getTagKey()), ",")
- for _, tagPart := range tagParts[1:] {
- if tagPart == "omitempty" {
- shouldOmitEmpty = true
- } else if tagPart == "string" {
- if binding.Field.Type().Kind() == reflect.String {
- binding.Decoder = &stringModeStringDecoder{binding.Decoder, cfg}
- binding.Encoder = &stringModeStringEncoder{binding.Encoder, cfg}
- } else {
- binding.Decoder = &stringModeNumberDecoder{binding.Decoder}
- binding.Encoder = &stringModeNumberEncoder{binding.Encoder}
- }
- }
- }
- binding.Decoder = &structFieldDecoder{binding.Field, binding.Decoder}
- binding.Encoder = &structFieldEncoder{binding.Field, binding.Encoder, shouldOmitEmpty}
- }
-}
-
-func calcFieldNames(originalFieldName string, tagProvidedFieldName string, wholeTag string) []string {
- // ignore?
- if wholeTag == "-" {
- return []string{}
- }
- // rename?
- var fieldNames []string
- if tagProvidedFieldName == "" {
- fieldNames = []string{originalFieldName}
- } else {
- fieldNames = []string{tagProvidedFieldName}
- }
- // private?
- isNotExported := unicode.IsLower(rune(originalFieldName[0]))
- if isNotExported {
- fieldNames = []string{}
- }
- return fieldNames
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_json_number.go b/vendor/github.com/json-iterator/go/reflect_json_number.go
deleted file mode 100644
index 98d45c1e..00000000
--- a/vendor/github.com/json-iterator/go/reflect_json_number.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package jsoniter
-
-import (
- "encoding/json"
- "github.com/modern-go/reflect2"
- "strconv"
- "unsafe"
-)
-
-type Number string
-
-// String returns the literal text of the number.
-func (n Number) String() string { return string(n) }
-
-// Float64 returns the number as a float64.
-func (n Number) Float64() (float64, error) {
- return strconv.ParseFloat(string(n), 64)
-}
-
-// Int64 returns the number as an int64.
-func (n Number) Int64() (int64, error) {
- return strconv.ParseInt(string(n), 10, 64)
-}
-
-func CastJsonNumber(val interface{}) (string, bool) {
- switch typedVal := val.(type) {
- case json.Number:
- return string(typedVal), true
- case Number:
- return string(typedVal), true
- }
- return "", false
-}
-
-var jsonNumberType = reflect2.TypeOfPtr((*json.Number)(nil)).Elem()
-var jsoniterNumberType = reflect2.TypeOfPtr((*Number)(nil)).Elem()
-
-func createDecoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValDecoder {
- if typ.AssignableTo(jsonNumberType) {
- return &jsonNumberCodec{}
- }
- if typ.AssignableTo(jsoniterNumberType) {
- return &jsoniterNumberCodec{}
- }
- return nil
-}
-
-func createEncoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValEncoder {
- if typ.AssignableTo(jsonNumberType) {
- return &jsonNumberCodec{}
- }
- if typ.AssignableTo(jsoniterNumberType) {
- return &jsoniterNumberCodec{}
- }
- return nil
-}
-
-type jsonNumberCodec struct {
-}
-
-func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- switch iter.WhatIsNext() {
- case StringValue:
- *((*json.Number)(ptr)) = json.Number(iter.ReadString())
- case NilValue:
- iter.skipFourBytes('n', 'u', 'l', 'l')
- *((*json.Number)(ptr)) = ""
- default:
- *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString()))
- }
-}
-
-func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
- number := *((*json.Number)(ptr))
- if len(number) == 0 {
- stream.writeByte('0')
- } else {
- stream.WriteRaw(string(number))
- }
-}
-
-func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool {
- return len(*((*json.Number)(ptr))) == 0
-}
-
-type jsoniterNumberCodec struct {
-}
-
-func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- switch iter.WhatIsNext() {
- case StringValue:
- *((*Number)(ptr)) = Number(iter.ReadString())
- case NilValue:
- iter.skipFourBytes('n', 'u', 'l', 'l')
- *((*Number)(ptr)) = ""
- default:
- *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString()))
- }
-}
-
-func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
- number := *((*Number)(ptr))
- if len(number) == 0 {
- stream.writeByte('0')
- } else {
- stream.WriteRaw(string(number))
- }
-}
-
-func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool {
- return len(*((*Number)(ptr))) == 0
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go b/vendor/github.com/json-iterator/go/reflect_json_raw_message.go
deleted file mode 100644
index f2619936..00000000
--- a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package jsoniter
-
-import (
- "encoding/json"
- "github.com/modern-go/reflect2"
- "unsafe"
-)
-
-var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()
-var jsoniterRawMessageType = reflect2.TypeOfPtr((*RawMessage)(nil)).Elem()
-
-func createEncoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValEncoder {
- if typ == jsonRawMessageType {
- return &jsonRawMessageCodec{}
- }
- if typ == jsoniterRawMessageType {
- return &jsoniterRawMessageCodec{}
- }
- return nil
-}
-
-func createDecoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValDecoder {
- if typ == jsonRawMessageType {
- return &jsonRawMessageCodec{}
- }
- if typ == jsoniterRawMessageType {
- return &jsoniterRawMessageCodec{}
- }
- return nil
-}
-
-type jsonRawMessageCodec struct {
-}
-
-func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- *((*json.RawMessage)(ptr)) = json.RawMessage(iter.SkipAndReturnBytes())
-}
-
-func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteRaw(string(*((*json.RawMessage)(ptr))))
-}
-
-func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool {
- return len(*((*json.RawMessage)(ptr))) == 0
-}
-
-type jsoniterRawMessageCodec struct {
-}
-
-func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- *((*RawMessage)(ptr)) = RawMessage(iter.SkipAndReturnBytes())
-}
-
-func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteRaw(string(*((*RawMessage)(ptr))))
-}
-
-func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool {
- return len(*((*RawMessage)(ptr))) == 0
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_map.go b/vendor/github.com/json-iterator/go/reflect_map.go
deleted file mode 100644
index 7f66a88b..00000000
--- a/vendor/github.com/json-iterator/go/reflect_map.go
+++ /dev/null
@@ -1,326 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "github.com/modern-go/reflect2"
- "io"
- "reflect"
- "sort"
- "unsafe"
-)
-
-func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder {
- mapType := typ.(*reflect2.UnsafeMapType)
- keyDecoder := decoderOfMapKey(ctx.append("[mapKey]"), mapType.Key())
- elemDecoder := decoderOfType(ctx.append("[mapElem]"), mapType.Elem())
- return &mapDecoder{
- mapType: mapType,
- keyType: mapType.Key(),
- elemType: mapType.Elem(),
- keyDecoder: keyDecoder,
- elemDecoder: elemDecoder,
- }
-}
-
-func encoderOfMap(ctx *ctx, typ reflect2.Type) ValEncoder {
- mapType := typ.(*reflect2.UnsafeMapType)
- if ctx.sortMapKeys {
- return &sortKeysMapEncoder{
- mapType: mapType,
- keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()),
- elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()),
- }
- }
- return &mapEncoder{
- mapType: mapType,
- keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()),
- elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()),
- }
-}
-
-func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder {
- decoder := ctx.decoderExtension.CreateMapKeyDecoder(typ)
- if decoder != nil {
- return decoder
- }
- for _, extension := range ctx.extraExtensions {
- decoder := extension.CreateMapKeyDecoder(typ)
- if decoder != nil {
- return decoder
- }
- }
- switch typ.Kind() {
- case reflect.String:
- return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String))
- case reflect.Bool,
- reflect.Uint8, reflect.Int8,
- reflect.Uint16, reflect.Int16,
- reflect.Uint32, reflect.Int32,
- reflect.Uint64, reflect.Int64,
- reflect.Uint, reflect.Int,
- reflect.Float32, reflect.Float64,
- reflect.Uintptr:
- typ = reflect2.DefaultTypeOfKind(typ.Kind())
- return &numericMapKeyDecoder{decoderOfType(ctx, typ)}
- default:
- ptrType := reflect2.PtrTo(typ)
- if ptrType.Implements(textMarshalerType) {
- return &referenceDecoder{
- &textUnmarshalerDecoder{
- valType: ptrType,
- },
- }
- }
- if typ.Implements(textMarshalerType) {
- return &textUnmarshalerDecoder{
- valType: typ,
- }
- }
- return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)}
- }
-}
-
-func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder {
- encoder := ctx.encoderExtension.CreateMapKeyEncoder(typ)
- if encoder != nil {
- return encoder
- }
- for _, extension := range ctx.extraExtensions {
- encoder := extension.CreateMapKeyEncoder(typ)
- if encoder != nil {
- return encoder
- }
- }
- switch typ.Kind() {
- case reflect.String:
- return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String))
- case reflect.Bool,
- reflect.Uint8, reflect.Int8,
- reflect.Uint16, reflect.Int16,
- reflect.Uint32, reflect.Int32,
- reflect.Uint64, reflect.Int64,
- reflect.Uint, reflect.Int,
- reflect.Float32, reflect.Float64,
- reflect.Uintptr:
- typ = reflect2.DefaultTypeOfKind(typ.Kind())
- return &numericMapKeyEncoder{encoderOfType(ctx, typ)}
- default:
- if typ == textMarshalerType {
- return &directTextMarshalerEncoder{
- stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
- }
- }
- if typ.Implements(textMarshalerType) {
- return &textMarshalerEncoder{
- valType: typ,
- stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
- }
- }
- if typ.Kind() == reflect.Interface {
- return &dynamicMapKeyEncoder{ctx, typ}
- }
- return &lazyErrorEncoder{err: fmt.Errorf("unsupported map key type: %v", typ)}
- }
-}
-
-type mapDecoder struct {
- mapType *reflect2.UnsafeMapType
- keyType reflect2.Type
- elemType reflect2.Type
- keyDecoder ValDecoder
- elemDecoder ValDecoder
-}
-
-func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- mapType := decoder.mapType
- c := iter.nextToken()
- if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l')
- *(*unsafe.Pointer)(ptr) = nil
- mapType.UnsafeSet(ptr, mapType.UnsafeNew())
- return
- }
- if mapType.UnsafeIsNil(ptr) {
- mapType.UnsafeSet(ptr, mapType.UnsafeMakeMap(0))
- }
- if c != '{' {
- iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c}))
- return
- }
- c = iter.nextToken()
- if c == '}' {
- return
- }
- if c != '"' {
- iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c}))
- return
- }
- iter.unreadByte()
- key := decoder.keyType.UnsafeNew()
- decoder.keyDecoder.Decode(key, iter)
- c = iter.nextToken()
- if c != ':' {
- iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c}))
- return
- }
- elem := decoder.elemType.UnsafeNew()
- decoder.elemDecoder.Decode(elem, iter)
- decoder.mapType.UnsafeSetIndex(ptr, key, elem)
- for c = iter.nextToken(); c == ','; c = iter.nextToken() {
- key := decoder.keyType.UnsafeNew()
- decoder.keyDecoder.Decode(key, iter)
- c = iter.nextToken()
- if c != ':' {
- iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c}))
- return
- }
- elem := decoder.elemType.UnsafeNew()
- decoder.elemDecoder.Decode(elem, iter)
- decoder.mapType.UnsafeSetIndex(ptr, key, elem)
- }
- if c != '}' {
- iter.ReportError("ReadMapCB", `expect }, but found `+string([]byte{c}))
- }
-}
-
-type numericMapKeyDecoder struct {
- decoder ValDecoder
-}
-
-func (decoder *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- c := iter.nextToken()
- if c != '"' {
- iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c}))
- return
- }
- decoder.decoder.Decode(ptr, iter)
- c = iter.nextToken()
- if c != '"' {
- iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c}))
- return
- }
-}
-
-type numericMapKeyEncoder struct {
- encoder ValEncoder
-}
-
-func (encoder *numericMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.writeByte('"')
- encoder.encoder.Encode(ptr, stream)
- stream.writeByte('"')
-}
-
-func (encoder *numericMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return false
-}
-
-type dynamicMapKeyEncoder struct {
- ctx *ctx
- valType reflect2.Type
-}
-
-func (encoder *dynamicMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- obj := encoder.valType.UnsafeIndirect(ptr)
- encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).Encode(reflect2.PtrOf(obj), stream)
-}
-
-func (encoder *dynamicMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- obj := encoder.valType.UnsafeIndirect(ptr)
- return encoderOfMapKey(encoder.ctx, reflect2.TypeOf(obj)).IsEmpty(reflect2.PtrOf(obj))
-}
-
-type mapEncoder struct {
- mapType *reflect2.UnsafeMapType
- keyEncoder ValEncoder
- elemEncoder ValEncoder
-}
-
-func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteObjectStart()
- iter := encoder.mapType.UnsafeIterate(ptr)
- for i := 0; iter.HasNext(); i++ {
- if i != 0 {
- stream.WriteMore()
- }
- key, elem := iter.UnsafeNext()
- encoder.keyEncoder.Encode(key, stream)
- if stream.indention > 0 {
- stream.writeTwoBytes(byte(':'), byte(' '))
- } else {
- stream.writeByte(':')
- }
- encoder.elemEncoder.Encode(elem, stream)
- }
- stream.WriteObjectEnd()
-}
-
-func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- iter := encoder.mapType.UnsafeIterate(ptr)
- return !iter.HasNext()
-}
-
-type sortKeysMapEncoder struct {
- mapType *reflect2.UnsafeMapType
- keyEncoder ValEncoder
- elemEncoder ValEncoder
-}
-
-func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- if *(*unsafe.Pointer)(ptr) == nil {
- stream.WriteNil()
- return
- }
- stream.WriteObjectStart()
- mapIter := encoder.mapType.UnsafeIterate(ptr)
- subStream := stream.cfg.BorrowStream(nil)
- subIter := stream.cfg.BorrowIterator(nil)
- keyValues := encodedKeyValues{}
- for mapIter.HasNext() {
- subStream.buf = make([]byte, 0, 64)
- key, elem := mapIter.UnsafeNext()
- encoder.keyEncoder.Encode(key, subStream)
- if subStream.Error != nil && subStream.Error != io.EOF && stream.Error == nil {
- stream.Error = subStream.Error
- }
- encodedKey := subStream.Buffer()
- subIter.ResetBytes(encodedKey)
- decodedKey := subIter.ReadString()
- if stream.indention > 0 {
- subStream.writeTwoBytes(byte(':'), byte(' '))
- } else {
- subStream.writeByte(':')
- }
- encoder.elemEncoder.Encode(elem, subStream)
- keyValues = append(keyValues, encodedKV{
- key: decodedKey,
- keyValue: subStream.Buffer(),
- })
- }
- sort.Sort(keyValues)
- for i, keyValue := range keyValues {
- if i != 0 {
- stream.WriteMore()
- }
- stream.Write(keyValue.keyValue)
- }
- stream.WriteObjectEnd()
- stream.cfg.ReturnStream(subStream)
- stream.cfg.ReturnIterator(subIter)
-}
-
-func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- iter := encoder.mapType.UnsafeIterate(ptr)
- return !iter.HasNext()
-}
-
-type encodedKeyValues []encodedKV
-
-type encodedKV struct {
- key string
- keyValue []byte
-}
-
-func (sv encodedKeyValues) Len() int { return len(sv) }
-func (sv encodedKeyValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] }
-func (sv encodedKeyValues) Less(i, j int) bool { return sv[i].key < sv[j].key }
diff --git a/vendor/github.com/json-iterator/go/reflect_marshaler.go b/vendor/github.com/json-iterator/go/reflect_marshaler.go
deleted file mode 100644
index 58ac959a..00000000
--- a/vendor/github.com/json-iterator/go/reflect_marshaler.go
+++ /dev/null
@@ -1,218 +0,0 @@
-package jsoniter
-
-import (
- "encoding"
- "encoding/json"
- "github.com/modern-go/reflect2"
- "unsafe"
-)
-
-var marshalerType = reflect2.TypeOfPtr((*json.Marshaler)(nil)).Elem()
-var unmarshalerType = reflect2.TypeOfPtr((*json.Unmarshaler)(nil)).Elem()
-var textMarshalerType = reflect2.TypeOfPtr((*encoding.TextMarshaler)(nil)).Elem()
-var textUnmarshalerType = reflect2.TypeOfPtr((*encoding.TextUnmarshaler)(nil)).Elem()
-
-func createDecoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValDecoder {
- ptrType := reflect2.PtrTo(typ)
- if ptrType.Implements(unmarshalerType) {
- return &referenceDecoder{
- &unmarshalerDecoder{ptrType},
- }
- }
- if ptrType.Implements(textUnmarshalerType) {
- return &referenceDecoder{
- &textUnmarshalerDecoder{ptrType},
- }
- }
- return nil
-}
-
-func createEncoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValEncoder {
- if typ == marshalerType {
- checkIsEmpty := createCheckIsEmpty(ctx, typ)
- var encoder ValEncoder = &directMarshalerEncoder{
- checkIsEmpty: checkIsEmpty,
- }
- return encoder
- }
- if typ.Implements(marshalerType) {
- checkIsEmpty := createCheckIsEmpty(ctx, typ)
- var encoder ValEncoder = &marshalerEncoder{
- valType: typ,
- checkIsEmpty: checkIsEmpty,
- }
- return encoder
- }
- ptrType := reflect2.PtrTo(typ)
- if ctx.prefix != "" && ptrType.Implements(marshalerType) {
- checkIsEmpty := createCheckIsEmpty(ctx, ptrType)
- var encoder ValEncoder = &marshalerEncoder{
- valType: ptrType,
- checkIsEmpty: checkIsEmpty,
- }
- return &referenceEncoder{encoder}
- }
- if typ == textMarshalerType {
- checkIsEmpty := createCheckIsEmpty(ctx, typ)
- var encoder ValEncoder = &directTextMarshalerEncoder{
- checkIsEmpty: checkIsEmpty,
- stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
- }
- return encoder
- }
- if typ.Implements(textMarshalerType) {
- checkIsEmpty := createCheckIsEmpty(ctx, typ)
- var encoder ValEncoder = &textMarshalerEncoder{
- valType: typ,
- stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
- checkIsEmpty: checkIsEmpty,
- }
- return encoder
- }
- // if prefix is empty, the type is the root type
- if ctx.prefix != "" && ptrType.Implements(textMarshalerType) {
- checkIsEmpty := createCheckIsEmpty(ctx, ptrType)
- var encoder ValEncoder = &textMarshalerEncoder{
- valType: ptrType,
- stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")),
- checkIsEmpty: checkIsEmpty,
- }
- return &referenceEncoder{encoder}
- }
- return nil
-}
-
-type marshalerEncoder struct {
- checkIsEmpty checkIsEmpty
- valType reflect2.Type
-}
-
-func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- obj := encoder.valType.UnsafeIndirect(ptr)
- if encoder.valType.IsNullable() && reflect2.IsNil(obj) {
- stream.WriteNil()
- return
- }
- marshaler := obj.(json.Marshaler)
- bytes, err := marshaler.MarshalJSON()
- if err != nil {
- stream.Error = err
- } else {
- stream.Write(bytes)
- }
-}
-
-func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.checkIsEmpty.IsEmpty(ptr)
-}
-
-type directMarshalerEncoder struct {
- checkIsEmpty checkIsEmpty
-}
-
-func (encoder *directMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- marshaler := *(*json.Marshaler)(ptr)
- if marshaler == nil {
- stream.WriteNil()
- return
- }
- bytes, err := marshaler.MarshalJSON()
- if err != nil {
- stream.Error = err
- } else {
- stream.Write(bytes)
- }
-}
-
-func (encoder *directMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.checkIsEmpty.IsEmpty(ptr)
-}
-
-type textMarshalerEncoder struct {
- valType reflect2.Type
- stringEncoder ValEncoder
- checkIsEmpty checkIsEmpty
-}
-
-func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- obj := encoder.valType.UnsafeIndirect(ptr)
- if encoder.valType.IsNullable() && reflect2.IsNil(obj) {
- stream.WriteNil()
- return
- }
- marshaler := (obj).(encoding.TextMarshaler)
- bytes, err := marshaler.MarshalText()
- if err != nil {
- stream.Error = err
- } else {
- str := string(bytes)
- encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream)
- }
-}
-
-func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.checkIsEmpty.IsEmpty(ptr)
-}
-
-type directTextMarshalerEncoder struct {
- stringEncoder ValEncoder
- checkIsEmpty checkIsEmpty
-}
-
-func (encoder *directTextMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- marshaler := *(*encoding.TextMarshaler)(ptr)
- if marshaler == nil {
- stream.WriteNil()
- return
- }
- bytes, err := marshaler.MarshalText()
- if err != nil {
- stream.Error = err
- } else {
- str := string(bytes)
- encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream)
- }
-}
-
-func (encoder *directTextMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.checkIsEmpty.IsEmpty(ptr)
-}
-
-type unmarshalerDecoder struct {
- valType reflect2.Type
-}
-
-func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- valType := decoder.valType
- obj := valType.UnsafeIndirect(ptr)
- unmarshaler := obj.(json.Unmarshaler)
- iter.nextToken()
- iter.unreadByte() // skip spaces
- bytes := iter.SkipAndReturnBytes()
- err := unmarshaler.UnmarshalJSON(bytes)
- if err != nil {
- iter.ReportError("unmarshalerDecoder", err.Error())
- }
-}
-
-type textUnmarshalerDecoder struct {
- valType reflect2.Type
-}
-
-func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- valType := decoder.valType
- obj := valType.UnsafeIndirect(ptr)
- if reflect2.IsNil(obj) {
- ptrType := valType.(*reflect2.UnsafePtrType)
- elemType := ptrType.Elem()
- elem := elemType.UnsafeNew()
- ptrType.UnsafeSet(ptr, unsafe.Pointer(&elem))
- obj = valType.UnsafeIndirect(ptr)
- }
- unmarshaler := (obj).(encoding.TextUnmarshaler)
- str := iter.ReadString()
- err := unmarshaler.UnmarshalText([]byte(str))
- if err != nil {
- iter.ReportError("textUnmarshalerDecoder", err.Error())
- }
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_native.go b/vendor/github.com/json-iterator/go/reflect_native.go
deleted file mode 100644
index 9042eb0c..00000000
--- a/vendor/github.com/json-iterator/go/reflect_native.go
+++ /dev/null
@@ -1,451 +0,0 @@
-package jsoniter
-
-import (
- "encoding/base64"
- "reflect"
- "strconv"
- "unsafe"
-
- "github.com/modern-go/reflect2"
-)
-
-const ptrSize = 32 << uintptr(^uintptr(0)>>63)
-
-func createEncoderOfNative(ctx *ctx, typ reflect2.Type) ValEncoder {
- if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 {
- sliceDecoder := decoderOfSlice(ctx, typ)
- return &base64Codec{sliceDecoder: sliceDecoder}
- }
- typeName := typ.String()
- kind := typ.Kind()
- switch kind {
- case reflect.String:
- if typeName != "string" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem())
- }
- return &stringCodec{}
- case reflect.Int:
- if typeName != "int" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem())
- }
- if strconv.IntSize == 32 {
- return &int32Codec{}
- }
- return &int64Codec{}
- case reflect.Int8:
- if typeName != "int8" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem())
- }
- return &int8Codec{}
- case reflect.Int16:
- if typeName != "int16" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem())
- }
- return &int16Codec{}
- case reflect.Int32:
- if typeName != "int32" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem())
- }
- return &int32Codec{}
- case reflect.Int64:
- if typeName != "int64" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem())
- }
- return &int64Codec{}
- case reflect.Uint:
- if typeName != "uint" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem())
- }
- if strconv.IntSize == 32 {
- return &uint32Codec{}
- }
- return &uint64Codec{}
- case reflect.Uint8:
- if typeName != "uint8" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem())
- }
- return &uint8Codec{}
- case reflect.Uint16:
- if typeName != "uint16" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem())
- }
- return &uint16Codec{}
- case reflect.Uint32:
- if typeName != "uint32" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem())
- }
- return &uint32Codec{}
- case reflect.Uintptr:
- if typeName != "uintptr" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem())
- }
- if ptrSize == 32 {
- return &uint32Codec{}
- }
- return &uint64Codec{}
- case reflect.Uint64:
- if typeName != "uint64" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem())
- }
- return &uint64Codec{}
- case reflect.Float32:
- if typeName != "float32" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem())
- }
- return &float32Codec{}
- case reflect.Float64:
- if typeName != "float64" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem())
- }
- return &float64Codec{}
- case reflect.Bool:
- if typeName != "bool" {
- return encoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem())
- }
- return &boolCodec{}
- }
- return nil
-}
-
-func createDecoderOfNative(ctx *ctx, typ reflect2.Type) ValDecoder {
- if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 {
- sliceDecoder := decoderOfSlice(ctx, typ)
- return &base64Codec{sliceDecoder: sliceDecoder}
- }
- typeName := typ.String()
- switch typ.Kind() {
- case reflect.String:
- if typeName != "string" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem())
- }
- return &stringCodec{}
- case reflect.Int:
- if typeName != "int" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem())
- }
- if strconv.IntSize == 32 {
- return &int32Codec{}
- }
- return &int64Codec{}
- case reflect.Int8:
- if typeName != "int8" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem())
- }
- return &int8Codec{}
- case reflect.Int16:
- if typeName != "int16" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem())
- }
- return &int16Codec{}
- case reflect.Int32:
- if typeName != "int32" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem())
- }
- return &int32Codec{}
- case reflect.Int64:
- if typeName != "int64" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem())
- }
- return &int64Codec{}
- case reflect.Uint:
- if typeName != "uint" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem())
- }
- if strconv.IntSize == 32 {
- return &uint32Codec{}
- }
- return &uint64Codec{}
- case reflect.Uint8:
- if typeName != "uint8" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem())
- }
- return &uint8Codec{}
- case reflect.Uint16:
- if typeName != "uint16" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem())
- }
- return &uint16Codec{}
- case reflect.Uint32:
- if typeName != "uint32" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem())
- }
- return &uint32Codec{}
- case reflect.Uintptr:
- if typeName != "uintptr" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem())
- }
- if ptrSize == 32 {
- return &uint32Codec{}
- }
- return &uint64Codec{}
- case reflect.Uint64:
- if typeName != "uint64" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem())
- }
- return &uint64Codec{}
- case reflect.Float32:
- if typeName != "float32" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem())
- }
- return &float32Codec{}
- case reflect.Float64:
- if typeName != "float64" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem())
- }
- return &float64Codec{}
- case reflect.Bool:
- if typeName != "bool" {
- return decoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem())
- }
- return &boolCodec{}
- }
- return nil
-}
-
-type stringCodec struct {
-}
-
-func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- *((*string)(ptr)) = iter.ReadString()
-}
-
-func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
- str := *((*string)(ptr))
- stream.WriteString(str)
-}
-
-func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*string)(ptr)) == ""
-}
-
-type int8Codec struct {
-}
-
-func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*int8)(ptr)) = iter.ReadInt8()
- }
-}
-
-func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteInt8(*((*int8)(ptr)))
-}
-
-func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*int8)(ptr)) == 0
-}
-
-type int16Codec struct {
-}
-
-func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*int16)(ptr)) = iter.ReadInt16()
- }
-}
-
-func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteInt16(*((*int16)(ptr)))
-}
-
-func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*int16)(ptr)) == 0
-}
-
-type int32Codec struct {
-}
-
-func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*int32)(ptr)) = iter.ReadInt32()
- }
-}
-
-func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteInt32(*((*int32)(ptr)))
-}
-
-func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*int32)(ptr)) == 0
-}
-
-type int64Codec struct {
-}
-
-func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*int64)(ptr)) = iter.ReadInt64()
- }
-}
-
-func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteInt64(*((*int64)(ptr)))
-}
-
-func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*int64)(ptr)) == 0
-}
-
-type uint8Codec struct {
-}
-
-func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*uint8)(ptr)) = iter.ReadUint8()
- }
-}
-
-func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteUint8(*((*uint8)(ptr)))
-}
-
-func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*uint8)(ptr)) == 0
-}
-
-type uint16Codec struct {
-}
-
-func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*uint16)(ptr)) = iter.ReadUint16()
- }
-}
-
-func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteUint16(*((*uint16)(ptr)))
-}
-
-func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*uint16)(ptr)) == 0
-}
-
-type uint32Codec struct {
-}
-
-func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*uint32)(ptr)) = iter.ReadUint32()
- }
-}
-
-func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteUint32(*((*uint32)(ptr)))
-}
-
-func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*uint32)(ptr)) == 0
-}
-
-type uint64Codec struct {
-}
-
-func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*uint64)(ptr)) = iter.ReadUint64()
- }
-}
-
-func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteUint64(*((*uint64)(ptr)))
-}
-
-func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*uint64)(ptr)) == 0
-}
-
-type float32Codec struct {
-}
-
-func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*float32)(ptr)) = iter.ReadFloat32()
- }
-}
-
-func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteFloat32(*((*float32)(ptr)))
-}
-
-func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*float32)(ptr)) == 0
-}
-
-type float64Codec struct {
-}
-
-func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*float64)(ptr)) = iter.ReadFloat64()
- }
-}
-
-func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteFloat64(*((*float64)(ptr)))
-}
-
-func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*float64)(ptr)) == 0
-}
-
-type boolCodec struct {
-}
-
-func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.ReadNil() {
- *((*bool)(ptr)) = iter.ReadBool()
- }
-}
-
-func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteBool(*((*bool)(ptr)))
-}
-
-func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool {
- return !(*((*bool)(ptr)))
-}
-
-type base64Codec struct {
- sliceType *reflect2.UnsafeSliceType
- sliceDecoder ValDecoder
-}
-
-func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if iter.ReadNil() {
- codec.sliceType.UnsafeSetNil(ptr)
- return
- }
- switch iter.WhatIsNext() {
- case StringValue:
- src := iter.ReadString()
- dst, err := base64.StdEncoding.DecodeString(src)
- if err != nil {
- iter.ReportError("decode base64", err.Error())
- } else {
- codec.sliceType.UnsafeSet(ptr, unsafe.Pointer(&dst))
- }
- case ArrayValue:
- codec.sliceDecoder.Decode(ptr, iter)
- default:
- iter.ReportError("base64Codec", "invalid input")
- }
-}
-
-func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) {
- src := *((*[]byte)(ptr))
- if len(src) == 0 {
- stream.WriteNil()
- return
- }
- encoding := base64.StdEncoding
- stream.writeByte('"')
- size := encoding.EncodedLen(len(src))
- buf := make([]byte, size)
- encoding.Encode(buf, src)
- stream.buf = append(stream.buf, buf...)
- stream.writeByte('"')
-}
-
-func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool {
- return len(*((*[]byte)(ptr))) == 0
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_optional.go b/vendor/github.com/json-iterator/go/reflect_optional.go
deleted file mode 100644
index 43ec71d6..00000000
--- a/vendor/github.com/json-iterator/go/reflect_optional.go
+++ /dev/null
@@ -1,133 +0,0 @@
-package jsoniter
-
-import (
- "github.com/modern-go/reflect2"
- "reflect"
- "unsafe"
-)
-
-func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder {
- ptrType := typ.(*reflect2.UnsafePtrType)
- elemType := ptrType.Elem()
- decoder := decoderOfType(ctx, elemType)
- if ctx.prefix == "" && elemType.Kind() == reflect.Ptr {
- return &dereferenceDecoder{elemType, decoder}
- }
- return &OptionalDecoder{elemType, decoder}
-}
-
-func encoderOfOptional(ctx *ctx, typ reflect2.Type) ValEncoder {
- ptrType := typ.(*reflect2.UnsafePtrType)
- elemType := ptrType.Elem()
- elemEncoder := encoderOfType(ctx, elemType)
- encoder := &OptionalEncoder{elemEncoder}
- return encoder
-}
-
-type OptionalDecoder struct {
- ValueType reflect2.Type
- ValueDecoder ValDecoder
-}
-
-func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if iter.ReadNil() {
- *((*unsafe.Pointer)(ptr)) = nil
- } else {
- if *((*unsafe.Pointer)(ptr)) == nil {
- //pointer to null, we have to allocate memory to hold the value
- newPtr := decoder.ValueType.UnsafeNew()
- decoder.ValueDecoder.Decode(newPtr, iter)
- *((*unsafe.Pointer)(ptr)) = newPtr
- } else {
- //reuse existing instance
- decoder.ValueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter)
- }
- }
-}
-
-type dereferenceDecoder struct {
- // only to deference a pointer
- valueType reflect2.Type
- valueDecoder ValDecoder
-}
-
-func (decoder *dereferenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if *((*unsafe.Pointer)(ptr)) == nil {
- //pointer to null, we have to allocate memory to hold the value
- newPtr := decoder.valueType.UnsafeNew()
- decoder.valueDecoder.Decode(newPtr, iter)
- *((*unsafe.Pointer)(ptr)) = newPtr
- } else {
- //reuse existing instance
- decoder.valueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter)
- }
-}
-
-type OptionalEncoder struct {
- ValueEncoder ValEncoder
-}
-
-func (encoder *OptionalEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- if *((*unsafe.Pointer)(ptr)) == nil {
- stream.WriteNil()
- } else {
- encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream)
- }
-}
-
-func (encoder *OptionalEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return *((*unsafe.Pointer)(ptr)) == nil
-}
-
-type dereferenceEncoder struct {
- ValueEncoder ValEncoder
-}
-
-func (encoder *dereferenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- if *((*unsafe.Pointer)(ptr)) == nil {
- stream.WriteNil()
- } else {
- encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream)
- }
-}
-
-func (encoder *dereferenceEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- dePtr := *((*unsafe.Pointer)(ptr))
- if dePtr == nil {
- return true
- }
- return encoder.ValueEncoder.IsEmpty(dePtr)
-}
-
-func (encoder *dereferenceEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool {
- deReferenced := *((*unsafe.Pointer)(ptr))
- if deReferenced == nil {
- return true
- }
- isEmbeddedPtrNil, converted := encoder.ValueEncoder.(IsEmbeddedPtrNil)
- if !converted {
- return false
- }
- fieldPtr := unsafe.Pointer(deReferenced)
- return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr)
-}
-
-type referenceEncoder struct {
- encoder ValEncoder
-}
-
-func (encoder *referenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- encoder.encoder.Encode(unsafe.Pointer(&ptr), stream)
-}
-
-func (encoder *referenceEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr))
-}
-
-type referenceDecoder struct {
- decoder ValDecoder
-}
-
-func (decoder *referenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- decoder.decoder.Decode(unsafe.Pointer(&ptr), iter)
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_slice.go b/vendor/github.com/json-iterator/go/reflect_slice.go
deleted file mode 100644
index 9441d79d..00000000
--- a/vendor/github.com/json-iterator/go/reflect_slice.go
+++ /dev/null
@@ -1,99 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "github.com/modern-go/reflect2"
- "io"
- "unsafe"
-)
-
-func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder {
- sliceType := typ.(*reflect2.UnsafeSliceType)
- decoder := decoderOfType(ctx.append("[sliceElem]"), sliceType.Elem())
- return &sliceDecoder{sliceType, decoder}
-}
-
-func encoderOfSlice(ctx *ctx, typ reflect2.Type) ValEncoder {
- sliceType := typ.(*reflect2.UnsafeSliceType)
- encoder := encoderOfType(ctx.append("[sliceElem]"), sliceType.Elem())
- return &sliceEncoder{sliceType, encoder}
-}
-
-type sliceEncoder struct {
- sliceType *reflect2.UnsafeSliceType
- elemEncoder ValEncoder
-}
-
-func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- if encoder.sliceType.UnsafeIsNil(ptr) {
- stream.WriteNil()
- return
- }
- length := encoder.sliceType.UnsafeLengthOf(ptr)
- if length == 0 {
- stream.WriteEmptyArray()
- return
- }
- stream.WriteArrayStart()
- encoder.elemEncoder.Encode(encoder.sliceType.UnsafeGetIndex(ptr, 0), stream)
- for i := 1; i < length; i++ {
- stream.WriteMore()
- elemPtr := encoder.sliceType.UnsafeGetIndex(ptr, i)
- encoder.elemEncoder.Encode(elemPtr, stream)
- }
- stream.WriteArrayEnd()
- if stream.Error != nil && stream.Error != io.EOF {
- stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error())
- }
-}
-
-func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.sliceType.UnsafeLengthOf(ptr) == 0
-}
-
-type sliceDecoder struct {
- sliceType *reflect2.UnsafeSliceType
- elemDecoder ValDecoder
-}
-
-func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- decoder.doDecode(ptr, iter)
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error())
- }
-}
-
-func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) {
- c := iter.nextToken()
- sliceType := decoder.sliceType
- if c == 'n' {
- iter.skipThreeBytes('u', 'l', 'l')
- sliceType.UnsafeSetNil(ptr)
- return
- }
- if c != '[' {
- iter.ReportError("decode slice", "expect [ or n, but found "+string([]byte{c}))
- return
- }
- c = iter.nextToken()
- if c == ']' {
- sliceType.UnsafeSet(ptr, sliceType.UnsafeMakeSlice(0, 0))
- return
- }
- iter.unreadByte()
- sliceType.UnsafeGrow(ptr, 1)
- elemPtr := sliceType.UnsafeGetIndex(ptr, 0)
- decoder.elemDecoder.Decode(elemPtr, iter)
- length := 1
- for c = iter.nextToken(); c == ','; c = iter.nextToken() {
- idx := length
- length += 1
- sliceType.UnsafeGrow(ptr, length)
- elemPtr = sliceType.UnsafeGetIndex(ptr, idx)
- decoder.elemDecoder.Decode(elemPtr, iter)
- }
- if c != ']' {
- iter.ReportError("decode slice", "expect ], but found "+string([]byte{c}))
- return
- }
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go
deleted file mode 100644
index 355d2d11..00000000
--- a/vendor/github.com/json-iterator/go/reflect_struct_decoder.go
+++ /dev/null
@@ -1,1048 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "io"
- "strings"
- "unsafe"
-
- "github.com/modern-go/reflect2"
-)
-
-func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder {
- bindings := map[string]*Binding{}
- structDescriptor := describeStruct(ctx, typ)
- for _, binding := range structDescriptor.Fields {
- for _, fromName := range binding.FromNames {
- old := bindings[fromName]
- if old == nil {
- bindings[fromName] = binding
- continue
- }
- ignoreOld, ignoreNew := resolveConflictBinding(ctx.frozenConfig, old, binding)
- if ignoreOld {
- delete(bindings, fromName)
- }
- if !ignoreNew {
- bindings[fromName] = binding
- }
- }
- }
- fields := map[string]*structFieldDecoder{}
- for k, binding := range bindings {
- fields[k] = binding.Decoder.(*structFieldDecoder)
- }
-
- if !ctx.caseSensitive() {
- for k, binding := range bindings {
- if _, found := fields[strings.ToLower(k)]; !found {
- fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder)
- }
- }
- }
-
- return createStructDecoder(ctx, typ, fields)
-}
-
-func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structFieldDecoder) ValDecoder {
- if ctx.disallowUnknownFields {
- return &generalStructDecoder{typ: typ, fields: fields, disallowUnknownFields: true}
- }
- knownHash := map[int64]struct{}{
- 0: {},
- }
-
- switch len(fields) {
- case 0:
- return &skipObjectDecoder{typ}
- case 1:
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- return &oneFieldStructDecoder{typ, fieldHash, fieldDecoder}
- }
- case 2:
- var fieldHash1 int64
- var fieldHash2 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldHash1 == 0 {
- fieldHash1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else {
- fieldHash2 = fieldHash
- fieldDecoder2 = fieldDecoder
- }
- }
- return &twoFieldsStructDecoder{typ, fieldHash1, fieldDecoder1, fieldHash2, fieldDecoder2}
- case 3:
- var fieldName1 int64
- var fieldName2 int64
- var fieldName3 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- var fieldDecoder3 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldName1 == 0 {
- fieldName1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else if fieldName2 == 0 {
- fieldName2 = fieldHash
- fieldDecoder2 = fieldDecoder
- } else {
- fieldName3 = fieldHash
- fieldDecoder3 = fieldDecoder
- }
- }
- return &threeFieldsStructDecoder{typ,
- fieldName1, fieldDecoder1,
- fieldName2, fieldDecoder2,
- fieldName3, fieldDecoder3}
- case 4:
- var fieldName1 int64
- var fieldName2 int64
- var fieldName3 int64
- var fieldName4 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- var fieldDecoder3 *structFieldDecoder
- var fieldDecoder4 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldName1 == 0 {
- fieldName1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else if fieldName2 == 0 {
- fieldName2 = fieldHash
- fieldDecoder2 = fieldDecoder
- } else if fieldName3 == 0 {
- fieldName3 = fieldHash
- fieldDecoder3 = fieldDecoder
- } else {
- fieldName4 = fieldHash
- fieldDecoder4 = fieldDecoder
- }
- }
- return &fourFieldsStructDecoder{typ,
- fieldName1, fieldDecoder1,
- fieldName2, fieldDecoder2,
- fieldName3, fieldDecoder3,
- fieldName4, fieldDecoder4}
- case 5:
- var fieldName1 int64
- var fieldName2 int64
- var fieldName3 int64
- var fieldName4 int64
- var fieldName5 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- var fieldDecoder3 *structFieldDecoder
- var fieldDecoder4 *structFieldDecoder
- var fieldDecoder5 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldName1 == 0 {
- fieldName1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else if fieldName2 == 0 {
- fieldName2 = fieldHash
- fieldDecoder2 = fieldDecoder
- } else if fieldName3 == 0 {
- fieldName3 = fieldHash
- fieldDecoder3 = fieldDecoder
- } else if fieldName4 == 0 {
- fieldName4 = fieldHash
- fieldDecoder4 = fieldDecoder
- } else {
- fieldName5 = fieldHash
- fieldDecoder5 = fieldDecoder
- }
- }
- return &fiveFieldsStructDecoder{typ,
- fieldName1, fieldDecoder1,
- fieldName2, fieldDecoder2,
- fieldName3, fieldDecoder3,
- fieldName4, fieldDecoder4,
- fieldName5, fieldDecoder5}
- case 6:
- var fieldName1 int64
- var fieldName2 int64
- var fieldName3 int64
- var fieldName4 int64
- var fieldName5 int64
- var fieldName6 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- var fieldDecoder3 *structFieldDecoder
- var fieldDecoder4 *structFieldDecoder
- var fieldDecoder5 *structFieldDecoder
- var fieldDecoder6 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldName1 == 0 {
- fieldName1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else if fieldName2 == 0 {
- fieldName2 = fieldHash
- fieldDecoder2 = fieldDecoder
- } else if fieldName3 == 0 {
- fieldName3 = fieldHash
- fieldDecoder3 = fieldDecoder
- } else if fieldName4 == 0 {
- fieldName4 = fieldHash
- fieldDecoder4 = fieldDecoder
- } else if fieldName5 == 0 {
- fieldName5 = fieldHash
- fieldDecoder5 = fieldDecoder
- } else {
- fieldName6 = fieldHash
- fieldDecoder6 = fieldDecoder
- }
- }
- return &sixFieldsStructDecoder{typ,
- fieldName1, fieldDecoder1,
- fieldName2, fieldDecoder2,
- fieldName3, fieldDecoder3,
- fieldName4, fieldDecoder4,
- fieldName5, fieldDecoder5,
- fieldName6, fieldDecoder6}
- case 7:
- var fieldName1 int64
- var fieldName2 int64
- var fieldName3 int64
- var fieldName4 int64
- var fieldName5 int64
- var fieldName6 int64
- var fieldName7 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- var fieldDecoder3 *structFieldDecoder
- var fieldDecoder4 *structFieldDecoder
- var fieldDecoder5 *structFieldDecoder
- var fieldDecoder6 *structFieldDecoder
- var fieldDecoder7 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldName1 == 0 {
- fieldName1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else if fieldName2 == 0 {
- fieldName2 = fieldHash
- fieldDecoder2 = fieldDecoder
- } else if fieldName3 == 0 {
- fieldName3 = fieldHash
- fieldDecoder3 = fieldDecoder
- } else if fieldName4 == 0 {
- fieldName4 = fieldHash
- fieldDecoder4 = fieldDecoder
- } else if fieldName5 == 0 {
- fieldName5 = fieldHash
- fieldDecoder5 = fieldDecoder
- } else if fieldName6 == 0 {
- fieldName6 = fieldHash
- fieldDecoder6 = fieldDecoder
- } else {
- fieldName7 = fieldHash
- fieldDecoder7 = fieldDecoder
- }
- }
- return &sevenFieldsStructDecoder{typ,
- fieldName1, fieldDecoder1,
- fieldName2, fieldDecoder2,
- fieldName3, fieldDecoder3,
- fieldName4, fieldDecoder4,
- fieldName5, fieldDecoder5,
- fieldName6, fieldDecoder6,
- fieldName7, fieldDecoder7}
- case 8:
- var fieldName1 int64
- var fieldName2 int64
- var fieldName3 int64
- var fieldName4 int64
- var fieldName5 int64
- var fieldName6 int64
- var fieldName7 int64
- var fieldName8 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- var fieldDecoder3 *structFieldDecoder
- var fieldDecoder4 *structFieldDecoder
- var fieldDecoder5 *structFieldDecoder
- var fieldDecoder6 *structFieldDecoder
- var fieldDecoder7 *structFieldDecoder
- var fieldDecoder8 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldName1 == 0 {
- fieldName1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else if fieldName2 == 0 {
- fieldName2 = fieldHash
- fieldDecoder2 = fieldDecoder
- } else if fieldName3 == 0 {
- fieldName3 = fieldHash
- fieldDecoder3 = fieldDecoder
- } else if fieldName4 == 0 {
- fieldName4 = fieldHash
- fieldDecoder4 = fieldDecoder
- } else if fieldName5 == 0 {
- fieldName5 = fieldHash
- fieldDecoder5 = fieldDecoder
- } else if fieldName6 == 0 {
- fieldName6 = fieldHash
- fieldDecoder6 = fieldDecoder
- } else if fieldName7 == 0 {
- fieldName7 = fieldHash
- fieldDecoder7 = fieldDecoder
- } else {
- fieldName8 = fieldHash
- fieldDecoder8 = fieldDecoder
- }
- }
- return &eightFieldsStructDecoder{typ,
- fieldName1, fieldDecoder1,
- fieldName2, fieldDecoder2,
- fieldName3, fieldDecoder3,
- fieldName4, fieldDecoder4,
- fieldName5, fieldDecoder5,
- fieldName6, fieldDecoder6,
- fieldName7, fieldDecoder7,
- fieldName8, fieldDecoder8}
- case 9:
- var fieldName1 int64
- var fieldName2 int64
- var fieldName3 int64
- var fieldName4 int64
- var fieldName5 int64
- var fieldName6 int64
- var fieldName7 int64
- var fieldName8 int64
- var fieldName9 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- var fieldDecoder3 *structFieldDecoder
- var fieldDecoder4 *structFieldDecoder
- var fieldDecoder5 *structFieldDecoder
- var fieldDecoder6 *structFieldDecoder
- var fieldDecoder7 *structFieldDecoder
- var fieldDecoder8 *structFieldDecoder
- var fieldDecoder9 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldName1 == 0 {
- fieldName1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else if fieldName2 == 0 {
- fieldName2 = fieldHash
- fieldDecoder2 = fieldDecoder
- } else if fieldName3 == 0 {
- fieldName3 = fieldHash
- fieldDecoder3 = fieldDecoder
- } else if fieldName4 == 0 {
- fieldName4 = fieldHash
- fieldDecoder4 = fieldDecoder
- } else if fieldName5 == 0 {
- fieldName5 = fieldHash
- fieldDecoder5 = fieldDecoder
- } else if fieldName6 == 0 {
- fieldName6 = fieldHash
- fieldDecoder6 = fieldDecoder
- } else if fieldName7 == 0 {
- fieldName7 = fieldHash
- fieldDecoder7 = fieldDecoder
- } else if fieldName8 == 0 {
- fieldName8 = fieldHash
- fieldDecoder8 = fieldDecoder
- } else {
- fieldName9 = fieldHash
- fieldDecoder9 = fieldDecoder
- }
- }
- return &nineFieldsStructDecoder{typ,
- fieldName1, fieldDecoder1,
- fieldName2, fieldDecoder2,
- fieldName3, fieldDecoder3,
- fieldName4, fieldDecoder4,
- fieldName5, fieldDecoder5,
- fieldName6, fieldDecoder6,
- fieldName7, fieldDecoder7,
- fieldName8, fieldDecoder8,
- fieldName9, fieldDecoder9}
- case 10:
- var fieldName1 int64
- var fieldName2 int64
- var fieldName3 int64
- var fieldName4 int64
- var fieldName5 int64
- var fieldName6 int64
- var fieldName7 int64
- var fieldName8 int64
- var fieldName9 int64
- var fieldName10 int64
- var fieldDecoder1 *structFieldDecoder
- var fieldDecoder2 *structFieldDecoder
- var fieldDecoder3 *structFieldDecoder
- var fieldDecoder4 *structFieldDecoder
- var fieldDecoder5 *structFieldDecoder
- var fieldDecoder6 *structFieldDecoder
- var fieldDecoder7 *structFieldDecoder
- var fieldDecoder8 *structFieldDecoder
- var fieldDecoder9 *structFieldDecoder
- var fieldDecoder10 *structFieldDecoder
- for fieldName, fieldDecoder := range fields {
- fieldHash := calcHash(fieldName, ctx.caseSensitive())
- _, known := knownHash[fieldHash]
- if known {
- return &generalStructDecoder{typ, fields, false}
- }
- knownHash[fieldHash] = struct{}{}
- if fieldName1 == 0 {
- fieldName1 = fieldHash
- fieldDecoder1 = fieldDecoder
- } else if fieldName2 == 0 {
- fieldName2 = fieldHash
- fieldDecoder2 = fieldDecoder
- } else if fieldName3 == 0 {
- fieldName3 = fieldHash
- fieldDecoder3 = fieldDecoder
- } else if fieldName4 == 0 {
- fieldName4 = fieldHash
- fieldDecoder4 = fieldDecoder
- } else if fieldName5 == 0 {
- fieldName5 = fieldHash
- fieldDecoder5 = fieldDecoder
- } else if fieldName6 == 0 {
- fieldName6 = fieldHash
- fieldDecoder6 = fieldDecoder
- } else if fieldName7 == 0 {
- fieldName7 = fieldHash
- fieldDecoder7 = fieldDecoder
- } else if fieldName8 == 0 {
- fieldName8 = fieldHash
- fieldDecoder8 = fieldDecoder
- } else if fieldName9 == 0 {
- fieldName9 = fieldHash
- fieldDecoder9 = fieldDecoder
- } else {
- fieldName10 = fieldHash
- fieldDecoder10 = fieldDecoder
- }
- }
- return &tenFieldsStructDecoder{typ,
- fieldName1, fieldDecoder1,
- fieldName2, fieldDecoder2,
- fieldName3, fieldDecoder3,
- fieldName4, fieldDecoder4,
- fieldName5, fieldDecoder5,
- fieldName6, fieldDecoder6,
- fieldName7, fieldDecoder7,
- fieldName8, fieldDecoder8,
- fieldName9, fieldDecoder9,
- fieldName10, fieldDecoder10}
- }
- return &generalStructDecoder{typ, fields, false}
-}
-
-type generalStructDecoder struct {
- typ reflect2.Type
- fields map[string]*structFieldDecoder
- disallowUnknownFields bool
-}
-
-func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- var c byte
- for c = ','; c == ','; c = iter.nextToken() {
- decoder.decodeOneField(ptr, iter)
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
- if c != '}' {
- iter.ReportError("struct Decode", `expect }, but found `+string([]byte{c}))
- }
-}
-
-func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *Iterator) {
- var field string
- var fieldDecoder *structFieldDecoder
- if iter.cfg.objectFieldMustBeSimpleString {
- fieldBytes := iter.ReadStringAsSlice()
- field = *(*string)(unsafe.Pointer(&fieldBytes))
- fieldDecoder = decoder.fields[field]
- if fieldDecoder == nil && !iter.cfg.caseSensitive {
- fieldDecoder = decoder.fields[strings.ToLower(field)]
- }
- } else {
- field = iter.ReadString()
- fieldDecoder = decoder.fields[field]
- if fieldDecoder == nil && !iter.cfg.caseSensitive {
- fieldDecoder = decoder.fields[strings.ToLower(field)]
- }
- }
- if fieldDecoder == nil {
- msg := "found unknown field: " + field
- if decoder.disallowUnknownFields {
- iter.ReportError("ReadObject", msg)
- }
- c := iter.nextToken()
- if c != ':' {
- iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c}))
- }
- iter.Skip()
- return
- }
- c := iter.nextToken()
- if c != ':' {
- iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c}))
- }
- fieldDecoder.Decode(ptr, iter)
-}
-
-type skipObjectDecoder struct {
- typ reflect2.Type
-}
-
-func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- valueType := iter.WhatIsNext()
- if valueType != ObjectValue && valueType != NilValue {
- iter.ReportError("skipObjectDecoder", "expect object or null")
- return
- }
- iter.Skip()
-}
-
-type oneFieldStructDecoder struct {
- typ reflect2.Type
- fieldHash int64
- fieldDecoder *structFieldDecoder
-}
-
-func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- if iter.readFieldHash() == decoder.fieldHash {
- decoder.fieldDecoder.Decode(ptr, iter)
- } else {
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type twoFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
-}
-
-func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type threeFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
- fieldHash3 int64
- fieldDecoder3 *structFieldDecoder
-}
-
-func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- case decoder.fieldHash3:
- decoder.fieldDecoder3.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type fourFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
- fieldHash3 int64
- fieldDecoder3 *structFieldDecoder
- fieldHash4 int64
- fieldDecoder4 *structFieldDecoder
-}
-
-func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- case decoder.fieldHash3:
- decoder.fieldDecoder3.Decode(ptr, iter)
- case decoder.fieldHash4:
- decoder.fieldDecoder4.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type fiveFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
- fieldHash3 int64
- fieldDecoder3 *structFieldDecoder
- fieldHash4 int64
- fieldDecoder4 *structFieldDecoder
- fieldHash5 int64
- fieldDecoder5 *structFieldDecoder
-}
-
-func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- case decoder.fieldHash3:
- decoder.fieldDecoder3.Decode(ptr, iter)
- case decoder.fieldHash4:
- decoder.fieldDecoder4.Decode(ptr, iter)
- case decoder.fieldHash5:
- decoder.fieldDecoder5.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type sixFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
- fieldHash3 int64
- fieldDecoder3 *structFieldDecoder
- fieldHash4 int64
- fieldDecoder4 *structFieldDecoder
- fieldHash5 int64
- fieldDecoder5 *structFieldDecoder
- fieldHash6 int64
- fieldDecoder6 *structFieldDecoder
-}
-
-func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- case decoder.fieldHash3:
- decoder.fieldDecoder3.Decode(ptr, iter)
- case decoder.fieldHash4:
- decoder.fieldDecoder4.Decode(ptr, iter)
- case decoder.fieldHash5:
- decoder.fieldDecoder5.Decode(ptr, iter)
- case decoder.fieldHash6:
- decoder.fieldDecoder6.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type sevenFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
- fieldHash3 int64
- fieldDecoder3 *structFieldDecoder
- fieldHash4 int64
- fieldDecoder4 *structFieldDecoder
- fieldHash5 int64
- fieldDecoder5 *structFieldDecoder
- fieldHash6 int64
- fieldDecoder6 *structFieldDecoder
- fieldHash7 int64
- fieldDecoder7 *structFieldDecoder
-}
-
-func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- case decoder.fieldHash3:
- decoder.fieldDecoder3.Decode(ptr, iter)
- case decoder.fieldHash4:
- decoder.fieldDecoder4.Decode(ptr, iter)
- case decoder.fieldHash5:
- decoder.fieldDecoder5.Decode(ptr, iter)
- case decoder.fieldHash6:
- decoder.fieldDecoder6.Decode(ptr, iter)
- case decoder.fieldHash7:
- decoder.fieldDecoder7.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type eightFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
- fieldHash3 int64
- fieldDecoder3 *structFieldDecoder
- fieldHash4 int64
- fieldDecoder4 *structFieldDecoder
- fieldHash5 int64
- fieldDecoder5 *structFieldDecoder
- fieldHash6 int64
- fieldDecoder6 *structFieldDecoder
- fieldHash7 int64
- fieldDecoder7 *structFieldDecoder
- fieldHash8 int64
- fieldDecoder8 *structFieldDecoder
-}
-
-func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- case decoder.fieldHash3:
- decoder.fieldDecoder3.Decode(ptr, iter)
- case decoder.fieldHash4:
- decoder.fieldDecoder4.Decode(ptr, iter)
- case decoder.fieldHash5:
- decoder.fieldDecoder5.Decode(ptr, iter)
- case decoder.fieldHash6:
- decoder.fieldDecoder6.Decode(ptr, iter)
- case decoder.fieldHash7:
- decoder.fieldDecoder7.Decode(ptr, iter)
- case decoder.fieldHash8:
- decoder.fieldDecoder8.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type nineFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
- fieldHash3 int64
- fieldDecoder3 *structFieldDecoder
- fieldHash4 int64
- fieldDecoder4 *structFieldDecoder
- fieldHash5 int64
- fieldDecoder5 *structFieldDecoder
- fieldHash6 int64
- fieldDecoder6 *structFieldDecoder
- fieldHash7 int64
- fieldDecoder7 *structFieldDecoder
- fieldHash8 int64
- fieldDecoder8 *structFieldDecoder
- fieldHash9 int64
- fieldDecoder9 *structFieldDecoder
-}
-
-func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- case decoder.fieldHash3:
- decoder.fieldDecoder3.Decode(ptr, iter)
- case decoder.fieldHash4:
- decoder.fieldDecoder4.Decode(ptr, iter)
- case decoder.fieldHash5:
- decoder.fieldDecoder5.Decode(ptr, iter)
- case decoder.fieldHash6:
- decoder.fieldDecoder6.Decode(ptr, iter)
- case decoder.fieldHash7:
- decoder.fieldDecoder7.Decode(ptr, iter)
- case decoder.fieldHash8:
- decoder.fieldDecoder8.Decode(ptr, iter)
- case decoder.fieldHash9:
- decoder.fieldDecoder9.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type tenFieldsStructDecoder struct {
- typ reflect2.Type
- fieldHash1 int64
- fieldDecoder1 *structFieldDecoder
- fieldHash2 int64
- fieldDecoder2 *structFieldDecoder
- fieldHash3 int64
- fieldDecoder3 *structFieldDecoder
- fieldHash4 int64
- fieldDecoder4 *structFieldDecoder
- fieldHash5 int64
- fieldDecoder5 *structFieldDecoder
- fieldHash6 int64
- fieldDecoder6 *structFieldDecoder
- fieldHash7 int64
- fieldDecoder7 *structFieldDecoder
- fieldHash8 int64
- fieldDecoder8 *structFieldDecoder
- fieldHash9 int64
- fieldDecoder9 *structFieldDecoder
- fieldHash10 int64
- fieldDecoder10 *structFieldDecoder
-}
-
-func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- if !iter.readObjectStart() {
- return
- }
- for {
- switch iter.readFieldHash() {
- case decoder.fieldHash1:
- decoder.fieldDecoder1.Decode(ptr, iter)
- case decoder.fieldHash2:
- decoder.fieldDecoder2.Decode(ptr, iter)
- case decoder.fieldHash3:
- decoder.fieldDecoder3.Decode(ptr, iter)
- case decoder.fieldHash4:
- decoder.fieldDecoder4.Decode(ptr, iter)
- case decoder.fieldHash5:
- decoder.fieldDecoder5.Decode(ptr, iter)
- case decoder.fieldHash6:
- decoder.fieldDecoder6.Decode(ptr, iter)
- case decoder.fieldHash7:
- decoder.fieldDecoder7.Decode(ptr, iter)
- case decoder.fieldHash8:
- decoder.fieldDecoder8.Decode(ptr, iter)
- case decoder.fieldHash9:
- decoder.fieldDecoder9.Decode(ptr, iter)
- case decoder.fieldHash10:
- decoder.fieldDecoder10.Decode(ptr, iter)
- default:
- iter.Skip()
- }
- if iter.isObjectEnd() {
- break
- }
- }
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error())
- }
-}
-
-type structFieldDecoder struct {
- field reflect2.StructField
- fieldDecoder ValDecoder
-}
-
-func (decoder *structFieldDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- fieldPtr := decoder.field.UnsafeGet(ptr)
- decoder.fieldDecoder.Decode(fieldPtr, iter)
- if iter.Error != nil && iter.Error != io.EOF {
- iter.Error = fmt.Errorf("%s: %s", decoder.field.Name(), iter.Error.Error())
- }
-}
-
-type stringModeStringDecoder struct {
- elemDecoder ValDecoder
- cfg *frozenConfig
-}
-
-func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- decoder.elemDecoder.Decode(ptr, iter)
- str := *((*string)(ptr))
- tempIter := decoder.cfg.BorrowIterator([]byte(str))
- defer decoder.cfg.ReturnIterator(tempIter)
- *((*string)(ptr)) = tempIter.ReadString()
-}
-
-type stringModeNumberDecoder struct {
- elemDecoder ValDecoder
-}
-
-func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) {
- c := iter.nextToken()
- if c != '"' {
- iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c}))
- return
- }
- decoder.elemDecoder.Decode(ptr, iter)
- if iter.Error != nil {
- return
- }
- c = iter.readByte()
- if c != '"' {
- iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c}))
- return
- }
-}
diff --git a/vendor/github.com/json-iterator/go/reflect_struct_encoder.go b/vendor/github.com/json-iterator/go/reflect_struct_encoder.go
deleted file mode 100644
index d0759cf6..00000000
--- a/vendor/github.com/json-iterator/go/reflect_struct_encoder.go
+++ /dev/null
@@ -1,210 +0,0 @@
-package jsoniter
-
-import (
- "fmt"
- "github.com/modern-go/reflect2"
- "io"
- "reflect"
- "unsafe"
-)
-
-func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder {
- type bindingTo struct {
- binding *Binding
- toName string
- ignored bool
- }
- orderedBindings := []*bindingTo{}
- structDescriptor := describeStruct(ctx, typ)
- for _, binding := range structDescriptor.Fields {
- for _, toName := range binding.ToNames {
- new := &bindingTo{
- binding: binding,
- toName: toName,
- }
- for _, old := range orderedBindings {
- if old.toName != toName {
- continue
- }
- old.ignored, new.ignored = resolveConflictBinding(ctx.frozenConfig, old.binding, new.binding)
- }
- orderedBindings = append(orderedBindings, new)
- }
- }
- if len(orderedBindings) == 0 {
- return &emptyStructEncoder{}
- }
- finalOrderedFields := []structFieldTo{}
- for _, bindingTo := range orderedBindings {
- if !bindingTo.ignored {
- finalOrderedFields = append(finalOrderedFields, structFieldTo{
- encoder: bindingTo.binding.Encoder.(*structFieldEncoder),
- toName: bindingTo.toName,
- })
- }
- }
- return &structEncoder{typ, finalOrderedFields}
-}
-
-func createCheckIsEmpty(ctx *ctx, typ reflect2.Type) checkIsEmpty {
- encoder := createEncoderOfNative(ctx, typ)
- if encoder != nil {
- return encoder
- }
- kind := typ.Kind()
- switch kind {
- case reflect.Interface:
- return &dynamicEncoder{typ}
- case reflect.Struct:
- return &structEncoder{typ: typ}
- case reflect.Array:
- return &arrayEncoder{}
- case reflect.Slice:
- return &sliceEncoder{}
- case reflect.Map:
- return encoderOfMap(ctx, typ)
- case reflect.Ptr:
- return &OptionalEncoder{}
- default:
- return &lazyErrorEncoder{err: fmt.Errorf("unsupported type: %v", typ)}
- }
-}
-
-func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ignoreNew bool) {
- newTagged := new.Field.Tag().Get(cfg.getTagKey()) != ""
- oldTagged := old.Field.Tag().Get(cfg.getTagKey()) != ""
- if newTagged {
- if oldTagged {
- if len(old.levels) > len(new.levels) {
- return true, false
- } else if len(new.levels) > len(old.levels) {
- return false, true
- } else {
- return true, true
- }
- } else {
- return true, false
- }
- } else {
- if oldTagged {
- return true, false
- }
- if len(old.levels) > len(new.levels) {
- return true, false
- } else if len(new.levels) > len(old.levels) {
- return false, true
- } else {
- return true, true
- }
- }
-}
-
-type structFieldEncoder struct {
- field reflect2.StructField
- fieldEncoder ValEncoder
- omitempty bool
-}
-
-func (encoder *structFieldEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- fieldPtr := encoder.field.UnsafeGet(ptr)
- encoder.fieldEncoder.Encode(fieldPtr, stream)
- if stream.Error != nil && stream.Error != io.EOF {
- stream.Error = fmt.Errorf("%s: %s", encoder.field.Name(), stream.Error.Error())
- }
-}
-
-func (encoder *structFieldEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- fieldPtr := encoder.field.UnsafeGet(ptr)
- return encoder.fieldEncoder.IsEmpty(fieldPtr)
-}
-
-func (encoder *structFieldEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool {
- isEmbeddedPtrNil, converted := encoder.fieldEncoder.(IsEmbeddedPtrNil)
- if !converted {
- return false
- }
- fieldPtr := encoder.field.UnsafeGet(ptr)
- return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr)
-}
-
-type IsEmbeddedPtrNil interface {
- IsEmbeddedPtrNil(ptr unsafe.Pointer) bool
-}
-
-type structEncoder struct {
- typ reflect2.Type
- fields []structFieldTo
-}
-
-type structFieldTo struct {
- encoder *structFieldEncoder
- toName string
-}
-
-func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteObjectStart()
- isNotFirst := false
- for _, field := range encoder.fields {
- if field.encoder.omitempty && field.encoder.IsEmpty(ptr) {
- continue
- }
- if field.encoder.IsEmbeddedPtrNil(ptr) {
- continue
- }
- if isNotFirst {
- stream.WriteMore()
- }
- stream.WriteObjectField(field.toName)
- field.encoder.Encode(ptr, stream)
- isNotFirst = true
- }
- stream.WriteObjectEnd()
- if stream.Error != nil && stream.Error != io.EOF {
- stream.Error = fmt.Errorf("%v.%s", encoder.typ, stream.Error.Error())
- }
-}
-
-func (encoder *structEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return false
-}
-
-type emptyStructEncoder struct {
-}
-
-func (encoder *emptyStructEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.WriteEmptyObject()
-}
-
-func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return false
-}
-
-type stringModeNumberEncoder struct {
- elemEncoder ValEncoder
-}
-
-func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- stream.writeByte('"')
- encoder.elemEncoder.Encode(ptr, stream)
- stream.writeByte('"')
-}
-
-func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.elemEncoder.IsEmpty(ptr)
-}
-
-type stringModeStringEncoder struct {
- elemEncoder ValEncoder
- cfg *frozenConfig
-}
-
-func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) {
- tempStream := encoder.cfg.BorrowStream(nil)
- defer encoder.cfg.ReturnStream(tempStream)
- encoder.elemEncoder.Encode(ptr, tempStream)
- stream.WriteString(string(tempStream.Buffer()))
-}
-
-func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool {
- return encoder.elemEncoder.IsEmpty(ptr)
-}
diff --git a/vendor/github.com/json-iterator/go/stream.go b/vendor/github.com/json-iterator/go/stream.go
deleted file mode 100644
index 17662fde..00000000
--- a/vendor/github.com/json-iterator/go/stream.go
+++ /dev/null
@@ -1,211 +0,0 @@
-package jsoniter
-
-import (
- "io"
-)
-
-// stream is a io.Writer like object, with JSON specific write functions.
-// Error is not returned as return value, but stored as Error member on this stream instance.
-type Stream struct {
- cfg *frozenConfig
- out io.Writer
- buf []byte
- Error error
- indention int
- Attachment interface{} // open for customized encoder
-}
-
-// NewStream create new stream instance.
-// cfg can be jsoniter.ConfigDefault.
-// out can be nil if write to internal buffer.
-// bufSize is the initial size for the internal buffer in bytes.
-func NewStream(cfg API, out io.Writer, bufSize int) *Stream {
- return &Stream{
- cfg: cfg.(*frozenConfig),
- out: out,
- buf: make([]byte, 0, bufSize),
- Error: nil,
- indention: 0,
- }
-}
-
-// Pool returns a pool can provide more stream with same configuration
-func (stream *Stream) Pool() StreamPool {
- return stream.cfg
-}
-
-// Reset reuse this stream instance by assign a new writer
-func (stream *Stream) Reset(out io.Writer) {
- stream.out = out
- stream.buf = stream.buf[:0]
-}
-
-// Available returns how many bytes are unused in the buffer.
-func (stream *Stream) Available() int {
- return cap(stream.buf) - len(stream.buf)
-}
-
-// Buffered returns the number of bytes that have been written into the current buffer.
-func (stream *Stream) Buffered() int {
- return len(stream.buf)
-}
-
-// Buffer if writer is nil, use this method to take the result
-func (stream *Stream) Buffer() []byte {
- return stream.buf
-}
-
-// SetBuffer allows to append to the internal buffer directly
-func (stream *Stream) SetBuffer(buf []byte) {
- stream.buf = buf
-}
-
-// Write writes the contents of p into the buffer.
-// It returns the number of bytes written.
-// If nn < len(p), it also returns an error explaining
-// why the write is short.
-func (stream *Stream) Write(p []byte) (nn int, err error) {
- stream.buf = append(stream.buf, p...)
- if stream.out != nil {
- nn, err = stream.out.Write(stream.buf)
- stream.buf = stream.buf[nn:]
- return
- }
- return len(p), nil
-}
-
-// WriteByte writes a single byte.
-func (stream *Stream) writeByte(c byte) {
- stream.buf = append(stream.buf, c)
-}
-
-func (stream *Stream) writeTwoBytes(c1 byte, c2 byte) {
- stream.buf = append(stream.buf, c1, c2)
-}
-
-func (stream *Stream) writeThreeBytes(c1 byte, c2 byte, c3 byte) {
- stream.buf = append(stream.buf, c1, c2, c3)
-}
-
-func (stream *Stream) writeFourBytes(c1 byte, c2 byte, c3 byte, c4 byte) {
- stream.buf = append(stream.buf, c1, c2, c3, c4)
-}
-
-func (stream *Stream) writeFiveBytes(c1 byte, c2 byte, c3 byte, c4 byte, c5 byte) {
- stream.buf = append(stream.buf, c1, c2, c3, c4, c5)
-}
-
-// Flush writes any buffered data to the underlying io.Writer.
-func (stream *Stream) Flush() error {
- if stream.out == nil {
- return nil
- }
- if stream.Error != nil {
- return stream.Error
- }
- n, err := stream.out.Write(stream.buf)
- if err != nil {
- if stream.Error == nil {
- stream.Error = err
- }
- return err
- }
- stream.buf = stream.buf[n:]
- return nil
-}
-
-// WriteRaw write string out without quotes, just like []byte
-func (stream *Stream) WriteRaw(s string) {
- stream.buf = append(stream.buf, s...)
-}
-
-// WriteNil write null to stream
-func (stream *Stream) WriteNil() {
- stream.writeFourBytes('n', 'u', 'l', 'l')
-}
-
-// WriteTrue write true to stream
-func (stream *Stream) WriteTrue() {
- stream.writeFourBytes('t', 'r', 'u', 'e')
-}
-
-// WriteFalse write false to stream
-func (stream *Stream) WriteFalse() {
- stream.writeFiveBytes('f', 'a', 'l', 's', 'e')
-}
-
-// WriteBool write true or false into stream
-func (stream *Stream) WriteBool(val bool) {
- if val {
- stream.WriteTrue()
- } else {
- stream.WriteFalse()
- }
-}
-
-// WriteObjectStart write { with possible indention
-func (stream *Stream) WriteObjectStart() {
- stream.indention += stream.cfg.indentionStep
- stream.writeByte('{')
- stream.writeIndention(0)
-}
-
-// WriteObjectField write "field": with possible indention
-func (stream *Stream) WriteObjectField(field string) {
- stream.WriteString(field)
- if stream.indention > 0 {
- stream.writeTwoBytes(':', ' ')
- } else {
- stream.writeByte(':')
- }
-}
-
-// WriteObjectEnd write } with possible indention
-func (stream *Stream) WriteObjectEnd() {
- stream.writeIndention(stream.cfg.indentionStep)
- stream.indention -= stream.cfg.indentionStep
- stream.writeByte('}')
-}
-
-// WriteEmptyObject write {}
-func (stream *Stream) WriteEmptyObject() {
- stream.writeByte('{')
- stream.writeByte('}')
-}
-
-// WriteMore write , with possible indention
-func (stream *Stream) WriteMore() {
- stream.writeByte(',')
- stream.writeIndention(0)
- stream.Flush()
-}
-
-// WriteArrayStart write [ with possible indention
-func (stream *Stream) WriteArrayStart() {
- stream.indention += stream.cfg.indentionStep
- stream.writeByte('[')
- stream.writeIndention(0)
-}
-
-// WriteEmptyArray write []
-func (stream *Stream) WriteEmptyArray() {
- stream.writeTwoBytes('[', ']')
-}
-
-// WriteArrayEnd write ] with possible indention
-func (stream *Stream) WriteArrayEnd() {
- stream.writeIndention(stream.cfg.indentionStep)
- stream.indention -= stream.cfg.indentionStep
- stream.writeByte(']')
-}
-
-func (stream *Stream) writeIndention(delta int) {
- if stream.indention == 0 {
- return
- }
- stream.writeByte('\n')
- toWrite := stream.indention - delta
- for i := 0; i < toWrite; i++ {
- stream.buf = append(stream.buf, ' ')
- }
-}
diff --git a/vendor/github.com/json-iterator/go/stream_float.go b/vendor/github.com/json-iterator/go/stream_float.go
deleted file mode 100644
index f318d2c5..00000000
--- a/vendor/github.com/json-iterator/go/stream_float.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package jsoniter
-
-import (
- "math"
- "strconv"
-)
-
-var pow10 []uint64
-
-func init() {
- pow10 = []uint64{1, 10, 100, 1000, 10000, 100000, 1000000}
-}
-
-// WriteFloat32 write float32 to stream
-func (stream *Stream) WriteFloat32(val float32) {
- abs := math.Abs(float64(val))
- fmt := byte('f')
- // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right.
- if abs != 0 {
- if float32(abs) < 1e-6 || float32(abs) >= 1e21 {
- fmt = 'e'
- }
- }
- stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 32)
-}
-
-// WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster
-func (stream *Stream) WriteFloat32Lossy(val float32) {
- if val < 0 {
- stream.writeByte('-')
- val = -val
- }
- if val > 0x4ffffff {
- stream.WriteFloat32(val)
- return
- }
- precision := 6
- exp := uint64(1000000) // 6
- lval := uint64(float64(val)*float64(exp) + 0.5)
- stream.WriteUint64(lval / exp)
- fval := lval % exp
- if fval == 0 {
- return
- }
- stream.writeByte('.')
- for p := precision - 1; p > 0 && fval < pow10[p]; p-- {
- stream.writeByte('0')
- }
- stream.WriteUint64(fval)
- for stream.buf[len(stream.buf)-1] == '0' {
- stream.buf = stream.buf[:len(stream.buf)-1]
- }
-}
-
-// WriteFloat64 write float64 to stream
-func (stream *Stream) WriteFloat64(val float64) {
- abs := math.Abs(val)
- fmt := byte('f')
- // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right.
- if abs != 0 {
- if abs < 1e-6 || abs >= 1e21 {
- fmt = 'e'
- }
- }
- stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 64)
-}
-
-// WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster
-func (stream *Stream) WriteFloat64Lossy(val float64) {
- if val < 0 {
- stream.writeByte('-')
- val = -val
- }
- if val > 0x4ffffff {
- stream.WriteFloat64(val)
- return
- }
- precision := 6
- exp := uint64(1000000) // 6
- lval := uint64(val*float64(exp) + 0.5)
- stream.WriteUint64(lval / exp)
- fval := lval % exp
- if fval == 0 {
- return
- }
- stream.writeByte('.')
- for p := precision - 1; p > 0 && fval < pow10[p]; p-- {
- stream.writeByte('0')
- }
- stream.WriteUint64(fval)
- for stream.buf[len(stream.buf)-1] == '0' {
- stream.buf = stream.buf[:len(stream.buf)-1]
- }
-}
diff --git a/vendor/github.com/json-iterator/go/stream_int.go b/vendor/github.com/json-iterator/go/stream_int.go
deleted file mode 100644
index d1059ee4..00000000
--- a/vendor/github.com/json-iterator/go/stream_int.go
+++ /dev/null
@@ -1,190 +0,0 @@
-package jsoniter
-
-var digits []uint32
-
-func init() {
- digits = make([]uint32, 1000)
- for i := uint32(0); i < 1000; i++ {
- digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0'
- if i < 10 {
- digits[i] += 2 << 24
- } else if i < 100 {
- digits[i] += 1 << 24
- }
- }
-}
-
-func writeFirstBuf(space []byte, v uint32) []byte {
- start := v >> 24
- if start == 0 {
- space = append(space, byte(v>>16), byte(v>>8))
- } else if start == 1 {
- space = append(space, byte(v>>8))
- }
- space = append(space, byte(v))
- return space
-}
-
-func writeBuf(buf []byte, v uint32) []byte {
- return append(buf, byte(v>>16), byte(v>>8), byte(v))
-}
-
-// WriteUint8 write uint8 to stream
-func (stream *Stream) WriteUint8(val uint8) {
- stream.buf = writeFirstBuf(stream.buf, digits[val])
-}
-
-// WriteInt8 write int8 to stream
-func (stream *Stream) WriteInt8(nval int8) {
- var val uint8
- if nval < 0 {
- val = uint8(-nval)
- stream.buf = append(stream.buf, '-')
- } else {
- val = uint8(nval)
- }
- stream.buf = writeFirstBuf(stream.buf, digits[val])
-}
-
-// WriteUint16 write uint16 to stream
-func (stream *Stream) WriteUint16(val uint16) {
- q1 := val / 1000
- if q1 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[val])
- return
- }
- r1 := val - q1*1000
- stream.buf = writeFirstBuf(stream.buf, digits[q1])
- stream.buf = writeBuf(stream.buf, digits[r1])
- return
-}
-
-// WriteInt16 write int16 to stream
-func (stream *Stream) WriteInt16(nval int16) {
- var val uint16
- if nval < 0 {
- val = uint16(-nval)
- stream.buf = append(stream.buf, '-')
- } else {
- val = uint16(nval)
- }
- stream.WriteUint16(val)
-}
-
-// WriteUint32 write uint32 to stream
-func (stream *Stream) WriteUint32(val uint32) {
- q1 := val / 1000
- if q1 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[val])
- return
- }
- r1 := val - q1*1000
- q2 := q1 / 1000
- if q2 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[q1])
- stream.buf = writeBuf(stream.buf, digits[r1])
- return
- }
- r2 := q1 - q2*1000
- q3 := q2 / 1000
- if q3 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[q2])
- } else {
- r3 := q2 - q3*1000
- stream.buf = append(stream.buf, byte(q3+'0'))
- stream.buf = writeBuf(stream.buf, digits[r3])
- }
- stream.buf = writeBuf(stream.buf, digits[r2])
- stream.buf = writeBuf(stream.buf, digits[r1])
-}
-
-// WriteInt32 write int32 to stream
-func (stream *Stream) WriteInt32(nval int32) {
- var val uint32
- if nval < 0 {
- val = uint32(-nval)
- stream.buf = append(stream.buf, '-')
- } else {
- val = uint32(nval)
- }
- stream.WriteUint32(val)
-}
-
-// WriteUint64 write uint64 to stream
-func (stream *Stream) WriteUint64(val uint64) {
- q1 := val / 1000
- if q1 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[val])
- return
- }
- r1 := val - q1*1000
- q2 := q1 / 1000
- if q2 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[q1])
- stream.buf = writeBuf(stream.buf, digits[r1])
- return
- }
- r2 := q1 - q2*1000
- q3 := q2 / 1000
- if q3 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[q2])
- stream.buf = writeBuf(stream.buf, digits[r2])
- stream.buf = writeBuf(stream.buf, digits[r1])
- return
- }
- r3 := q2 - q3*1000
- q4 := q3 / 1000
- if q4 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[q3])
- stream.buf = writeBuf(stream.buf, digits[r3])
- stream.buf = writeBuf(stream.buf, digits[r2])
- stream.buf = writeBuf(stream.buf, digits[r1])
- return
- }
- r4 := q3 - q4*1000
- q5 := q4 / 1000
- if q5 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[q4])
- stream.buf = writeBuf(stream.buf, digits[r4])
- stream.buf = writeBuf(stream.buf, digits[r3])
- stream.buf = writeBuf(stream.buf, digits[r2])
- stream.buf = writeBuf(stream.buf, digits[r1])
- return
- }
- r5 := q4 - q5*1000
- q6 := q5 / 1000
- if q6 == 0 {
- stream.buf = writeFirstBuf(stream.buf, digits[q5])
- } else {
- stream.buf = writeFirstBuf(stream.buf, digits[q6])
- r6 := q5 - q6*1000
- stream.buf = writeBuf(stream.buf, digits[r6])
- }
- stream.buf = writeBuf(stream.buf, digits[r5])
- stream.buf = writeBuf(stream.buf, digits[r4])
- stream.buf = writeBuf(stream.buf, digits[r3])
- stream.buf = writeBuf(stream.buf, digits[r2])
- stream.buf = writeBuf(stream.buf, digits[r1])
-}
-
-// WriteInt64 write int64 to stream
-func (stream *Stream) WriteInt64(nval int64) {
- var val uint64
- if nval < 0 {
- val = uint64(-nval)
- stream.buf = append(stream.buf, '-')
- } else {
- val = uint64(nval)
- }
- stream.WriteUint64(val)
-}
-
-// WriteInt write int to stream
-func (stream *Stream) WriteInt(val int) {
- stream.WriteInt64(int64(val))
-}
-
-// WriteUint write uint to stream
-func (stream *Stream) WriteUint(val uint) {
- stream.WriteUint64(uint64(val))
-}
diff --git a/vendor/github.com/json-iterator/go/stream_str.go b/vendor/github.com/json-iterator/go/stream_str.go
deleted file mode 100644
index 54c2ba0b..00000000
--- a/vendor/github.com/json-iterator/go/stream_str.go
+++ /dev/null
@@ -1,372 +0,0 @@
-package jsoniter
-
-import (
- "unicode/utf8"
-)
-
-// htmlSafeSet holds the value true if the ASCII character with the given
-// array position can be safely represented inside a JSON string, embedded
-// inside of HTML " that closes the next token. If
- // non-empty, the subsequent call to Next will return a raw or RCDATA text
- // token: one that treats "" as text instead of an element.
- // rawTag's contents are lower-cased.
- rawTag string
- // textIsRaw is whether the current text token's data is not escaped.
- textIsRaw bool
- // convertNUL is whether NUL bytes in the current token's data should
- // be converted into \ufffd replacement characters.
- convertNUL bool
- // allowCDATA is whether CDATA sections are allowed in the current context.
- allowCDATA bool
-}
-
-// AllowCDATA sets whether or not the tokenizer recognizes as
-// the text "foo". The default value is false, which means to recognize it as
-// a bogus comment "" instead.
-//
-// Strictly speaking, an HTML5 compliant tokenizer should allow CDATA if and
-// only if tokenizing foreign content, such as MathML and SVG. However,
-// tracking foreign-contentness is difficult to do purely in the tokenizer,
-// as opposed to the parser, due to HTML integration points: an element
-// can contain a that is foreign-to-SVG but not foreign-to-
-// HTML. For strict compliance with the HTML5 tokenization algorithm, it is the
-// responsibility of the user of a tokenizer to call AllowCDATA as appropriate.
-// In practice, if using the tokenizer without caring whether MathML or SVG
-// CDATA is text or comments, such as tokenizing HTML to find all the anchor
-// text, it is acceptable to ignore this responsibility.
-func (z *Tokenizer) AllowCDATA(allowCDATA bool) {
- z.allowCDATA = allowCDATA
-}
-
-// NextIsNotRawText instructs the tokenizer that the next token should not be
-// considered as 'raw text'. Some elements, such as script and title elements,
-// normally require the next token after the opening tag to be 'raw text' that
-// has no child elements. For example, tokenizing "ac d "
-// yields a start tag token for "", a text token for "ac d", and
-// an end tag token for " ". There are no distinct start tag or end tag
-// tokens for the "" and " ".
-//
-// This tokenizer implementation will generally look for raw text at the right
-// times. Strictly speaking, an HTML5 compliant tokenizer should not look for
-// raw text if in foreign content: generally needs raw text, but a
-// inside an does not. Another example is that a