detect

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package detect identifies whether a URL/response exposes a Swagger/OpenAPI definition and, if so, loads it into a normalized spec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Endpoints

func Endpoints(s *spec.Spec) []string

Endpoints returns "METHOD path" lines for a loaded spec, sorted.

Types

type Result

type Result struct {
	URL      string     `json:"url"`
	IsSpec   bool       `json:"is_spec"`             // parsed as a real definition
	IsUI     bool       `json:"is_ui"`               // swagger-ui/redoc HTML page
	Marker   string     `json:"marker,omitempty"`    // matched content marker
	Kind     spec.Kind  `json:"kind,omitempty"`      // version family
	Version  string     `json:"version,omitempty"`   // raw version
	Title    string     `json:"title,omitempty"`     // API title
	SpecURLs []string   `json:"spec_urls,omitempty"` // definition URLs extracted from a UI page
	Spec     *spec.Spec `json:"-"`
	Status   int        `json:"status"`
}

Result is the outcome of fingerprinting a single URL.

func Inspect

func Inspect(ctx context.Context, client *httpclient.Client, target string) (*Result, error)

Inspect fetches a URL and decides whether it is a spec, a UI page, or neither.

Jump to

Keyboard shortcuts

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