parser

package
v0.0.0-...-7561d16 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APISpec

type APISpec struct {
	Title        string
	Description  string
	Version      string
	Servers      []Server
	Resources    []Resource
	SecurityDefs []SecurityDef
}

APISpec is the unified internal model for both OpenAPI 3.x and Swagger 2.0 specs.

func Parse

func Parse(specBytes []byte) (*APISpec, error)

Parse reads raw spec bytes and returns a unified APISpec.

type Operation

type Operation struct {
	ID          string
	Summary     string
	Description string
	Method      string
	Path        string
	Parameters  []Parameter
	RequestBody *RequestBody
	Security    []SecurityRequirement
}

type Parameter

type Parameter struct {
	Name        string
	In          string // path, query, header, cookie
	Description string
	Required    bool
	Type        string // string, integer, boolean, number, array
	Default     any
	Enum        []string
}

type Property

type Property struct {
	Name        string
	Type        string
	Description string
	Required    bool
	Default     any
	Enum        []string
}

type RequestBody

type RequestBody struct {
	Description string
	Required    bool
	ContentType string
	Properties  []Property
}

type Resource

type Resource struct {
	Name        string
	Description string
	Operations  []Operation
}

type SecurityDef

type SecurityDef struct {
	Name      string
	Type      string // apiKey, http
	In        string // header, query
	ParamName string
	Scheme    string // bearer, basic
}

type SecurityRequirement

type SecurityRequirement struct {
	SchemeName string
	Scopes     []string
}

type Server

type Server struct {
	URL         string
	Description string
}

Jump to

Keyboard shortcuts

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