diff --git a/protoc-gen-http-swagger/generator/openapi_gen.go b/protoc-gen-http-swagger/generator/openapi_gen.go index 4f2262f..88670ba 100644 --- a/protoc-gen-http-swagger/generator/openapi_gen.go +++ b/protoc-gen-http-swagger/generator/openapi_gen.go @@ -371,228 +371,236 @@ func (g *OpenAPIGenerator) buildOperation( // Parameters array to hold all parameter objects var parameters []*openapi.ParameterOrReference - // Iterate through each field in the input message - for _, field := range inputMessage.Fields { - var paramName, paramIn, paramDesc string - var fieldSchema *openapi.SchemaOrReference - required := false - var ext any - // Check for each type of extension (query, path, cookie, header) - if ext = proto.GetExtension(field.Desc.Options(), api.E_Query); ext != "" { - paramName = proto.GetExtension(field.Desc.Options(), api.E_Query).(string) - paramIn = consts.ParameterInQuery - paramDesc = g.filterCommentString(field.Comments.Leading) - fieldSchema = g.reflect.schemaOrReferenceForField(field.Desc) - if schema, ok := fieldSchema.Oneof.(*openapi.SchemaOrReference_Schema); ok { - // Merge any `Property` annotations with the current - extProperty := proto.GetExtension(field.Desc.Options(), openapi.E_Property) - if extProperty != nil { - if property, ok := extProperty.(*openapi.Schema); ok { - proto.Merge(schema.Schema, property) - } else { - logs.Errorf("unexpected type for Property: %T", extProperty) + var RequestBody *openapi.RequestBodyOrReference + + if inputMessage != nil { + // Iterate through each field in the input message + for _, field := range inputMessage.Fields { + var paramName, paramIn, paramDesc string + var fieldSchema *openapi.SchemaOrReference + required := false + var ext any + // Check for each type of extension (query, path, cookie, header) + if ext = proto.GetExtension(field.Desc.Options(), api.E_Query); ext != "" { + paramName = proto.GetExtension(field.Desc.Options(), api.E_Query).(string) + paramIn = consts.ParameterInQuery + paramDesc = g.filterCommentString(field.Comments.Leading) + fieldSchema = g.reflect.schemaOrReferenceForField(field.Desc) + if schema, ok := fieldSchema.Oneof.(*openapi.SchemaOrReference_Schema); ok { + // Merge any `Property` annotations with the current + extProperty := proto.GetExtension(field.Desc.Options(), openapi.E_Property) + if extProperty != nil { + if property, ok := extProperty.(*openapi.Schema); ok { + proto.Merge(schema.Schema, property) + } else { + logs.Errorf("unexpected type for Property: %T", extProperty) + } } } - } - } else if ext = proto.GetExtension(field.Desc.Options(), api.E_Path); ext != "" { - paramName = proto.GetExtension(field.Desc.Options(), api.E_Path).(string) - paramIn = consts.ParameterInPath - paramDesc = g.filterCommentString(field.Comments.Leading) - fieldSchema = g.reflect.schemaOrReferenceForField(field.Desc) - if schema, ok := fieldSchema.Oneof.(*openapi.SchemaOrReference_Schema); ok { - // Merge any `Property` annotations with the current - extProperty := proto.GetExtension(field.Desc.Options(), openapi.E_Property) - if extProperty != nil { - proto.Merge(schema.Schema, extProperty.(*openapi.Schema)) + } else if ext = proto.GetExtension(field.Desc.Options(), api.E_Path); ext != "" { + paramName = proto.GetExtension(field.Desc.Options(), api.E_Path).(string) + paramIn = consts.ParameterInPath + paramDesc = g.filterCommentString(field.Comments.Leading) + fieldSchema = g.reflect.schemaOrReferenceForField(field.Desc) + if schema, ok := fieldSchema.Oneof.(*openapi.SchemaOrReference_Schema); ok { + // Merge any `Property` annotations with the current + extProperty := proto.GetExtension(field.Desc.Options(), openapi.E_Property) + if extProperty != nil { + proto.Merge(schema.Schema, extProperty.(*openapi.Schema)) + } } - } - // According to the OpenAPI specification, if a path parameter exists, it must be required. - required = true - } else if ext = proto.GetExtension(field.Desc.Options(), api.E_Cookie); ext != "" { - paramName = proto.GetExtension(field.Desc.Options(), api.E_Cookie).(string) - paramIn = consts.ParameterInCookie - paramDesc = g.filterCommentString(field.Comments.Leading) - fieldSchema = g.reflect.schemaOrReferenceForField(field.Desc) - if schema, ok := fieldSchema.Oneof.(*openapi.SchemaOrReference_Schema); ok { - // Merge any `Property` annotations with the current - extProperty := proto.GetExtension(field.Desc.Options(), openapi.E_Property) - if extProperty != nil { - proto.Merge(schema.Schema, extProperty.(*openapi.Schema)) + // According to the OpenAPI specification, if a path parameter exists, it must be required. + required = true + } else if ext = proto.GetExtension(field.Desc.Options(), api.E_Cookie); ext != "" { + paramName = proto.GetExtension(field.Desc.Options(), api.E_Cookie).(string) + paramIn = consts.ParameterInCookie + paramDesc = g.filterCommentString(field.Comments.Leading) + fieldSchema = g.reflect.schemaOrReferenceForField(field.Desc) + if schema, ok := fieldSchema.Oneof.(*openapi.SchemaOrReference_Schema); ok { + // Merge any `Property` annotations with the current + extProperty := proto.GetExtension(field.Desc.Options(), openapi.E_Property) + if extProperty != nil { + proto.Merge(schema.Schema, extProperty.(*openapi.Schema)) + } } - } - } else if ext = proto.GetExtension(field.Desc.Options(), api.E_Header); ext != "" { - paramName = proto.GetExtension(field.Desc.Options(), api.E_Header).(string) - paramIn = consts.ParameterInHeader - paramDesc = g.filterCommentString(field.Comments.Leading) - fieldSchema = g.reflect.schemaOrReferenceForField(field.Desc) - if schema, ok := fieldSchema.Oneof.(*openapi.SchemaOrReference_Schema); ok { - // Merge any `Property` annotations with the current - extProperty := proto.GetExtension(field.Desc.Options(), openapi.E_Property) - if extProperty != nil { - proto.Merge(schema.Schema, extProperty.(*openapi.Schema)) + } else if ext = proto.GetExtension(field.Desc.Options(), api.E_Header); ext != "" { + paramName = proto.GetExtension(field.Desc.Options(), api.E_Header).(string) + paramIn = consts.ParameterInHeader + paramDesc = g.filterCommentString(field.Comments.Leading) + fieldSchema = g.reflect.schemaOrReferenceForField(field.Desc) + if schema, ok := fieldSchema.Oneof.(*openapi.SchemaOrReference_Schema); ok { + // Merge any `Property` annotations with the current + extProperty := proto.GetExtension(field.Desc.Options(), openapi.E_Property) + if extProperty != nil { + proto.Merge(schema.Schema, extProperty.(*openapi.Schema)) + } } } - } - parameter := &openapi.Parameter{ - Name: paramName, - In: paramIn, - Description: paramDesc, - Required: required, - Schema: fieldSchema, - } - extParameter := proto.GetExtension(field.Desc.Options(), openapi.E_Parameter) - if extParameter != nil { - if parameterExt, ok := extParameter.(*openapi.Parameter); ok { - proto.Merge(parameter, parameterExt) - } else { - logs.Errorf("unexpected type for Parameter: %T", extParameter) + parameter := &openapi.Parameter{ + Name: paramName, + In: paramIn, + Description: paramDesc, + Required: required, + Schema: fieldSchema, + } + extParameter := proto.GetExtension(field.Desc.Options(), openapi.E_Parameter) + if extParameter != nil { + if parameterExt, ok := extParameter.(*openapi.Parameter); ok { + proto.Merge(parameter, parameterExt) + } else { + logs.Errorf("unexpected type for Parameter: %T", extParameter) + } } - } - // Append the parameter to the parameters array if it was set - if paramName != "" && paramIn != "" { - parameters = append(parameters, &openapi.ParameterOrReference{ - Oneof: &openapi.ParameterOrReference_Parameter{ - Parameter: parameter, - }, - }) + // Append the parameter to the parameters array if it was set + if paramName != "" && paramIn != "" { + parameters = append(parameters, &openapi.ParameterOrReference{ + Oneof: &openapi.ParameterOrReference_Parameter{ + Parameter: parameter, + }, + }) + } } - } - var RequestBody *openapi.RequestBodyOrReference - if methodName != consts.HttpMethodGet && methodName != consts.HttpMethodHead && methodName != consts.HttpMethodDelete { - var additionalProperties []*openapi.NamedMediaType + if methodName != consts.HttpMethodGet && methodName != consts.HttpMethodHead && methodName != consts.HttpMethodDelete { + var additionalProperties []*openapi.NamedMediaType - bodySchema := g.getSchemaByOption(inputMessage, api.E_Body) + bodySchema := g.getSchemaByOption(inputMessage, api.E_Body) - if len(bodySchema.Properties.AdditionalProperties) > 0 { + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { - bodyRefSchema := &openapi.NamedSchemaOrReference{ - Name: g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixBody, - Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: bodySchema}}, - } + bodyRefSchema := &openapi.NamedSchemaOrReference{ + Name: g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixBody, + Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: bodySchema}}, + } - bodyRef := consts.ComponentSchemaPrefix + g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixBody + bodyRef := consts.ComponentSchemaPrefix + g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixBody - g.addSchemaToDocument(d, bodyRefSchema) + g.addSchemaToDocument(d, bodyRefSchema) - additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ - Name: consts.ContentTypeJSON, - Value: &openapi.MediaType{ - Schema: &openapi.SchemaOrReference{ - Oneof: &openapi.SchemaOrReference_Reference{ - Reference: &openapi.Reference{XRef: bodyRef}, + additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ + Name: consts.ContentTypeJSON, + Value: &openapi.MediaType{ + Schema: &openapi.SchemaOrReference{ + Oneof: &openapi.SchemaOrReference_Reference{ + Reference: &openapi.Reference{XRef: bodyRef}, + }, }, }, - }, - }) - } + }) + } - formSchema := g.getSchemaByOption(inputMessage, api.E_Form) + formSchema := g.getSchemaByOption(inputMessage, api.E_Form) - if len(formSchema.Properties.AdditionalProperties) > 0 { - formRefSchema := &openapi.NamedSchemaOrReference{ - Name: g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixForm, - Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: formSchema}}, - } + if formSchema != nil && formSchema.Properties != nil && len(formSchema.Properties.AdditionalProperties) > 0 { + formRefSchema := &openapi.NamedSchemaOrReference{ + Name: g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixForm, + Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: formSchema}}, + } - formRef := consts.ComponentSchemaPrefix + g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixForm + formRef := consts.ComponentSchemaPrefix + g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixForm - g.addSchemaToDocument(d, formRefSchema) + g.addSchemaToDocument(d, formRefSchema) - additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ - Name: consts.ContentTypeFormMultipart, - Value: &openapi.MediaType{ - Schema: &openapi.SchemaOrReference{ - Oneof: &openapi.SchemaOrReference_Reference{ - Reference: &openapi.Reference{XRef: formRef}, + additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ + Name: consts.ContentTypeFormMultipart, + Value: &openapi.MediaType{ + Schema: &openapi.SchemaOrReference{ + Oneof: &openapi.SchemaOrReference_Reference{ + Reference: &openapi.Reference{XRef: formRef}, + }, }, }, - }, - }) - - additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ - Name: consts.ContentTypeFormURLEncoded, - Value: &openapi.MediaType{ - Schema: &openapi.SchemaOrReference{ - Oneof: &openapi.SchemaOrReference_Reference{ - Reference: &openapi.Reference{XRef: formRef}, + }) + + additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ + Name: consts.ContentTypeFormURLEncoded, + Value: &openapi.MediaType{ + Schema: &openapi.SchemaOrReference{ + Oneof: &openapi.SchemaOrReference_Reference{ + Reference: &openapi.Reference{XRef: formRef}, + }, }, }, - }, - }) - } + }) + } - rawBodySchema := g.getSchemaByOption(inputMessage, api.E_RawBody) + rawBodySchema := g.getSchemaByOption(inputMessage, api.E_RawBody) - if len(rawBodySchema.Properties.AdditionalProperties) > 0 { - rawBodyRefSchema := &openapi.NamedSchemaOrReference{ - Name: g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixRawBody, - Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: rawBodySchema}}, - } + if rawBodySchema != nil && rawBodySchema.Properties != nil && len(rawBodySchema.Properties.AdditionalProperties) > 0 { + rawBodyRefSchema := &openapi.NamedSchemaOrReference{ + Name: g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixRawBody, + Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: rawBodySchema}}, + } - rawBodyRef := consts.ComponentSchemaPrefix + g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixRawBody + rawBodyRef := consts.ComponentSchemaPrefix + g.reflect.formatMessageName(inputMessage.Desc) + consts.ComponentSchemaSuffixRawBody - g.addSchemaToDocument(d, rawBodyRefSchema) + g.addSchemaToDocument(d, rawBodyRefSchema) - additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ - Name: consts.ContentTypeRawBody, - Value: &openapi.MediaType{ - Schema: &openapi.SchemaOrReference{ - Oneof: &openapi.SchemaOrReference_Reference{ - Reference: &openapi.Reference{XRef: rawBodyRef}, + additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ + Name: consts.ContentTypeRawBody, + Value: &openapi.MediaType{ + Schema: &openapi.SchemaOrReference{ + Oneof: &openapi.SchemaOrReference_Reference{ + Reference: &openapi.Reference{XRef: rawBodyRef}, + }, }, }, - }, - }) - } + }) + } - if len(additionalProperties) > 0 { - RequestBody = &openapi.RequestBodyOrReference{ - Oneof: &openapi.RequestBodyOrReference_RequestBody{ - RequestBody: &openapi.RequestBody{ - Description: g.filterCommentString(inputMessage.Comments.Leading), - Content: &openapi.MediaTypes{ - AdditionalProperties: additionalProperties, + if len(additionalProperties) > 0 { + RequestBody = &openapi.RequestBodyOrReference{ + Oneof: &openapi.RequestBodyOrReference_RequestBody{ + RequestBody: &openapi.RequestBody{ + Description: g.filterCommentString(inputMessage.Comments.Leading), + Content: &openapi.MediaTypes{ + AdditionalProperties: additionalProperties, + }, }, }, - }, + } } } } - name, header, content := g.getResponseForMessage(d, outputMessage) + var responses *openapi.Responses - desc := g.filterCommentString(outputMessage.Comments.Leading) - if desc == "" { - desc = consts.DefaultResponseDesc - } + if outputMessage != nil { + name, header, content := g.getResponseForMessage(d, outputMessage) - var headerOrEmpty *openapi.HeadersOrReferences - if len(header.AdditionalProperties) != 0 { - headerOrEmpty = header - } - var contentOrEmpty *openapi.MediaTypes - if len(content.AdditionalProperties) != 0 { - contentOrEmpty = content - } - var responses *openapi.Responses - if headerOrEmpty != nil || contentOrEmpty != nil { - responses = &openapi.Responses{ - ResponseOrReference: []*openapi.NamedResponseOrReference{ - { - Name: name, - Value: &openapi.ResponseOrReference{ - Oneof: &openapi.ResponseOrReference_Response{ - Response: &openapi.Response{ - Description: desc, - Headers: headerOrEmpty, - Content: contentOrEmpty, + desc := g.filterCommentString(outputMessage.Comments.Leading) + if desc == "" { + desc = consts.DefaultResponseDesc + } + + var headerOrEmpty *openapi.HeadersOrReferences + if header != nil && len(header.AdditionalProperties) != 0 { + headerOrEmpty = header + } + + var contentOrEmpty *openapi.MediaTypes + if content != nil && len(content.AdditionalProperties) != 0 { + contentOrEmpty = content + } + + if headerOrEmpty != nil || contentOrEmpty != nil { + responses = &openapi.Responses{ + ResponseOrReference: []*openapi.NamedResponseOrReference{ + { + Name: name, + Value: &openapi.ResponseOrReference{ + Oneof: &openapi.ResponseOrReference_Response{ + Response: &openapi.Response{ + Description: desc, + Headers: headerOrEmpty, + Content: contentOrEmpty, + }, }, }, }, }, - }, + } } } @@ -644,7 +652,7 @@ func (g *OpenAPIGenerator) getResponseForMessage(d *openapi.Document, message *p var additionalProperties []*openapi.NamedMediaType - if len(bodySchema.Properties.AdditionalProperties) > 0 { + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { refSchema := &openapi.NamedSchemaOrReference{ Name: g.reflect.formatMessageName(message.Desc) + consts.ComponentSchemaSuffixBody, Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: bodySchema}}, @@ -663,7 +671,7 @@ func (g *OpenAPIGenerator) getResponseForMessage(d *openapi.Document, message *p }) } - if len(rawBodySchema.Properties.AdditionalProperties) > 0 { + if rawBodySchema != nil && rawBodySchema.Properties != nil && len(rawBodySchema.Properties.AdditionalProperties) > 0 { refSchema := &openapi.NamedSchemaOrReference{ Name: g.reflect.formatMessageName(message.Desc) + consts.ComponentSchemaSuffixRawBody, Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: rawBodySchema}}, diff --git a/protoc-gen-rpc-swagger/generator/openapi_gen.go b/protoc-gen-rpc-swagger/generator/openapi_gen.go index c223351..207fb51 100644 --- a/protoc-gen-rpc-swagger/generator/openapi_gen.go +++ b/protoc-gen-rpc-swagger/generator/openapi_gen.go @@ -368,70 +368,76 @@ func (g *OpenAPIGenerator) buildOperation( var RequestBody *openapi.RequestBodyOrReference var additionalProperties []*openapi.NamedMediaType - bodySchema := g.getSchemaByOption(inputMessage) + if inputMessage != nil { + bodySchema := g.getSchemaByOption(inputMessage) - if len(bodySchema.Properties.AdditionalProperties) > 0 { - refSchema := &openapi.NamedSchemaOrReference{ - Name: g.reflect.formatMessageName(inputMessage.Desc), - Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: bodySchema}}, - } + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { + refSchema := &openapi.NamedSchemaOrReference{ + Name: g.reflect.formatMessageName(inputMessage.Desc), + Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: bodySchema}}, + } - ref := consts.ComponentSchemaPrefix + g.reflect.formatMessageName(inputMessage.Desc) + ref := consts.ComponentSchemaPrefix + g.reflect.formatMessageName(inputMessage.Desc) - g.addSchemaToDocument(d, refSchema) + g.addSchemaToDocument(d, refSchema) - additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ - Name: consts.ContentTypeJSON, - Value: &openapi.MediaType{ - Schema: &openapi.SchemaOrReference{ - Oneof: &openapi.SchemaOrReference_Reference{ - Reference: &openapi.Reference{XRef: ref}, + additionalProperties = append(additionalProperties, &openapi.NamedMediaType{ + Name: consts.ContentTypeJSON, + Value: &openapi.MediaType{ + Schema: &openapi.SchemaOrReference{ + Oneof: &openapi.SchemaOrReference_Reference{ + Reference: &openapi.Reference{XRef: ref}, + }, }, }, - }, - }) - } + }) + } - if len(additionalProperties) > 0 { - RequestBody = &openapi.RequestBodyOrReference{ - Oneof: &openapi.RequestBodyOrReference_RequestBody{ - RequestBody: &openapi.RequestBody{ - Description: g.filterCommentString(inputMessage.Comments.Leading), - Content: &openapi.MediaTypes{ - AdditionalProperties: additionalProperties, + if len(additionalProperties) > 0 { + RequestBody = &openapi.RequestBodyOrReference{ + Oneof: &openapi.RequestBodyOrReference_RequestBody{ + RequestBody: &openapi.RequestBody{ + Description: g.filterCommentString(inputMessage.Comments.Leading), + Content: &openapi.MediaTypes{ + AdditionalProperties: additionalProperties, + }, }, }, - }, + } } } - name, content := g.getResponseForMessage(d, outputMessage) + var responses *openapi.Responses - desc := g.filterCommentString(outputMessage.Comments.Leading) - if desc == "" { - desc = consts.DefaultResponseDesc - } + if outputMessage != nil { + name, content := g.getResponseForMessage(d, outputMessage) - var contentOrEmpty *openapi.MediaTypes - if len(content.AdditionalProperties) != 0 { - contentOrEmpty = content - } - var responses *openapi.Responses - if contentOrEmpty != nil { - responses = &openapi.Responses{ - ResponseOrReference: []*openapi.NamedResponseOrReference{ - { - Name: name, - Value: &openapi.ResponseOrReference{ - Oneof: &openapi.ResponseOrReference_Response{ - Response: &openapi.Response{ - Description: desc, - Content: contentOrEmpty, + desc := g.filterCommentString(outputMessage.Comments.Leading) + if desc == "" { + desc = consts.DefaultResponseDesc + } + + var contentOrEmpty *openapi.MediaTypes + if content != nil && len(content.AdditionalProperties) != 0 { + contentOrEmpty = content + } + + if contentOrEmpty != nil { + responses = &openapi.Responses{ + ResponseOrReference: []*openapi.NamedResponseOrReference{ + { + Name: name, + Value: &openapi.ResponseOrReference{ + Oneof: &openapi.ResponseOrReference_Response{ + Response: &openapi.Response{ + Description: desc, + Content: contentOrEmpty, + }, }, }, }, }, - }, + } } } @@ -461,7 +467,7 @@ func (g *OpenAPIGenerator) getResponseForMessage(d *openapi.Document, message *p var additionalProperties []*openapi.NamedMediaType - if len(bodySchema.Properties.AdditionalProperties) > 0 { + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { refSchema := &openapi.NamedSchemaOrReference{ Name: g.reflect.formatMessageName(message.Desc), Value: &openapi.SchemaOrReference{Oneof: &openapi.SchemaOrReference_Schema{Schema: bodySchema}}, diff --git a/thrift-gen-http-swagger/generator/openapi_gen.go b/thrift-gen-http-swagger/generator/openapi_gen.go index 69de73c..ae18fbf 100644 --- a/thrift-gen-http-swagger/generator/openapi_gen.go +++ b/thrift-gen-http-swagger/generator/openapi_gen.go @@ -224,17 +224,26 @@ func (g *OpenAPIGenerator) BuildDocument(arguments *args.Arguments) []*plugin.Ge func (g *OpenAPIGenerator) getDocumentOption(obj interface{}) error { serviceOrStruct, name := g.getDocumentAnnotationInWhichServiceOrStruct() + + if serviceOrStruct == "" || name == "" { + return nil + } + if serviceOrStruct == consts.DocumentOptionServiceType { serviceDesc := g.fileDesc.GetServiceDescriptor(name) - err := utils.ParseServiceOption(serviceDesc, consts.OpenapiDocument, obj) - if err != nil { - return err + if serviceDesc != nil { + err := utils.ParseServiceOption(serviceDesc, consts.OpenapiDocument, obj) + if err != nil { + return err + } } } else if serviceOrStruct == consts.DocumentOptionStructType { structDesc := g.fileDesc.GetStructDescriptor(name) - err := utils.ParseStructOption(structDesc, consts.OpenapiDocument, obj) - if err != nil { - return err + if structDesc != nil { + err := utils.ParseStructOption(structDesc, consts.OpenapiDocument, obj) + if err != nil { + return err + } } } return nil @@ -243,80 +252,82 @@ func (g *OpenAPIGenerator) getDocumentOption(obj interface{}) error { func (g *OpenAPIGenerator) addPathsToDocument(d *openapi.Document, services []*thrift_reflection.ServiceDescriptor) { var err error for _, s := range services { - annotationsCount := 0 - for _, m := range s.GetMethods() { - var inputDesc, outputDesc, throwDesc *thrift_reflection.StructDescriptor - - rs := utils.GetAnnotations(m.Annotations, HttpMethodAnnotations) - if len(rs) == 0 { - continue - } - - if len(m.Args) > 0 { - if len(m.Args) > 1 { - logs.Warnf("function '%s' has more than one argument, but only the first can be used in plugin now", m.GetName()) + if s != nil { + annotationsCount := 0 + for _, m := range s.GetMethods() { + var inputDesc, outputDesc, throwDesc *thrift_reflection.StructDescriptor + + rs := utils.GetAnnotations(m.Annotations, HttpMethodAnnotations) + if len(rs) == 0 { + continue } - // TODO: support more argument types - if m.Args[0].GetType().IsStruct() { - inputDesc, err = m.Args[0].GetType().GetStructDescriptor() - if err != nil { - logs.Errorf("Error getting arguments descriptor: %s", err) - } - } else { - logs.Errorf("now only support struct type for input, but got %s", m.Args[0].GetType().GetName()) - } - } - - // TODO: support more response types - if m.Response.IsStruct() { - outputDesc, err = m.Response.GetStructDescriptor() - if err != nil { - logs.Errorf("Error getting response descriptor: %s", err) - } - } else if m.Response.Name != "void" { - logs.Errorf("now only support struct type for output, but got %s", m.Response.Name) - } - if len(m.ThrowExceptions) > 0 { - throwDesc, err = m.ThrowExceptions[0].GetType().GetExceptionDescriptor() - if err != nil { - logs.Errorf("Error getting exception descriptor: %s", err) - } - } - - for methodName, path := range rs { - if methodName != "" { - var host string - - if urls, ok := m.Annotations[consts.ApiBaseURL]; ok && len(urls) > 0 { - host = urls[0] - } else if domains, ok := s.Annotations[consts.ApiBaseDomain]; ok && len(domains) > 0 { - host = domains[0] + if len(m.Args) > 0 { + if len(m.Args) > 1 { + logs.Warnf("function '%s' has more than one argument, but only the first can be used in plugin now", m.GetName()) } + // TODO: support more argument types + if m.Args[0].GetType().IsStruct() { + inputDesc, err = m.Args[0].GetType().GetStructDescriptor() + if err != nil { + logs.Errorf("Error getting arguments descriptor: %s", err) + } + } else { + logs.Errorf("now only support struct type for input, but got %s", m.Args[0].GetType().GetName()) + } + } - annotationsCount++ - operationID := s.GetName() + "_" + m.GetName() - comment := g.filterCommentString(m.Comments) - - op, path2 := g.buildOperation(d, methodName, comment, operationID, s.GetName(), path[0], host, inputDesc, outputDesc, throwDesc) - - newOp := &openapi.Operation{} - err = utils.ParseMethodOption(m, consts.OpenapiOperation, &newOp) + // TODO: support more response types + if m.Response.IsStruct() { + outputDesc, err = m.Response.GetStructDescriptor() if err != nil { - logs.Errorf("Error parsing method option: %s", err) + logs.Errorf("Error getting response descriptor: %s", err) } - err = common.MergeStructs(op, newOp) + } else if m.Response.Name != "void" { + logs.Errorf("now only support struct type for output, but got %s", m.Response.Name) + } + + if len(m.ThrowExceptions) > 0 { + throwDesc, err = m.ThrowExceptions[0].GetType().GetExceptionDescriptor() if err != nil { - logs.Errorf("Error merging method option: %s", err) + logs.Errorf("Error getting exception descriptor: %s", err) } + } - g.addOperationToDocument(d, op, path2, methodName) + for methodName, path := range rs { + if methodName != "" { + var host string + + if urls, ok := m.Annotations[consts.ApiBaseURL]; ok && len(urls) > 0 { + host = urls[0] + } else if domains, ok := s.Annotations[consts.ApiBaseDomain]; ok && len(domains) > 0 { + host = domains[0] + } + + annotationsCount++ + operationID := s.GetName() + "_" + m.GetName() + comment := g.filterCommentString(m.Comments) + + op, path2 := g.buildOperation(d, methodName, comment, operationID, s.GetName(), path[0], host, inputDesc, outputDesc, throwDesc) + + newOp := &openapi.Operation{} + err = utils.ParseMethodOption(m, consts.OpenapiOperation, &newOp) + if err != nil { + logs.Errorf("Error parsing method option: %s", err) + } + err = common.MergeStructs(op, newOp) + if err != nil { + logs.Errorf("Error merging method option: %s", err) + } + + g.addOperationToDocument(d, op, path2, methodName) + } } } - } - if annotationsCount > 0 { - comment := g.filterCommentString(s.Comments) - d.Tags = append(d.Tags, &openapi.Tag{Name: s.GetName(), Description: comment}) + if annotationsCount > 0 { + comment := g.filterCommentString(s.Comments) + d.Tags = append(d.Tags, &openapi.Tag{Name: s.GetName(), Description: comment}) + } } } } @@ -336,117 +347,117 @@ func (g *OpenAPIGenerator) buildOperation( // Parameters array to hold all parameter objects var parameters []*openapi.ParameterOrReference - for _, v := range inputDesc.GetFields() { - var paramName, paramIn, paramDesc string - var fieldSchema *openapi.SchemaOrReference - required := false - - extOrNil := v.Annotations[consts.ApiQuery] - if len(extOrNil) > 0 { - if ext := v.Annotations[consts.ApiQuery][0]; ext != "" { - paramIn = consts.ParameterInQuery - paramName = ext - paramDesc = g.filterCommentString(v.Comments) - fieldSchema = g.schemaOrReferenceForField(v.Type) - extPropertyOrNil := v.Annotations[consts.OpenapiProperty] - if len(extPropertyOrNil) > 0 { - newFieldSchema := &openapi.Schema{} - err := utils.ParseFieldOption(v, consts.OpenapiProperty, &newFieldSchema) - if err != nil { - logs.Errorf("Error parsing field option: %s", err) + var RequestBody *openapi.RequestBodyOrReference + + if inputDesc != nil { + for _, v := range inputDesc.GetFields() { + var paramName, paramIn, paramDesc string + var fieldSchema *openapi.SchemaOrReference + required := false + + extOrNil := v.Annotations[consts.ApiQuery] + if len(extOrNil) > 0 { + if ext := v.Annotations[consts.ApiQuery][0]; ext != "" { + paramIn = consts.ParameterInQuery + paramName = ext + paramDesc = g.filterCommentString(v.Comments) + fieldSchema = g.schemaOrReferenceForField(v.Type) + extPropertyOrNil := v.Annotations[consts.OpenapiProperty] + if len(extPropertyOrNil) > 0 && fieldSchema.IsSetSchema() { + newFieldSchema := &openapi.Schema{} + err := utils.ParseFieldOption(v, consts.OpenapiProperty, &newFieldSchema) + if err != nil { + logs.Errorf("Error parsing field option: %s", err) + } + common.MergeStructs(fieldSchema.Schema, newFieldSchema) } - common.MergeStructs(fieldSchema.Schema, newFieldSchema) } } - } - extOrNil = v.Annotations[consts.ApiPath] - if len(extOrNil) > 0 { - if ext := v.Annotations[consts.ApiPath][0]; ext != "" { - paramIn = consts.ParameterInPath - paramName = ext - paramDesc = g.filterCommentString(v.Comments) - fieldSchema = g.schemaOrReferenceForField(v.Type) - extPropertyOrNil := v.Annotations[consts.OpenapiProperty] - if len(extPropertyOrNil) > 0 { - newFieldSchema := &openapi.Schema{} - err := utils.ParseFieldOption(v, consts.OpenapiProperty, &newFieldSchema) - if err != nil { - logs.Errorf("Error parsing field option: %s", err) + extOrNil = v.Annotations[consts.ApiPath] + if len(extOrNil) > 0 { + if ext := v.Annotations[consts.ApiPath][0]; ext != "" { + paramIn = consts.ParameterInPath + paramName = ext + paramDesc = g.filterCommentString(v.Comments) + fieldSchema = g.schemaOrReferenceForField(v.Type) + extPropertyOrNil := v.Annotations[consts.OpenapiProperty] + if len(extPropertyOrNil) > 0 && fieldSchema.IsSetSchema() { + newFieldSchema := &openapi.Schema{} + err := utils.ParseFieldOption(v, consts.OpenapiProperty, &newFieldSchema) + if err != nil { + logs.Errorf("Error parsing field option: %s", err) + } + common.MergeStructs(fieldSchema.Schema, newFieldSchema) } - common.MergeStructs(fieldSchema.Schema, newFieldSchema) + required = true } - required = true } - } - extOrNil = v.Annotations[consts.ApiCookie] - if len(extOrNil) > 0 { - if ext := v.Annotations[consts.ApiCookie][0]; ext != "" { - paramIn = consts.ParameterInCookie - paramName = ext - paramDesc = g.filterCommentString(v.Comments) - fieldSchema = g.schemaOrReferenceForField(v.Type) - extPropertyOrNil := v.Annotations[consts.OpenapiProperty] - if len(extPropertyOrNil) > 0 { - newFieldSchema := &openapi.Schema{} - err := utils.ParseFieldOption(v, consts.OpenapiProperty, &newFieldSchema) - if err != nil { - logs.Errorf("Error parsing field option: %s", err) + extOrNil = v.Annotations[consts.ApiCookie] + if len(extOrNil) > 0 { + if ext := v.Annotations[consts.ApiCookie][0]; ext != "" { + paramIn = consts.ParameterInCookie + paramName = ext + paramDesc = g.filterCommentString(v.Comments) + fieldSchema = g.schemaOrReferenceForField(v.Type) + extPropertyOrNil := v.Annotations[consts.OpenapiProperty] + if len(extPropertyOrNil) > 0 && fieldSchema.IsSetSchema() { + newFieldSchema := &openapi.Schema{} + err := utils.ParseFieldOption(v, consts.OpenapiProperty, &newFieldSchema) + if err != nil { + logs.Errorf("Error parsing field option: %s", err) + } + common.MergeStructs(fieldSchema.Schema, newFieldSchema) } - common.MergeStructs(fieldSchema.Schema, newFieldSchema) } } - } - extOrNil = v.Annotations[consts.ApiHeader] - if len(extOrNil) > 0 { - if ext := v.Annotations[consts.ApiHeader][0]; ext != "" { - paramIn = consts.ParameterInHeader - paramName = ext - paramDesc = g.filterCommentString(v.Comments) - fieldSchema = g.schemaOrReferenceForField(v.Type) - extPropertyOrNil := v.Annotations[consts.OpenapiProperty] - if len(extPropertyOrNil) > 0 { - newFieldSchema := &openapi.Schema{} - err := utils.ParseFieldOption(v, consts.OpenapiProperty, &newFieldSchema) - if err != nil { - logs.Errorf("Error parsing field option: %s", err) + extOrNil = v.Annotations[consts.ApiHeader] + if len(extOrNil) > 0 { + if ext := v.Annotations[consts.ApiHeader][0]; ext != "" { + paramIn = consts.ParameterInHeader + paramName = ext + paramDesc = g.filterCommentString(v.Comments) + fieldSchema = g.schemaOrReferenceForField(v.Type) + extPropertyOrNil := v.Annotations[consts.OpenapiProperty] + if len(extPropertyOrNil) > 0 && fieldSchema.IsSetSchema() { + newFieldSchema := &openapi.Schema{} + err := utils.ParseFieldOption(v, consts.OpenapiProperty, &newFieldSchema) + if err != nil { + logs.Errorf("Error parsing field option: %s", err) + } + common.MergeStructs(fieldSchema.Schema, newFieldSchema) } - common.MergeStructs(fieldSchema.Schema, newFieldSchema) } } - } - parameter := &openapi.Parameter{ - Name: paramName, - In: paramIn, - Description: paramDesc, - Required: required, - Schema: fieldSchema, - } + parameter := &openapi.Parameter{ + Name: paramName, + In: paramIn, + Description: paramDesc, + Required: required, + Schema: fieldSchema, + } - var extParameter *openapi.Parameter - err := utils.ParseFieldOption(v, consts.OpenapiParameter, &extParameter) - if err != nil { - logs.Errorf("Error parsing field option: %s", err) - } - common.MergeStructs(parameter, extParameter) + var extParameter *openapi.Parameter + err := utils.ParseFieldOption(v, consts.OpenapiParameter, &extParameter) + if err != nil { + logs.Errorf("Error parsing field option: %s", err) + } + common.MergeStructs(parameter, extParameter) - // Append the parameter to the parameters array if it was set - if paramName != "" && paramIn != "" { - parameters = append(parameters, &openapi.ParameterOrReference{ - Parameter: parameter, - }) + // Append the parameter to the parameters array if it was set + if paramName != "" && paramIn != "" { + parameters = append(parameters, &openapi.ParameterOrReference{ + Parameter: parameter, + }) + } } - } - var RequestBody *openapi.RequestBodyOrReference - - if inputDesc != nil { if methodName != consts.HttpMethodGet && methodName != consts.HttpMethodHead && methodName != consts.HttpMethodDelete { var additionalProperties []*openapi.NamedMediaType bodySchema := g.getSchemaByOption(inputDesc, consts.ApiBody) - if len(bodySchema.Properties.AdditionalProperties) > 0 { + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { bodyRefSchema := &openapi.NamedSchemaOrReference{ Name: inputDesc.GetName() + consts.ComponentSchemaSuffixBody, Value: &openapi.SchemaOrReference{Schema: bodySchema}, @@ -468,7 +479,7 @@ func (g *OpenAPIGenerator) buildOperation( formSchema := g.getSchemaByOption(inputDesc, consts.ApiForm) - if len(formSchema.Properties.AdditionalProperties) > 0 { + if formSchema != nil && formSchema.Properties != nil && len(formSchema.Properties.AdditionalProperties) > 0 { formRefSchema := &openapi.NamedSchemaOrReference{ Name: inputDesc.GetName() + consts.ComponentSchemaSuffixForm, Value: &openapi.SchemaOrReference{Schema: formSchema}, @@ -499,7 +510,7 @@ func (g *OpenAPIGenerator) buildOperation( rawBodySchema := g.getSchemaByOption(inputDesc, consts.ApiRawBody) - if len(rawBodySchema.Properties.AdditionalProperties) > 0 { + if rawBodySchema != nil && rawBodySchema.Properties != nil && len(rawBodySchema.Properties.AdditionalProperties) > 0 { rawBodyRefSchema := &openapi.NamedSchemaOrReference{ Name: inputDesc.GetName() + consts.ComponentSchemaSuffixRawBody, Value: &openapi.SchemaOrReference{Schema: rawBodySchema}, @@ -578,7 +589,7 @@ func (g *OpenAPIGenerator) buildOperation( } func (g *OpenAPIGenerator) processResponse(d *openapi.Document, desc *thrift_reflection.StructDescriptor, statusCode string) *openapi.NamedResponseOrReference { - name, header, content := g.getResponseForStruct(d, desc, statusCode) + header, content := g.getResponseForStruct(d, desc) description := g.filterCommentString(desc.Comments) if description == "" { @@ -590,12 +601,12 @@ func (g *OpenAPIGenerator) processResponse(d *openapi.Document, desc *thrift_ref } var headerOrEmpty *openapi.HeadersOrReferences - if len(header.AdditionalProperties) != 0 { + if header != nil && len(header.AdditionalProperties) != 0 { headerOrEmpty = header } var contentOrEmpty *openapi.MediaTypes - if len(content.AdditionalProperties) != 0 { + if content != nil && len(content.AdditionalProperties) != 0 { contentOrEmpty = content } @@ -604,7 +615,7 @@ func (g *OpenAPIGenerator) processResponse(d *openapi.Document, desc *thrift_ref } return &openapi.NamedResponseOrReference{ - Name: name, + Name: statusCode, Value: &openapi.ResponseOrReference{ Response: &openapi.Response{ Description: description, @@ -634,7 +645,7 @@ func (g *OpenAPIGenerator) getDocumentAnnotationInWhichServiceOrStruct() (string return "", ret } -func (g *OpenAPIGenerator) getResponseForStruct(d *openapi.Document, desc *thrift_reflection.StructDescriptor, statusCode string) (string, *openapi.HeadersOrReferences, *openapi.MediaTypes) { +func (g *OpenAPIGenerator) getResponseForStruct(d *openapi.Document, desc *thrift_reflection.StructDescriptor) (*openapi.HeadersOrReferences, *openapi.MediaTypes) { headers := &openapi.HeadersOrReferences{AdditionalProperties: []*openapi.NamedHeaderOrReference{}} for _, field := range desc.Fields { @@ -661,7 +672,7 @@ func (g *OpenAPIGenerator) getResponseForStruct(d *openapi.Document, desc *thrif rawBodySchema := g.getSchemaByOption(desc, consts.ApiRawBody) var additionalProperties []*openapi.NamedMediaType - if len(bodySchema.Properties.AdditionalProperties) > 0 { + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { refSchema := &openapi.NamedSchemaOrReference{ Name: desc.GetName() + consts.ComponentSchemaSuffixBody, Value: &openapi.SchemaOrReference{Schema: bodySchema}, @@ -678,7 +689,7 @@ func (g *OpenAPIGenerator) getResponseForStruct(d *openapi.Document, desc *thrif }) } - if len(rawBodySchema.Properties.AdditionalProperties) > 0 { + if rawBodySchema != nil && len(rawBodySchema.Properties.AdditionalProperties) > 0 { refSchema := &openapi.NamedSchemaOrReference{ Name: desc.GetName() + consts.ComponentSchemaSuffixRawBody, Value: &openapi.SchemaOrReference{Schema: rawBodySchema}, @@ -699,7 +710,7 @@ func (g *OpenAPIGenerator) getResponseForStruct(d *openapi.Document, desc *thrif AdditionalProperties: additionalProperties, } - return statusCode, headers, content + return headers, content } func (g *OpenAPIGenerator) getSchemaByOption(inputDesc *thrift_reflection.StructDescriptor, option string) *openapi.Schema { diff --git a/thrift-gen-rpc-swagger/generator/openapi_gen.go b/thrift-gen-rpc-swagger/generator/openapi_gen.go index 5022778..00d27fa 100644 --- a/thrift-gen-rpc-swagger/generator/openapi_gen.go +++ b/thrift-gen-rpc-swagger/generator/openapi_gen.go @@ -205,17 +205,26 @@ func (g *OpenAPIGenerator) BuildDocument(arguments *args.Arguments) []*plugin.Ge func (g *OpenAPIGenerator) getDocumentOption(obj interface{}) error { serviceOrStruct, name := g.getDocumentAnnotationInWhichServiceOrStruct() + + if serviceOrStruct == "" || name == "" { + return nil + } + if serviceOrStruct == consts.DocumentOptionServiceType { serviceDesc := g.fileDesc.GetServiceDescriptor(name) - err := utils.ParseServiceOption(serviceDesc, consts.OpenapiDocument, obj) - if err != nil { - return err + if serviceDesc != nil { + err := utils.ParseServiceOption(serviceDesc, consts.OpenapiDocument, obj) + if err != nil { + return err + } } } else if serviceOrStruct == consts.DocumentOptionStructType { structDesc := g.fileDesc.GetStructDescriptor(name) - err := utils.ParseStructOption(structDesc, consts.OpenapiDocument, obj) - if err != nil { - return err + if structDesc != nil { + err := utils.ParseStructOption(structDesc, consts.OpenapiDocument, obj) + if err != nil { + return err + } } } return nil @@ -224,71 +233,73 @@ func (g *OpenAPIGenerator) getDocumentOption(obj interface{}) error { func (g *OpenAPIGenerator) addPathsToDocument(d *openapi.Document, services []*thrift_reflection.ServiceDescriptor) { var err error for _, s := range services { - annotationsCount := 0 - for _, m := range s.GetMethods() { - var inputDesc, outputDesc, throwDesc *thrift_reflection.StructDescriptor - - if len(m.Args) > 0 { - if len(m.Args) > 1 { - logs.Warnf("function '%s' has more than one argument, but only the first can be used in plugin now", m.GetName()) + if s != nil { + annotationsCount := 0 + for _, m := range s.GetMethods() { + var inputDesc, outputDesc, throwDesc *thrift_reflection.StructDescriptor + + if len(m.Args) > 0 { + if len(m.Args) > 1 { + logs.Warnf("function '%s' has more than one argument, but only the first can be used in plugin now", m.GetName()) + } + // TODO: support more argument types + if m.Args[0].GetType().IsStruct() { + inputDesc, err = m.Args[0].GetType().GetStructDescriptor() + if err != nil { + logs.Errorf("Error getting arguments descriptor: %s", err) + } + } else { + logs.Errorf("now only support struct type for input, but got %s", m.Args[0].GetType().GetName()) + } } - // TODO: support more argument types - if m.Args[0].GetType().IsStruct() { - inputDesc, err = m.Args[0].GetType().GetStructDescriptor() + + // TODO: support more response types + if m.Response.IsStruct() { + outputDesc, err = m.Response.GetStructDescriptor() if err != nil { - logs.Errorf("Error getting arguments descriptor: %s", err) + logs.Errorf("Error getting response descriptor: %s", err) } - } else { - logs.Errorf("now only support struct type for input, but got %s", m.Args[0].GetType().GetName()) + } else if m.Response.Name != "void" { + logs.Errorf("now only support struct type for output, but got %s", m.Response.Name) } - } - // TODO: support more response types - if m.Response.IsStruct() { - outputDesc, err = m.Response.GetStructDescriptor() - if err != nil { - logs.Errorf("Error getting response descriptor: %s", err) + if len(m.ThrowExceptions) > 0 { + throwDesc, err = m.ThrowExceptions[0].GetType().GetExceptionDescriptor() + if err != nil { + logs.Errorf("Error getting exception descriptor: %s", err) + } } - } else if m.Response.Name != "void" { - logs.Errorf("now only support struct type for output, but got %s", m.Response.Name) - } + var host string - if len(m.ThrowExceptions) > 0 { - throwDesc, err = m.ThrowExceptions[0].GetType().GetExceptionDescriptor() - if err != nil { - logs.Errorf("Error getting exception descriptor: %s", err) + if urls, ok := m.Annotations[consts.ApiBaseURL]; ok && len(urls) > 0 { + host = urls[0] + } else if domains, ok := s.Annotations[consts.ApiBaseDomain]; ok && len(domains) > 0 { + host = domains[0] } - } - var host string - if urls, ok := m.Annotations[consts.ApiBaseURL]; ok && len(urls) > 0 { - host = urls[0] - } else if domains, ok := s.Annotations[consts.ApiBaseDomain]; ok && len(domains) > 0 { - host = domains[0] - } + annotationsCount++ + operationID := s.GetName() + "_" + m.GetName() + path := "/" + m.GetName() + comment := g.filterCommentString(m.Comments) - annotationsCount++ - operationID := s.GetName() + "_" + m.GetName() - path := "/" + m.GetName() - comment := g.filterCommentString(m.Comments) + op, path2 := g.buildOperation(d, comment, operationID, s.GetName(), path, host, inputDesc, outputDesc, throwDesc) - op, path2 := g.buildOperation(d, comment, operationID, s.GetName(), path, host, inputDesc, outputDesc, throwDesc) + newOp := &openapi.Operation{} + err = utils.ParseMethodOption(m, consts.OpenapiOperation, &newOp) + if err != nil { + logs.Errorf("Error parsing method option: %s", err) + } + err = common.MergeStructs(op, newOp) + if err != nil { + logs.Errorf("Error merging method option: %s", err) + } - newOp := &openapi.Operation{} - err = utils.ParseMethodOption(m, consts.OpenapiOperation, &newOp) - if err != nil { - logs.Errorf("Error parsing method option: %s", err) + g.addOperationToDocument(d, op, path2) } - err = common.MergeStructs(op, newOp) - if err != nil { - logs.Errorf("Error merging method option: %s", err) + if annotationsCount > 0 { + comment := g.filterCommentString(s.Comments) + d.Tags = append(d.Tags, &openapi.Tag{Name: s.GetName(), Description: comment}) } - - g.addOperationToDocument(d, op, path2) - } - if annotationsCount > 0 { - comment := g.filterCommentString(s.Comments) - d.Tags = append(d.Tags, &openapi.Tag{Name: s.GetName(), Description: comment}) } } } @@ -329,7 +340,7 @@ func (g *OpenAPIGenerator) buildOperation( bodySchema := g.getSchemaByOption(inputDesc) var additionalProperties []*openapi.NamedMediaType - if len(bodySchema.Properties.AdditionalProperties) > 0 { + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { refSchema := &openapi.NamedSchemaOrReference{ Name: inputDesc.GetName(), Value: &openapi.SchemaOrReference{Schema: bodySchema}, @@ -377,7 +388,7 @@ func (g *OpenAPIGenerator) buildOperation( desc = consts.DefaultResponseDesc } - if len(content.AdditionalProperties) != 0 { + if content != nil && len(content.AdditionalProperties) != 0 { contentOrEmpty = content } @@ -477,7 +488,7 @@ func (g *OpenAPIGenerator) getResponseForStruct(d *openapi.Document, desc *thrif var additionalProperties []*openapi.NamedMediaType - if len(bodySchema.Properties.AdditionalProperties) > 0 { + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { refSchema := &openapi.NamedSchemaOrReference{ Name: desc.GetName(), Value: &openapi.SchemaOrReference{Schema: bodySchema}, @@ -506,7 +517,7 @@ func (g *OpenAPIGenerator) getExceptionForStruct(d *openapi.Document, desc *thri var additionalProperties []*openapi.NamedMediaType - if len(bodySchema.Properties.AdditionalProperties) > 0 { + if bodySchema != nil && bodySchema.Properties != nil && len(bodySchema.Properties.AdditionalProperties) > 0 { refSchema := &openapi.NamedSchemaOrReference{ Name: desc.GetName(), Value: &openapi.SchemaOrReference{Schema: bodySchema}, diff --git a/thrift-gen-rpc-swagger/go.mod b/thrift-gen-rpc-swagger/go.mod index 34b2e37..5286da6 100644 --- a/thrift-gen-rpc-swagger/go.mod +++ b/thrift-gen-rpc-swagger/go.mod @@ -1,15 +1,74 @@ module github.com/hertz-contrib/swagger-generate/thrift-gen-rpc-swagger -go 1.16 +go 1.22.0 require ( - github.com/bytedance/gopkg v0.0.0-20240514070511-01b2cbcf35e1 - github.com/cloudwego/hertz v0.9.2 - github.com/cloudwego/hertz/cmd/hz v0.9.1 + github.com/bytedance/gopkg v0.1.0 + github.com/cloudwego/hertz v0.9.3 + github.com/cloudwego/hertz/cmd/hz v0.9.0 github.com/cloudwego/kitex v0.10.3 - github.com/cloudwego/thriftgo v0.3.15 + github.com/cloudwego/thriftgo v0.3.17 github.com/hertz-contrib/cors v0.1.0 github.com/hertz-contrib/swagger v0.1.0 github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5 github.com/swaggo/files v1.0.1 ) + +require ( + github.com/KyleBanks/depth v1.2.1 // indirect + github.com/apache/thrift v0.21.0 // indirect + github.com/bufbuild/protocompile v0.14.1 // indirect + github.com/bytedance/go-tagexpr/v2 v2.9.2 // indirect + github.com/bytedance/sonic v1.12.0 // indirect + github.com/bytedance/sonic/loader v0.2.0 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/configmanager v0.2.2 // indirect + github.com/cloudwego/dynamicgo v0.2.9 // indirect + github.com/cloudwego/fastpb v0.0.4 // indirect + github.com/cloudwego/frugal v0.1.15 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/cloudwego/localsession v0.0.2 // indirect + github.com/cloudwego/netpoll v0.6.3 // indirect + github.com/cloudwego/runtimex v0.1.0 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/fatih/structtag v1.2.0 // indirect + github.com/fsnotify/fsnotify v1.5.4 // indirect + github.com/go-openapi/jsonpointer v0.20.0 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/spec v0.20.9 // indirect + github.com/go-openapi/swag v0.22.4 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/pprof v0.0.0-20220608213341-c488b8fa1db3 // indirect + github.com/henrylee2cn/ameda v1.4.10 // indirect + github.com/henrylee2cn/goutil v0.0.0-20210127050712-89660552f6f8 // indirect + github.com/iancoleman/strcase v0.2.0 // indirect + github.com/jhump/protoreflect v1.17.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/cpuid/v2 v2.2.4 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/gls v0.0.0-20220109145502-612d0167dce5 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/nyaruka/phonenumbers v1.0.55 // indirect + github.com/oleiade/lane v1.0.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/stretchr/testify v1.9.0 // indirect + github.com/swaggo/swag v1.16.1 // indirect + github.com/tidwall/gjson v1.14.4 // indirect + github.com/tidwall/match v1.1.1 // indirect + github.com/tidwall/pretty v1.2.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect + golang.org/x/arch v0.2.0 // indirect + golang.org/x/net v0.30.0 // indirect + golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect + golang.org/x/text v0.19.0 // indirect + golang.org/x/tools v0.26.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect + google.golang.org/protobuf v1.35.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) + +replace github.com/apache/thrift v0.21.0 => github.com/apache/thrift v0.13.0 diff --git a/thrift-gen-rpc-swagger/go.sum b/thrift-gen-rpc-swagger/go.sum index bb0d615..f81e34d 100644 --- a/thrift-gen-rpc-swagger/go.sum +++ b/thrift-gen-rpc-swagger/go.sum @@ -10,8 +10,6 @@ github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6Xge github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= -github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= -github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= @@ -20,23 +18,28 @@ github.com/apache/thrift v0.13.0 h1:5hryIiq9gtn+MiLVn0wP37kb/uTeRZgN08WoCsAhIhI= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/bufbuild/protocompile v0.14.1 h1:iA73zAf/fyljNjQKwYzUHD6AD4R8KMasmwa/FBatYVw= +github.com/bufbuild/protocompile v0.14.1/go.mod h1:ppVdAIhbr2H8asPk6k4pY7t9zB1OU5DoEw9xY/FUi1c= github.com/bytedance/go-tagexpr/v2 v2.9.2 h1:QySJaAIQgOEDQBLS3x9BxOWrnhqu5sQ+f6HaZIxD39I= github.com/bytedance/go-tagexpr/v2 v2.9.2/go.mod h1:5qsx05dYOiUXOUgnQ7w3Oz8BYs2qtM/bJokdLb79wRM= github.com/bytedance/gopkg v0.0.0-20220413063733-65bf48ffb3a7/go.mod h1:2ZlV9BaUH4+NXIBF0aMdKKAnHTzqH+iMU4KUjAbL23Q= github.com/bytedance/gopkg v0.0.0-20230728082804-614d0af6619b/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ= github.com/bytedance/gopkg v0.0.0-20240507064146-197ded923ae3/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ= -github.com/bytedance/gopkg v0.0.0-20240514070511-01b2cbcf35e1 h1:rT7Mm6uUpHeZQzfs2v0Mlj0SL02CzyVi+EB7VYPM/z4= github.com/bytedance/gopkg v0.0.0-20240514070511-01b2cbcf35e1/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ= -github.com/bytedance/mockey v1.2.1 h1:g84ngI88hz1DR4wZTL3yOuqlEcq67MretBfQUdXwrmw= +github.com/bytedance/gopkg v0.1.0 h1:aAxB7mm1qms4Wz4sp8e1AtKDOeFLtdqvGiUe7aonRJs= +github.com/bytedance/gopkg v0.1.0/go.mod h1:FtQG3YbQG9L/91pbKSw787yBQPutC+457AvDW77fgUQ= github.com/bytedance/mockey v1.2.1/go.mod h1:+Jm/fzWZAuhEDrPXVjDf/jLM2BlLXJkwk94zf2JZ3X4= -github.com/bytedance/sonic v1.3.0/go.mod h1:V973WhNhGmvHxW6nQmsHEfHaoU9F3zTF+93rH03hcUQ= +github.com/bytedance/mockey v1.2.12 h1:aeszOmGw8CPX8CRx1DZ/Glzb1yXvhjDh6jdFBNZjsU4= +github.com/bytedance/mockey v1.2.12/go.mod h1:3ZA4MQasmqC87Tw0w7Ygdy7eHIc2xgpZ8Pona5rsYIk= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.8.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= -github.com/bytedance/sonic v1.11.8 h1:Zw/j1KfiS+OYTi9lyB3bb0CFxPJVkM17k1wyDG32LRA= github.com/bytedance/sonic v1.11.8/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= -github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= +github.com/bytedance/sonic v1.12.0 h1:YGPgxF9xzaCNvd/ZKdQ28yRovhfMFZQjuk6fKBzZ3ls= +github.com/bytedance/sonic v1.12.0/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= +github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk= @@ -54,12 +57,11 @@ github.com/cloudwego/fastpb v0.0.4 h1:/ROVVfoFtpfc+1pkQLzGs+azjxUbSOsAqSY4tAAx4m github.com/cloudwego/fastpb v0.0.4/go.mod h1:/V13XFTq2TUkxj2qWReV8MwfPC4NnPcy6FsrojnsSG0= github.com/cloudwego/frugal v0.1.15 h1:LC55UJKhQPMFVjDPbE+LJcF7etZjSx6uokG1tk0wPK0= github.com/cloudwego/frugal v0.1.15/go.mod h1:26kU1r18vA8vRg12c66XPDlfv1GQHDbE1RpusipXfcI= -github.com/cloudwego/hertz v0.0.1/go.mod h1:prTyExvsH/UmDkvfU3dp3EHsZFQISfT8R7BirvpTKdo= github.com/cloudwego/hertz v0.6.2/go.mod h1:2em2hGREvCBawsTQcQxyWBGVlCeo+N1pp2q0HkkbwR0= -github.com/cloudwego/hertz v0.9.2 h1:VbqddZ5RuvcgxzfxvXcmTiRisGYoo0+WnHGeDJKhjqI= -github.com/cloudwego/hertz v0.9.2/go.mod h1:cs8dH6unM4oaJ5k9m6pqbgLBPqakGWMG0+cthsxitsg= -github.com/cloudwego/hertz/cmd/hz v0.9.1 h1:v75TueFIZhTgYYnoM+6VxKHu58ZS3HJ+Qp4T07UYcKk= -github.com/cloudwego/hertz/cmd/hz v0.9.1/go.mod h1:6SroAwvZkyL54CiPANDkTR3YoX2MY4ZOW1+gtmWhRJE= +github.com/cloudwego/hertz v0.9.3 h1:uajvLn6LjEPjUqN/ewUZtWoRQWa2es2XTELdqDlOYMw= +github.com/cloudwego/hertz v0.9.3/go.mod h1:gGVUfJU/BOkJv/ZTzrw7FS7uy7171JeYIZvAyV3wS3o= +github.com/cloudwego/hertz/cmd/hz v0.9.0 h1:qkB5KpYklnsS5PbGjwtb/UXDtKPZzdXehwy4wGeWXA0= +github.com/cloudwego/hertz/cmd/hz v0.9.0/go.mod h1:6SroAwvZkyL54CiPANDkTR3YoX2MY4ZOW1+gtmWhRJE= github.com/cloudwego/iasm v0.0.9/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= @@ -67,19 +69,17 @@ github.com/cloudwego/kitex v0.10.3 h1:L3JRkb25oXMf1ROslQNY7E9EpaUBBjJWwjGfkQERJ+ github.com/cloudwego/kitex v0.10.3/go.mod h1:6wYnJc0TpKnHwM8/Fcy2YrQNyrlmpMYP0y5ADZrqYsc= github.com/cloudwego/localsession v0.0.2 h1:N9/IDtCPj1fCL9bCTP+DbXx3f40YjVYWcwkJG0YhQkY= github.com/cloudwego/localsession v0.0.2/go.mod h1:kiJxmvAcy4PLgKtEnPS5AXed3xCiXcs7Z+KBHP72Wv8= -github.com/cloudwego/netpoll v0.2.4/go.mod h1:1T2WVuQ+MQw6h6DpE45MohSvDTKdy2DlzCx2KsnPI4E= github.com/cloudwego/netpoll v0.3.1/go.mod h1:1T2WVuQ+MQw6h6DpE45MohSvDTKdy2DlzCx2KsnPI4E= -github.com/cloudwego/netpoll v0.6.0/go.mod h1:xVefXptcyheopwNDZjDPcfU6kIjZXZ4nY550k1yH9eQ= github.com/cloudwego/netpoll v0.6.3 h1:t+ndlwBFjQZimUj3ul31DwI45t18eOr2pcK3juZZm+E= github.com/cloudwego/netpoll v0.6.3/go.mod h1:kaqvfZ70qd4T2WtIIpCOi5Cxyob8viEpzLhCrTrz3HM= github.com/cloudwego/runtimex v0.1.0 h1:HG+WxWoj5/CDChDZ7D99ROwvSMkuNXAqt6hnhTTZDiI= github.com/cloudwego/runtimex v0.1.0/go.mod h1:23vL/HGV0W8nSCHbe084AgEBdDV4rvXenEUMnUNvUd8= github.com/cloudwego/thriftgo v0.1.7/go.mod h1:LzeafuLSiHA9JTiWC8TIMIq64iadeObgRUhmVG1OC/w= github.com/cloudwego/thriftgo v0.3.6/go.mod h1:29ukiySoAMd0vXMYIduAY9dph/7dmChvOS11YLotFb8= -github.com/cloudwego/thriftgo v0.3.15 h1:yB/DDGjeSjliyidMVBjKhGl9RgE4M8iVIz5dKpAIyUs= github.com/cloudwego/thriftgo v0.3.15/go.mod h1:R4a+4aVDI0V9YCTfpNgmvbkq/9ThKgF7Om8Z0I36698= +github.com/cloudwego/thriftgo v0.3.17 h1:k0iQe2jEAN1WhPsXWvatwHzoxObUSX2Nw5NqdnywS8k= +github.com/cloudwego/thriftgo v0.3.17/go.mod h1:AdLEJJVGW/ZJYvkkYAZf5SaJH+pA3OyC801WSwqcBwI= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -112,11 +112,9 @@ github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34 github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ= github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA= -github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/spec v0.20.9 h1:xnlYNQAwKd2VQRRfwTEI0DcK+2cbuvI/0c7jx3gA8/8= github.com/go-openapi/spec v0.20.9/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= @@ -126,7 +124,6 @@ github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogB github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/goccy/go-json v0.9.4/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -154,8 +151,9 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20220608213341-c488b8fa1db3 h1:mpL/HvfIgIejhVwAfxBQkwEjlhP5o0O9RAeTAjpwzxc= github.com/google/pprof v0.0.0-20220608213341-c488b8fa1db3/go.mod h1:gSuNB+gJaOiQKLEZ+q+PK9Mq3SOzhRcw2GsGS/FhYDk= @@ -187,8 +185,9 @@ github.com/jhump/gopoet v0.1.0/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+ github.com/jhump/goprotoc v0.5.0/go.mod h1:VrbvcYrQOrTi3i0Vf+m+oqQWk9l72mjkJCYo7UvLHRQ= github.com/jhump/protoreflect v1.8.2/go.mod h1:7GcYQDdMU/O/BBrl/cX6PNHpXh6cenjd8pneu5yW7Tg= github.com/jhump/protoreflect v1.11.0/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= -github.com/jhump/protoreflect v1.12.0 h1:1NQ4FpWMgn3by/n1X0fbeKEUxP1wBt7+Oitpv01HR10= github.com/jhump/protoreflect v1.12.0/go.mod h1:JytZfP5d0r8pVNLZvai7U/MCuTWITgrI4tTg7puQFKI= +github.com/jhump/protoreflect v1.17.0 h1:qOEr613fac2lOuTgWN4tPAtLL7fUSbuJL5X5XumQh94= +github.com/jhump/protoreflect v1.17.0/go.mod h1:h9+vUUL38jiBzck8ck+6G/aeMX8Z4QUY/NiJPwPNi+8= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -233,22 +232,18 @@ github.com/oleiade/lane v1.0.1/go.mod h1:IyTkraa4maLfjq/GmHR+Dxb4kCMtEGeb+qmhlrQ github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= @@ -267,15 +262,13 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/swaggo/files v0.0.0-20210815190702-a29dd2bc99b2/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE= github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg= github.com/swaggo/swag v1.16.1 h1:fTNRhKstPKxcnoKsytm4sahr8FaYzUcT7i1/3nd/fBg= github.com/swaggo/swag v1.16.1/go.mod h1:9/LMvHycG3NFHfR6LwvikHv5iFvmPADQ359cKikGxto= github.com/tidwall/gjson v1.9.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.13.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= @@ -283,10 +276,8 @@ github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/urfave/cli/v2 v2.23.0/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -305,7 +296,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -341,9 +331,8 @@ golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -356,8 +345,6 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= @@ -365,11 +352,10 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= +golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -380,8 +366,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -394,7 +380,6 @@ golang.org/x/sys v0.0.0-20210304124612-50617c2ba197/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -409,19 +394,16 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -433,11 +415,10 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= +golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -460,13 +441,11 @@ golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= -golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= -golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0= @@ -481,15 +460,17 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384 h1:z+j74wi4yV+P7EtK9gPLGukOk7mFOy9wMQaC0wNb7eY= google.golang.org/genproto v0.0.0-20210513213006-bf773b8c8384/go.mod h1:P3QM42oQyzQSnHPnZ/vqoCdDmzH28fzWByN9asMeM8A= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 h1:Jyp0Hsi0bmHXG6k9eATXoYtjd6e2UzZ1SCn/wIupY14= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17/go.mod h1:oQ5rr10WTTMvP4A36n8JpR1OrO1BEiV4f78CneXZxkA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= +google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -505,9 +486,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= +google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -516,14 +496,12 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -532,4 +510,3 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=