parser

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertOpenAPIToJSONL

func ConvertOpenAPIToJSONL(specPath, outputPath string) error

ConvertOpenAPIToJSONL converts OpenAPI 3.0 or Swagger 2.0 spec to JSONL format If the file is already in JSONL format, it copies it to the output path

func IsJSONLFormat

func IsJSONLFormat(specPath string) (bool, error)

IsJSONLFormat checks if the file is already in JSONL format

Types

type Endpoint

type Endpoint struct {
	Method       string            `json:"method"`
	Path         string            `json:"path"`
	Description  string            `json:"description"`
	Parameters   []Parameter       `json:"parameters,omitempty"`
	RequestBody  string            `json:"request_body,omitempty"`
	Responses    map[string]string `json:"responses,omitempty"`
	RequiresAuth bool              `json:"requires_auth"`
	AuthType     string            `json:"auth_type"` // "bearer", "basic", "apikey", "none"
}

func LoadJSONLEndpoints

func LoadJSONLEndpoints(jsonlPath string) ([]Endpoint, error)

LoadJSONLEndpoints loads endpoints from JSONL file

type JSONLEndpoint

type JSONLEndpoint struct {
	Method       string         `json:"method"`
	Path         string         `json:"path"`
	Summary      string         `json:"summary"`
	Description  string         `json:"description,omitempty"`
	Parameters   []string       `json:"parameters,omitempty"`
	RequestBody  map[string]any `json:"request_body,omitempty"`
	Tags         []string       `json:"tags,omitempty"`
	RequiresAuth bool           `json:"requires_auth"`
	AuthType     string         `json:"auth_type"` // "bearer", "basic", "apikey", "none"
}

JSONLEndpoint represents a single API endpoint in JSONL format

type Parameter

type Parameter struct {
	Name        string `json:"name"`
	In          string `json:"in"`
	Type        string `json:"type"`
	Required    bool   `json:"required"`
	Description string `json:"description"`
}

type Specification

type Specification struct {
	Format     string     `json:"format"`
	Version    string     `json:"version,omitempty"`
	Endpoints  []Endpoint `json:"endpoints"`
	RawContent string     `json:"raw_content"`
}

func ParseSpecification

func ParseSpecification(path string) (*Specification, error)

Jump to

Keyboard shortcuts

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