mappingfixture

package
v0.5.26 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodecOnlyNote

type CodecOnlyNote struct {
	Text string `payload:"text"`
	N    int    `payload:"n"`
}

CodecOnlyNote is referenced only via DecodeJSON/EncodeJSON in tests.

type CreateUserRequest

type CreateUserRequest struct {
	Name  string
	Email string
	OrgID string `path:"org_id"`
	Token string `header:"Authorization"`
}

CreateUserRequest exercises default input, path, and header sources.

type CreateUserResponse

type CreateUserResponse struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

CreateUserResponse is a normal JSON response.

type NestedCustomer

type NestedCustomer struct {
	ID   string `payload:"id"`
	Name string `payload:"name"`
}

NestedCustomer is a nested object in NestedOrderRequest.

type NestedLineItem

type NestedLineItem struct {
	SKU string `payload:"sku"`
	Qty int    `payload:"qty"`
}

NestedLineItem is an element of NestedOrderRequest.Items.

type NestedOrderRequest

type NestedOrderRequest struct {
	Customer NestedCustomer    `payload:"customer"`
	Items    []NestedLineItem  `payload:"items"`
	Labels   map[string]string `payload:"labels"`
}

NestedOrderRequest exercises nested struct, slice of structs, and map[string]string.

type OmitInner added in v0.5.8

type OmitInner struct {
	A string `json:"a"`
	B []int  `json:"b"`
}

OmitInner is the nested object OmitTagged asks about with omitzero.

type OmitRest added in v0.5.8

type OmitRest struct {
	Note  string         `payload:"note" json:"note,omitempty"`
	Extra map[string]any `payload:"*"`
}

OmitRest pairs an omittable member with a rest map, which is what leaves the comma in front of the rest members undecided until run time.

type OmitTagged added in v0.5.8

type OmitTagged struct {
	Lead   string            `json:"lead,omitempty"`
	Live   int               `json:"live,omitzero"`
	Tags   []string          `json:"tags,omitempty"`
	Meta   map[string]string `json:"meta,omitzero"`
	Sub    OmitInner         `json:"sub,omitzero"`
	Type   string            `json:"type"`
	After  string            `json:"after,omitempty"`
	Secret string            `json:"-"`
}

OmitTagged exercises every json tag option the encoder acts on, and the order that makes the separators interesting: omittable members first, so the comma before Type is only settled at run time, then one after Type whose comma is certain again.

type PatchWithExtrasRawRequest

type PatchWithExtrasRawRequest struct {
	Name  string                     `payload:"name"`
	Extra map[string]json.RawMessage `payload:"*"`
}

PatchWithExtrasRawRequest exercises rest as map[string]json.RawMessage.

type PatchWithExtrasRequest

type PatchWithExtrasRequest struct {
	Name  string         `payload:"name"`
	Email string         `payload:"email"`
	Extra map[string]any `payload:"*"`
}

PatchWithExtrasRequest exercises payload:"*" rest map for leftover body keys.

type SearchRequest

type SearchRequest struct {
	Keyword string `query:"keyword"`
	Page    int    `query:"page"`
	Filter  string `payload:"filter"`
}

SearchRequest restricts sources with query/payload tags.

type SearchResponse

type SearchResponse struct {
	Keyword string `json:"keyword"`
	Page    int    `json:"page"`
	Filter  string `json:"filter"`
}

SearchResponse is returned from search.

type UploadAvatarRequest

type UploadAvatarRequest struct {
	UserID string        `path:"user_id"`
	Title  string        `payload:"title"`
	Image  httpbind.File `payload:"image"`
}

UploadAvatarRequest exercises multipart File + scalar form fields + path.

Jump to

Keyboard shortcuts

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