aggregate

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator struct {
	// contains filtered or unexported fields
}

Aggregator 聚合器,负责加载、预处理、合并多个服务的 Swagger 规范

func NewAggregator

func NewAggregator(config *goswagger.Swagger, logger logger.ILogger) *Aggregator

NewAggregator 创建聚合器

func (*Aggregator) ExtractEndpoints added in v0.1.1

func (a *Aggregator) ExtractEndpoints() []Endpoint

ExtractEndpoints 从已加载的服务规范中提取所有端点 返回按服务名排序的端点列表,同一 operationId 只保留首次出现的端点

func (*Aggregator) GetAggregatedSpec

func (a *Aggregator) GetAggregatedSpec() ([]byte, error)

GetAggregatedSpec 获取聚合后的 Swagger 规范 JSON

func (*Aggregator) GetAggregatedSpecMap

func (a *Aggregator) GetAggregatedSpecMap() map[string]interface{}

GetAggregatedSpecMap 获取聚合规范 map(供 documents 模块使用)

func (*Aggregator) GetLastUpdated

func (a *Aggregator) GetLastUpdated() time.Time

GetLastUpdated 获取最后更新时间

func (*Aggregator) GetServiceSpec

func (a *Aggregator) GetServiceSpec(serviceName string) ([]byte, error)

GetServiceSpec 获取单个服务的规范 JSON

func (*Aggregator) GetServiceSpecs

func (a *Aggregator) GetServiceSpecs() map[string]map[string]interface{}

GetServiceSpecs 获取所有已加载的服务规范

func (*Aggregator) LoadAll

func (a *Aggregator) LoadAll() error

LoadAll 加载所有服务的 Swagger 规范并执行聚合

type Endpoint added in v0.1.1

type Endpoint struct {
	SourceFile  string   // 来源文件名(如 proto/tenant/tenant_service.swagger.yaml)
	ServiceName string   // 来源服务名(文件名去掉扩展名和下划线后的 PascalCase)
	Path        string   // API 路径
	Method      string   // HTTP 方法(大写,如 GET、POST)
	OperationID string   // operationId
	Summary     string   // 接口摘要
	Tags        []string // 标签列表
}

Endpoint 表示从 Swagger 规范中提取的接口端点

func ExtractEndpointsFromEmbed added in v0.1.1

func ExtractEndpointsFromEmbed(swaggerFiles map[string][]byte) ([]Endpoint, error)

ExtractEndpointsFromEmbed 从内嵌的 Swagger 文件数据中提取所有端点 swaggerFiles: 文件名 -> 文件内容的映射(GetSwaggerFiles() 的返回值)

type ServiceSpecConfig

type ServiceSpecConfig interface {
	GetName() string
	GetBasePath() string
	GetTags() []string
}

ServiceSpecConfig 服务规范配置接口,解耦对 goswagger.ServiceSpec 的直接依赖

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL