httpencoding

package
v1.10.0-alpha.10 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package httpencoding owns named URL field serialization contracts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(location Location, shape Shape, source Serialization) error

Match verifies that authored OpenAPI serialization is equivalent to the built-in codec. It never rewrites a mismatched format as a lossy import.

Types

type Location

type Location uint8

Location distinguishes named values from root URL layouts.

const (
	// NamedQuery is an ordinary named query parameter.
	NamedQuery Location = iota
	// FormField is a named URL-encoded form property.
	FormField
	// WholeQuery is the unprefixed MapParams layout.
	WholeQuery
	// FormRoot is the unwrapped form body layout.
	FormRoot
)

type Mode

type Mode uint8

Mode is the wire representation selected for a value.

const (
	// Unsupported reports no equivalent built-in codec.
	Unsupported Mode = iota
	// Text encodes one scalar string.
	Text
	// Repeated encodes scalar array elements under a repeated field name.
	Repeated
	// JSON encodes one complete JSON document under a field name.
	JSON
	// Root preserves the existing unwrapped root layout.
	Root
)

func Select

func Select(location Location, shape Shape) Mode

Select returns the single built-in representation for this boundary.

type Serialization

type Serialization struct {
	// MediaType is the parameter content or form field contentType.
	MediaType string
	// Style is the authored RFC6570 serialization style.
	Style string
	// Explode is the explicitly authored explode setting.
	Explode *bool
	// AllowReserved is the explicitly authored URI escaping setting.
	AllowReserved *bool
}

Serialization describes authored OpenAPI serialization fields. Pointers preserve explicit presence, which changes form encoding semantics.

type Shape

type Shape uint8

Shape describes the value at a URL field boundary, after alias resolution.

const (
	// Scalar is one primitive value, including bytes.
	Scalar Shape = iota
	// Sequence is an array of scalar values.
	Sequence
	// Map is a dynamic object, including nested values.
	Map
	// Object is a fixed object value.
	Object
	// UnsupportedShape is a shape without a built-in URL codec.
	UnsupportedShape
)

Jump to

Keyboard shortcuts

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