validator

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APISymbol

type APISymbol struct {
	Method         string                 // "get", "post", "put", "delete"
	Parameters     []ParamSymbol          // path/query parameters
	RequestFields  map[string]string      // field name → type
	ResponseFields map[string]FieldSymbol // field name → type info

	// Phase 5: x- extensions
	Pagination *PaginationExt
	Sort       *SortExt
	Filter     *FilterExt
}

APISymbol represents a single OpenAPI operation.

type CustomSymbol

type CustomSymbol struct {
	Functions map[string]bool
}

CustomSymbol holds exported function names from a custom.ts file.

func LoadCustomTS

func LoadCustomTS(path string) (*CustomSymbol, error)

LoadCustomTS parses a custom.ts file and extracts exported function names.

type FieldSymbol

type FieldSymbol struct {
	Type     string // "string", "integer", "array", "object"
	ItemType string // item type if array
}

FieldSymbol represents a response field with type info.

type FilterExt

type FilterExt struct {
	Allowed []string
}

FilterExt represents x-filter extension.

type PaginationExt

type PaginationExt struct {
	Style        string // "offset" or "cursor"
	DefaultLimit int
	MaxLimit     int
}

PaginationExt represents x-pagination extension.

type ParamSymbol

type ParamSymbol struct {
	Name string // parameter name
	In   string // "path" or "query"
}

ParamSymbol represents an OpenAPI parameter.

type SortExt

type SortExt struct {
	Allowed   []string
	Default   string
	Direction string
}

SortExt represents x-sort extension.

type SymbolTable

type SymbolTable struct {
	Operations map[string]APISymbol // operationId → APISymbol
}

SymbolTable holds all symbols extracted from OpenAPI and custom.ts.

func LoadOpenAPI

func LoadOpenAPI(path string) (*SymbolTable, error)

LoadOpenAPI parses an OpenAPI YAML file and builds a SymbolTable.

type ValidationError

type ValidationError struct {
	File    string // source HTML filename
	Attr    string // attribute context (e.g. `data-fetch="Login"`)
	Message string // human-readable error
}

ValidationError represents a single validation failure.

func Validate

func Validate(pages []parser.PageSpec, projectRoot string) []ValidationError

Validate checks parsed PageSpecs against an OpenAPI spec and custom.ts files. projectRoot is the project root containing api/openapi.yaml and frontend/.

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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