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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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