Documentation
¶
Index ¶
Constants ¶
const (
MaxDocumentBytes = 10 << 20
)
Variables ¶
This section is empty.
Functions ¶
func BuildDocument ¶
func BuildDocument(service models.APIService, routes []models.APIRoute, gatewayServer string) ([]byte, error)
BuildDocument rebuilds a standard OpenAPI document from current platform facts. Runtime upstreams and credentials are deliberately outside its input.
func RetainReachableComponents ¶
RetainReachableComponents removes reusable components that are not reachable from the exported paths and document-level semantic references. The input must be an export already validated by ParseJSON, BuildDocument, or BuildExport; this function performs closure pruning, not full validation.
Types ¶
type ImportBundle ¶
type ImportBundle struct {
Name string `json:"name"`
Description string `json:"description"`
Document models.OpenAPIServiceDocument `json:"document"`
Servers []models.OpenAPIServer `json:"servers"`
Routes []ImportRoute `json:"routes"`
Warnings []Problem `json:"warnings"`
}
ImportBundle contains previewable, persistence-ready service document and Route drafts. Persistence and upstream selection belong to later layers.
func GroupRoutes ¶
func GroupRoutes(document ParsedDocument, choices []RouteGroupChoice) (ImportBundle, error)
GroupRoutes groups paths by their first static segment, then applies any explicit preview choices. It does not interpret path-template parameters.
func (*ImportBundle) Route ¶
func (b *ImportBundle) Route(slug string) *ImportRoute
Route finds a grouped Route by slug.
func (ImportBundle) RouteSlugs ¶
func (b ImportBundle) RouteSlugs() []string
RouteSlugs returns stable lexical ordering, including an empty root slug.
type ImportRoute ¶
ImportRoute is a platform APIRoute draft plus the public path produced by its slug. PublicPaths is keyed by the original OpenAPI path.
type ParseError ¶
type ParseError struct {
Problems []Problem `json:"problems"`
}
ParseError reports all problems found while accepting an OpenAPI document.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type ParsedDocument ¶
type ParsedDocument struct {
Name string
Description string
Document models.OpenAPIServiceDocument
Paths map[string]models.OpenAPIPathItem
}
ParsedDocument contains only platform-owned OpenAPI facts. The title and description remain separate because APIService owns them after import.
func ParseJSON ¶
func ParseJSON(raw []byte) (ParsedDocument, error)
ParseJSON validates an OpenAPI 3.0/3.1 JSON document and converts it at the parser boundary into platform model types.
type Problem ¶
type Problem struct {
Path string `json:"path"`
Code string `json:"code"`
Message string `json:"message"`
}
Problem is one safe, user-facing document problem located by JSON path.
type RouteGroupChoice ¶
RouteGroupChoice assigns complete OpenAPI paths to one confirmed Route slug. Paths omitted from choices keep their document-derived grouping.