Help us shape the future of Go! Take the 2026 Go Developer Survey

schema

package
v1.38.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package schema 从内嵌 OpenAPI 生成 API 自省视图,供 `gitferry schema` 使用。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Domain

type Domain struct {
	Name      string     `json:"name"`
	Prefix    string     `json:"prefix"`
	Endpoints []Endpoint `json:"endpoints"`
}

Domain 是按路径前缀分组的 API 域。

func List

func List() ([]Domain, error)

List 返回全部域。

func Load

func Load() ([]Domain, error)

Load 解析内嵌 OpenAPI(幂等)。

type Endpoint

type Endpoint struct {
	Method      string   `json:"method"`
	Path        string   `json:"path"`
	Summary     string   `json:"summary,omitempty"`
	Domain      string   `json:"domain"`
	Params      []string `json:"params,omitempty"`
	HasBody     bool     `json:"has_body,omitempty"`
	OperationID string   `json:"operation_id,omitempty"`
}

Endpoint 是单个 API 端点的精简描述。

func Find

func Find(method, path string) (Endpoint, bool)

Find 返回 method+path 精确匹配(供 raw api 使用时校验)。

func Show

func Show(name string) ([]Endpoint, error)

Show 返回某个域;name 可为域(sync)或 域.endpoint 模糊匹配(sync.task)。

Jump to

Keyboard shortcuts

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