Documentation
¶
Index ¶
- type Aggregator
- func (a *Aggregator) ExtractEndpoints() []Endpoint
- func (a *Aggregator) GetAggregatedSpec() ([]byte, error)
- func (a *Aggregator) GetAggregatedSpecMap() map[string]interface{}
- func (a *Aggregator) GetLastUpdated() time.Time
- func (a *Aggregator) GetServiceSpec(serviceName string) ([]byte, error)
- func (a *Aggregator) GetServiceSpecs() map[string]map[string]interface{}
- func (a *Aggregator) LoadAll() error
- type Endpoint
- type ServiceSpecConfig
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 获取所有已加载的服务规范
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 规范中提取的接口端点
type ServiceSpecConfig ¶
ServiceSpecConfig 服务规范配置接口,解耦对 goswagger.ServiceSpec 的直接依赖
Click to show internal directories.
Click to hide internal directories.