{"modulePath":"github.com/oapi-codegen/runtime","version":"v1.9.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package runtime\n\nCopyright 2021 DeepMap, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright 2019 DeepMap, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright 2019 DeepMap, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright 2019 DeepMap, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\nCopyright 2019 DeepMap, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n## Variables\n\n```go\nvar NarrowUnionNumericFormats bool\n```\nNarrowUnionNumericFormats controls whether numeric width formats narrow the dynamic type produced when a multi-type union parameter is bound into an \\`any\\` destination.\n\nWhen false (the default), the bound value's dynamic type is always one of bool, int64, float64, string, or \\[]byte, regardless of the schema's \\`format\\`: an edit to a spec's format can never change the types a running handler's type switch sees. When true, \\`format: int32\\` produces int32 (values outside int32 range fall through to the next union member) and \\`format: float\\` produces float32, widening the possible dynamic types to bool, int32, int64, float32, float64, string, and \\[]byte. \\`int64\\` and \\`double\\` name the defaults either way. Formats never affect concrete (non-\\`any\\`) destinations, whose Go type was fixed at generation time.\n\nNote one asymmetry with concrete destinations: a concrete int32 destination rejects an out-of-range value with an overflow error, but an \\`any\\` destination binds it to the next union member instead — typically the string member, verbatim. Enabling narrowing to get int32 typing therefore also accepts that silent widening; a handler that needs out-of-range values rejected must check for the string case itself.\n\nLike DefaultQueryEncoder, set it once during program initialization; it is not safe to mutate concurrently with in-flight requests. The opt-in lives here rather than in generated code because the trade-off belongs to whoever owns the handler's type switch: enabling it is a promise that the application handles the narrowed types.\n\n## Functions\n\n```go\nfunc BindForm(ptr interface{}, form map[string][]string, files map[string][]*multipart.FileHeader, encodings map[string]RequestBodyEncoding) error\n```\n\n```go\nfunc BindJSONBody(r *http.Request, v any) error\n```\nBindJSONBody decodes the JSON request body of r into v, which must be a non-nil pointer.\n\nWhen a request validation middleware built on kin-openapi's openapi3filter has run on r with Options.KeepValidatedValue set, r.Body carries the value the validator decoded and validated. That value is bound into v with BindJSONValue, so the handler receives exactly what was validated: member names are matched exactly, where encoding/json matches them case-insensitively, and the body is not decoded a second time.\n\nWithout a validated value, or when the value cannot be bound into v, the body is decoded with JSONUnmarshalRead: the current JSONCodec (see SetJSONCodec), as a stream when it implements StreamingJSONCodec. With the default codec that is encoding/json's Decoder, so its error behaviour is unchanged. A body that is empty, or only white space, is io.EOF whichever codec is in use: generated handlers take that as an optional body left out.\n\n```go\nfunc BindJSONValue(value any, v any) error\n```\nBindJSONValue binds a decoded JSON value into v, which must be a non-nil pointer. value is the generic representation produced by decoding JSON into an \\`any\\`: nil, bool, string, json.Number (or a Go numeric type), \\[]any and map\\[string]any.\n\nBinding follows encoding/json's rules for the destination type (struct tags, embedded struct promotion, json.Unmarshaler and encoding.TextUnmarshaler, base64 for \\[]byte, float64 for \\`any\\`), with one deliberate difference: object member names are matched to struct fields exactly, never case-insensitively. Unknown members are ignored.\n\nOn success \\*v holds only what value describes; on error \\*v is left unchanged. An error means the value does not fit the destination (a type mismatch, an overflow, or a destination type that is not supported) and the caller should fall back to decoding the original JSON.\n\n```go\nfunc BindMultipart(ptr interface{}, reader multipart.Reader) error\n```\n\n```go\nfunc BindQueryParameter(style string, explode bool, required bool, paramName string,\n\tqueryParams url.Values, dest interface{}) error\n```\nBindQueryParameter works much like BindStyledParameter, however it takes a query argument input array from the url package, since query arguments come through a different path than the styled arguments. They're also exceptionally fussy. For example, consider the exploded and unexploded form parameter examples: (exploded) /users?role=admin\u0026firstName=Alex (unexploded) /users?id=role,admin,firstName,Alex\n\nIn the first case, we can pull the \"id\" parameter off the context, and unmarshal via json as an intermediate. Easy. In the second case, we don't have the id QueryParam present, but must find \"role\", and \"firstName\". what if there is another parameter similar to \"ID\" named \"role\"? We can't tell them apart. This code tries to fail, but the moral of the story is that you shouldn't pass objects via form styled query arguments, just use the Content parameter form.\n\nDeprecated: BindQueryParameter pre-decodes the query string via url.Values, which makes it impossible to distinguish literal commas from delimiter commas in form/explode=false parameters. Use BindRawQueryParameter instead, which operates on the raw query string and handles encoded delimiters correctly.\n\n```go\nfunc BindQueryParameterWithOptions(style string, explode bool, required bool, paramName string,\n\tqueryParams url.Values, dest interface{}, opts BindQueryParameterOptions) error\n```\nBindQueryParameterWithOptions works like BindQueryParameter with additional options.\n\n```go\nfunc BindRawQueryParameter(style string, explode bool, required bool, paramName string,\n\trawQuery string, dest any) error\n```\nBindRawQueryParameter works like BindQueryParameter but operates on the raw (undecoded) query string instead of pre-parsed url.Values. This correctly handles form/explode=false parameters whose values contain literal commas encoded as %2C — something that BindQueryParameter cannot do because url.Values has already decoded %2C to ',' before we can split on the delimiter comma.\n\n```go\nfunc BindStringToObject(src string, dst interface{}) error\n```\nBindStringToObject takes a string, and attempts to assign it to the destination interface via whatever type conversion is necessary. We have to do this via reflection instead of a much simpler type switch so that we can handle type aliases. This function was the easy way out, the better way, since we know the destination type each place that we use this, is to generate code to read each specific type.\n\n```go\nfunc BindStringToObjectWithOptions(src string, dst interface{}, opts BindStringToObjectOptions) error\n```\nBindStringToObjectWithOptions takes a string, and attempts to assign it to the destination interface via whatever type conversion is necessary, with additional options.\n\n```go\nfunc BindStyledParameter(style string, explode bool, paramName string,\n\tvalue string, dest interface{}) error\n```\nBindStyledParameter binds a parameter as described in the Path Parameters section here to a Go object: [https://swagger.io/docs/specification/serialization/](https://swagger.io/docs/specification/serialization/) It is a backward compatible function to clients generated with codegen up to version v1.5.5. v1.5.6+ calls the function below. Deprecated: BindStyledParameter is deprecated.\n\n```go\nfunc BindStyledParameterWithLocation(style string, explode bool, paramName string,\n\tparamLocation ParamLocation, value string, dest interface{}) error\n```\nBindStyledParameterWithLocation binds a parameter as described in the Path Parameters section here to a Go object: [https://swagger.io/docs/specification/serialization/](https://swagger.io/docs/specification/serialization/) This is a compatibility function which is used by oapi-codegen v2.0.0 and earlier. Deprecated: BindStyledParameterWithLocation is deprecated.\n\n```go\nfunc BindStyledParameterWithOptions(style string, paramName string, value string, dest any, opts BindStyledParameterOptions) error\n```\nBindStyledParameterWithOptions binds a parameter as described in the Path Parameters section here to a Go object: [https://swagger.io/docs/specification/serialization/](https://swagger.io/docs/specification/serialization/)\n\n```go\nfunc JSONMarshal(v any) ([]byte, error)\n```\nJSONMarshal encodes v with the current JSONCodec.\n\n```go\nfunc JSONMarshalWrite(w io.Writer, v any) error\n```\nJSONMarshalWrite encodes v to w with the current JSONCodec: with its MarshalWrite when it implements StreamingJSONCodec, otherwise with Marshal followed by a single Write.\n\n```go\nfunc JSONMerge(data, patch json.RawMessage) (json.RawMessage, error)\n```\nJSONMerge merges two JSON representation into a single object. \\`data\\` is the existing representation and \\`patch\\` is the new data to be merged in\n\n```go\nfunc JSONUnmarshal(data []byte, v any) error\n```\nJSONUnmarshal decodes data into v with the current JSONCodec.\n\n```go\nfunc JSONUnmarshalRead(r io.Reader, v any) error\n```\nJSONUnmarshalRead decodes v from r with the current JSONCodec: with its UnmarshalRead when it implements StreamingJSONCodec, otherwise by reading r to its end and calling Unmarshal.\n\nWhen r is nil or holds no value, nothing or only JSON white space, it returns io.EOF whichever codec is in use, as encoding/json's Decoder does, and the codec isn't involved: generated handlers take io.EOF as an optional request body left out. Otherwise the codec sees r's input unchanged.\n\n```go\nfunc JsonMerge(data, patch json.RawMessage) (json.RawMessage, error)\n```\nJsonMerge merges two JSON representation into a single object. \\`data\\` is the existing representation and \\`patch\\` is the new data to be merged in\n\nDeprecated: Use JSONMerge instead.\n\n```go\nfunc MarshalDeepObject(i interface{}, paramName string) (string, error)\n```\n\n```go\nfunc MarshalForm(ptr interface{}, encodings map[string]RequestBodyEncoding) (url.Values, error)\n```\nMarshalForm serializes a struct into application/x-www-form-urlencoded values.\n\nProperties are written in bracketed form by default: an array becomes name\\[0]=a\u0026name\\[1]=b and a nested object becomes name\\[key]=value. A property with an entry in encodings follows that entry instead, mirroring the OpenAPI Encoding Object:\n\n  - ContentType: the value is serialized as a single field in that media type. Only application/json is supported.\n  - Style and Explode: arrays and flat objects are serialized as a query parameter of that style would be. \"form\" (the default when only Explode is set), \"spaceDelimited\" and \"pipeDelimited\" write repeated keys (name=a\u0026name=b) when exploded and one delimited value (name=a,b) otherwise; \"deepObject\" is the bracketed default. Explode defaults to true for \"form\" and false for the other styles, as in the specification.\n\nAn entry which sets none of those leaves the default in place.\n\n```go\nfunc SetJSONCodec(c JSONCodec)\n```\nSetJSONCodec replaces the codec used by this package and by the code oapi-codegen generates, process-wide. It is for a program's main package to call during initialisation, not for a library: it is not synchronised, and it changes the JSON of every generated package linked into the program, including those of other libraries. nil restores the default, encoding/json throughout, and so does StdJSONCodec.\n\nThe codec covers what this package and generated code encode and decode themselves. It doesn't reach JSON that a web framework handles on their behalf: the strict servers for echo, gin, fiber and iris decode request bodies with the framework's binder, fiber's and iris's write responses with the framework's JSON method, and a request body a validation middleware decoded and kept (see BindJSONBody) is bound without decoding it again.\n\n```go\nfunc StyleParam(style string, explode bool, paramName string, value interface{}) (string, error)\n```\nStyleParam is used by older generated code, and must remain compatible with that code. It is not to be used in new templates. Please see the function below, which can specialize its output based on the location of the parameter.\n\n```go\nfunc StyleParamWithLocation(style string, explode bool, paramName string, paramLocation ParamLocation, value interface{}) (string, error)\n```\nStyleParamWithLocation serializes a Go value into an OpenAPI-styled parameter string, performing escaping based on parameter location.\n\n```go\nfunc StyleParamWithOptions(style string, explode bool, paramName string, value interface{}, opts StyleParamOptions) (string, error)\n```\nStyleParamWithOptions serializes a Go value into an OpenAPI-styled parameter string with additional options.\n\n```go\nfunc UnmarshalDeepObject(dst interface{}, paramName string, params url.Values) error\n```\nUnmarshalDeepObject decodes deepObject-style query parameters (e.g. \\`filter\\[name]=alice\u0026filter\\[role]=admin\\`) into dst, using paramName as the outer prefix.\n\nEncoding: MarshalDeepObject percent-encodes values, map keys, and the param name itself, so any byte sequence — including non-ASCII text and URL reserved characters in values or in map keys — round-trips correctly. The '\\[' and ']' characters that appear at the top level of each fragment are always structural; literal brackets inside data are encoded as %5B/%5D on the wire.\n\nKnown limitation: literal '\\[' or ']' inside map keys cannot be round- tripped. After url.ParseQuery decodes %5B/%5D back to '\\['/']', the parser cannot distinguish a structural bracket from a literal bracket that was part of a key (e.g. \\`p\\[a\\[b]]\\` is ambiguous between \\`{p: {a: {b: ...}}}\\` and \\`{p: {\"a\\[b]\": ...}}\\`). This matches the behavior of every other deepObject implementation (qs, Rails, PHP); the deepObject style itself does not define an escape mechanism for brackets inside keys.\n\n## Types\n\n```go\ntype BindQueryParameterOptions struct {\n\t// Type is the OpenAPI type of the parameter (e.g. \"string\", \"integer\").\n\tType string\n\t// Format is the OpenAPI format of the parameter (e.g. \"byte\", \"date-time\").\n\t// When set to \"byte\" and the destination is []byte, the value is\n\t// base64-decoded rather than treated as a generic slice.\n\tFormat string\n\t// Types is the OpenAPI 3.1 multi-type union member list of the parameter\n\t// (e.g. [\"string\", \"integer\"]). It is only consulted when the\n\t// destination is an empty interface (`any`): the value binds to the\n\t// first member that parses, trying boolean, integer, number, then\n\t// string, with numeric detection following the JSON number production.\n\t// The bound value's dynamic type is one of exactly bool, int64, float64,\n\t// string, or, with Format \"byte\", []byte (widths narrow only under the\n\t// NarrowUnionNumericFormats package variable). Concrete destinations ignore\n\t// it and keep the reflection-driven behavior; arrays of unions and\n\t// deepObject-style binding are not covered. See\n\t// BindStringToObjectOptions.Types for the full semantics and scope.\n\tTypes []string\n\t// AllowReserved, when true, indicates that the parameter value may\n\t// contain RFC 3986 reserved characters without percent-encoding.\n\tAllowReserved bool\n}\n```\nBindQueryParameterOptions defines optional arguments for BindQueryParameterWithOptions.\n\n```go\ntype BindStringToObjectOptions struct {\n\t// Type is the OpenAPI type of the parameter (e.g. \"string\", \"integer\").\n\tType string\n\t// Format is the OpenAPI format of the parameter (e.g. \"byte\", \"date-time\").\n\t// When set to \"byte\" and the destination is []byte, the source string is\n\t// base64-decoded rather than treated as a generic slice.\n\tFormat string\n\t// Types is the OpenAPI 3.1 multi-type union member list of the parameter\n\t// (e.g. [\"string\", \"integer\"]). A \"null\" entry — the 3.1 nullability\n\t// marker, not a union member — is ignored, whether or not the generator\n\t// already stripped it. (Type, which the runtime does not currently read,\n\t// carries no meaning when Types is set.)\n\t//\n\t// Types is only consulted when the destination is an empty interface\n\t// (`any`): the source string is bound to the first member that parses,\n\t// trying boolean, integer, number, then string (most restrictive grammar\n\t// first — the always-succeeding string member would otherwise shadow the\n\t// rest). Numeric detection uses the JSON number production (RFC 8259\n\t// section 6), so tokens like \"007\" and \"+1\" bind as strings. The bound\n\t// value's dynamic type is one of exactly bool, int64, float64, string,\n\t// or, with Format \"byte\", []byte; width formats (int32, float, ...) are\n\t// annotation-only unless the application opts into narrowing via the\n\t// NarrowUnionNumericFormats package variable.\n\t//\n\t// Concrete destinations ignore this field and keep the reflection-driven\n\t// behavior. Array element binding does not yet support unions, and\n\t// deepObject-style binding does not consult this field (its JSON decode\n\t// path produces float64 for all numbers).\n\tTypes []string\n}\n```\nBindStringToObjectOptions defines optional arguments for BindStringToObjectWithOptions.\n\n```go\ntype BindStyledParameterOptions struct {\n\t// ParamLocation tells us where the parameter is located in the request.\n\tParamLocation ParamLocation\n\t// Whether the parameter should use exploded structure\n\tExplode bool\n\t// Whether the parameter is required in the query\n\tRequired bool\n\t// Type is the OpenAPI type of the parameter (e.g. \"string\", \"integer\").\n\tType string\n\t// Format is the OpenAPI format of the parameter (e.g. \"byte\", \"date-time\").\n\t// When set to \"byte\" and the destination is []byte, the value is\n\t// base64-decoded rather than treated as a generic slice.\n\tFormat string\n\t// Types is the OpenAPI 3.1 multi-type union member list of the parameter\n\t// (e.g. [\"string\", \"integer\"]). It is only consulted when the\n\t// destination is an empty interface (`any`): the value binds to the\n\t// first member that parses, trying boolean, integer, number, then\n\t// string, with numeric detection following the JSON number production.\n\t// The bound value's dynamic type is one of exactly bool, int64, float64,\n\t// string, or, with Format \"byte\", []byte (widths narrow only under the\n\t// NarrowUnionNumericFormats package variable). Concrete destinations ignore\n\t// it and keep the reflection-driven behavior; arrays of unions and\n\t// deepObject-style binding are not covered. See\n\t// BindStringToObjectOptions.Types for the full semantics and scope.\n\tTypes []string\n\t// AllowReserved, when true, indicates that the parameter value may\n\t// contain RFC 3986 reserved characters without percent-encoding.\n\tAllowReserved bool\n\t// ValueIsUnescaped, when true, indicates that the value has already had\n\t// its URL percent-encoding removed (typically by the router) and is\n\t// bound verbatim. The default treats the value as still escaped and\n\t// unescapes it according to ParamLocation — the historical behavior,\n\t// preserved for existing callers. Routers differ in whether they\n\t// deliver path parameters raw or already decoded — a mismatch either\n\t// double-decodes values containing literal percent signs or leaves\n\t// them encoded — so the generated wrapper sets this to match its\n\t// framework. See https://github.com/oapi-codegen/runtime/issues/35\n\tValueIsUnescaped bool\n}\n```\nBindStyledParameterOptions defines optional arguments for BindStyledParameterWithOptions\n\n```go\ntype Binder interface {\n\tBind(src string) error\n}\n```\nBinder is the interface implemented by types that can be bound to a query string or a parameter string The input can be assumed to be a valid string.  If you define a Bind method you are responsible for all data being completely bound to the type.\n\nBy convention, to approximate the behavior of Bind functions themselves, Binder implements Bind(\"\") as a no-op.\n\n```go\ntype JSONCodec = jsoncodec.Codec\n```\nJSONCodec encodes and decodes JSON for this package and for the code oapi-codegen generates. It has two methods:\n\n\tMarshal(v any) ([]byte, error)\n\tUnmarshal(data []byte, v any) error\n\nA codec must produce and accept standard JSON: it selects an implementation and its options, such as encoding/json/v2 or an encoder that doesn't escape HTML, not a different format. A codec that also implements StreamingJSONCodec encodes and decodes request and response bodies as streams.\n\nA codec must be re-entrant. The MarshalJSON and UnmarshalJSON methods of the types in runtime/types, and of the union and additionalProperties types oapi-codegen generates, call back into the codec from inside the codec's own Marshal or Unmarshal of a value that contains them. A codec that holds a lock across Marshal deadlocks on the first such value.\n\n```go\ntype NetURLQueryEncoder struct{}\n```\nNetURLQueryEncoder preserves Go's net/url behavior, encoding a space as '+'. This matches the application/x-www-form-urlencoded convention that browsers use for HTML forms. It is the default encoder, so existing generated clients are unaffected. Note that many, but not all, servers accept '+' as a space.\n\n```go\nfunc (NetURLQueryEncoder) EscapeQueryValue(value string, allowReserved bool) string\n```\n\n```go\ntype ParamLocation int\n```\n\n```go\nconst (\n\tParamLocationUndefined ParamLocation = iota\n\tParamLocationQuery\n\tParamLocationPath\n\tParamLocationHeader\n\tParamLocationCookie\n)\n```\n\n```go\ntype QueryEncoder interface {\n\t// EscapeQueryValue escapes a query parameter value. When allowReserved is\n\t// true, RFC 3986 reserved characters are left unencoded, per OpenAPI's\n\t// allowReserved option (which applies to values only).\n\tEscapeQueryValue(value string, allowReserved bool) string\n}\n```\nQueryEncoder escapes values destined for a URL query string. It governs query parameter values, names, and map keys; it does NOT affect path escaping or application/x-www-form-urlencoded request bodies, where encoding a space as '+' is the correct, media-type-defined behavior.\n\nNames and map keys are escaped as values with allowReserved=false, since allowReserved applies only to values per the OpenAPI spec.\n\nGenerated clients route all query escaping through DefaultQueryEncoder. Provide a custom implementation, or use one of the built-ins (NetURLQueryEncoder, RFC3986QueryEncoder), to control how query strings are encoded on the wire.\n\n```go\nvar DefaultQueryEncoder QueryEncoder = NetURLQueryEncoder{}\n```\nDefaultQueryEncoder is the QueryEncoder used by all generated clients to escape query parameters. It defaults to NetURLQueryEncoder for backwards compatibility. Set it once during program initialization; like http.DefaultClient, it is not safe to mutate concurrently with in-flight requests.\n\n```go\ntype RFC3986QueryEncoder struct{}\n```\nRFC3986QueryEncoder encodes a space as %20 rather than '+', for strict RFC 3986 compliance. Some servers (for example, OData endpoints that expect filters such as ?filter=name%20eq%20'x') reject '+'-encoded spaces with 400 Bad Request. Set runtime.DefaultQueryEncoder to an RFC3986QueryEncoder to opt in.\n\nThe +-\u003e%20 rewrite is lossless: url.QueryEscape encodes a literal '+' in the input as %2B, so any '+' remaining in its output can only be a space.\n\n```go\nfunc (RFC3986QueryEncoder) EscapeQueryValue(value string, allowReserved bool) string\n```\n\n```go\ntype RequestBodyEncoding struct {\n\tContentType string\n\tStyle       string\n\tExplode     *bool\n\tRequired    *bool\n}\n```\n\n```go\ntype RequiredParameterError struct {\n\tParamName string\n}\n```\nRequiredParameterError is returned when a required query parameter is missing. Generated server code can use errors.As to detect this and produce a framework-specific typed error for the application's error handler.\n\n```go\nfunc (e *RequiredParameterError) Error() string\n```\n\n```go\ntype StdJSONCodec = jsoncodec.Std\n```\nStdJSONCodec is encoding/json's json.Marshal and json.Unmarshal. Embed it in a codec to replace one method.\n\nIt doesn't implement StreamingJSONCodec, so a codec that embeds it handles bodies through its own Marshal and Unmarshal, buffered. That differs from the default in two ways: a response body has no trailing newline, and data after a request body's value is rejected where encoding/json's Decoder ignores it. SetJSONCodec treats StdJSONCodec itself as the default, so passing it doesn't select the buffered path.\n\n```go\ntype StreamingJSONCodec = jsoncodec.Streaming\n```\nStreamingJSONCodec is optionally implemented by a JSONCodec that encodes to and decodes from a stream, which request and response bodies use:\n\n\tMarshalWrite(w io.Writer, v any) error\n\tUnmarshalRead(r io.Reader, v any) error\n\nWithout it, JSONMarshalWrite and JSONUnmarshalRead buffer the whole body through Marshal and Unmarshal. Whether MarshalWrite ends the value with a newline, and whether UnmarshalRead rejects data after the value, is up to the implementation: encoding/json's Encoder and Decoder do and don't, respectively. Neither this package nor generated code relies on either. UnmarshalRead is never handed an empty input: see JSONUnmarshalRead.\n\n```go\ntype StyleParamOptions struct {\n\t// ParamLocation controls URL escaping behavior.\n\tParamLocation ParamLocation\n\t// Type is the OpenAPI type of the parameter (e.g. \"string\", \"integer\").\n\tType string\n\t// Format is the OpenAPI format of the parameter (e.g. \"byte\", \"date-time\").\n\t// When set to \"byte\" and the value is []byte, it is base64-encoded as a\n\t// single string rather than treated as a generic slice of uint8.\n\tFormat string\n\t// Required indicates whether the parameter is required.\n\tRequired bool\n\t// AllowReserved, when true, prevents percent-encoding of RFC 3986\n\t// reserved characters in query parameter values. Per the OpenAPI 3.x\n\t// spec, this only applies to query parameters.\n\tAllowReserved bool\n}\n```\nStyleParamOptions defines optional arguments for StyleParamWithOptions.\n\n","path":"github.com/oapi-codegen/runtime","name":"runtime","synopsis":"","isRedistributable":true}
