{"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"encoding-object","__idx":0},"children":["Encoding Object"]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A single encoding definition applied to a single schema property."]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":["Excerpt from the OpenAPI 3.1 specification about the Encoding Object\n"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"fixed-fields","__idx":1},"children":["Fixed Fields"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field Name"},"children":["Field Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"center","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["contentType"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The Content-Type for encoding a specific property. Default value depends on the property type: for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]}," - ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/json"]},";  for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]}," – the default is defined based on the inner type; for all other cases the default is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/octet-stream"]},". The value can be a specific media type (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/json"]},"), a wildcard media type (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["image/*"]},"), or a comma-separated list of the two types."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["headers"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":["Map[",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]},", ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/learn/openapi/openapi-visual-reference/header"},"children":["Header Object"]}," | ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/learn/openapi/openapi-visual-reference/reference"},"children":["Reference Object"]},"]"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A map allowing additional information to be provided as headers, for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Disposition"]},".  ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Content-Type"]}," is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["multipart"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["style"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["string"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Describes how a specific property value will be serialized depending on its type.  See ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/learn/openapi/openapi-visual-reference/parameter"},"children":["Parameter Object"]}," for details on the ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/learn/openapi/openapi-visual-reference/parameter"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style"]}]}," property. The behavior follows the same values as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["query"]}," parameters, including default values. This property SHALL be ignored if the request body media type is not ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/x-www-form-urlencoded"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["multipart/form-data"]},". If a value is explicitly defined, then the value of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["contentType"]}," (implicit or explicit) SHALL be ignored."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["explode"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When this is true, property values of type ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["array"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["object"]}," generate separate parameters for each value of the array, or key-value-pair of the map.  For other types of properties this property has no effect. When ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["style"]}," is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["form"]},", the default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},". For all other styles, the default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},". This property SHALL be ignored if the request body media type is not ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/x-www-form-urlencoded"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["multipart/form-data"]},". If a value is explicitly defined, then the value of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["contentType"]}," (implicit or explicit) SHALL be ignored."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["allowReserved"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"center"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["boolean"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Determines whether the parameter value SHOULD allow reserved characters, as defined by ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://tools.ietf.org/html/rfc3986#section-2.2"},"children":["RFC3986"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[":/?#[]@!$&'()*+,;="]}," to be included without percent-encoding. The default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["false"]},". This property SHALL be ignored if the request body media type is not ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["application/x-www-form-urlencoded"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["multipart/form-data"]},". If a value is explicitly defined, then the value of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["contentType"]}," (implicit or explicit) SHALL be ignored."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This object MAY be extended with ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"/learn/openapi/openapi-visual-reference/specification-extensions"},"children":["Specification Extensions"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"encoding-object-example","__idx":2},"children":["Encoding Object Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"yaml","header":{"controls":{"copy":{}}},"source":"requestBody:\n  content:\n    multipart/form-data:\n      schema:\n        type: object\n        properties:\n          id:\n            # default is text/plain\n            type: string\n            format: uuid\n          address:\n            # default is application/json\n            type: object\n            properties: {}\n          historyMetadata:\n            # need to declare XML format!\n            description: metadata in XML format\n            type: object\n            properties: {}\n          profileImage: {}\n      encoding:\n        historyMetadata:\n          # require XML Content-Type in utf-8 encoding\n          contentType: application/xml; charset=utf-8\n        profileImage:\n          # only accept png/jpeg\n          contentType: image/png, image/jpeg\n          headers:\n            X-Rate-Limit-Limit:\n              description: The number of allowed requests in the current period\n              schema:\n                type: integer\n","lang":"yaml"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"visuals","__idx":3},"children":["Visuals"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The encoding information is not presented visually."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"types","__idx":4},"children":["Types"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Encoding"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ts","header":{"controls":{"copy":{}}},"source":"const Encoding: NodeType = {\n  properties: {\n    contentType: { type: 'string' },\n    headers: mapOf('Header'),\n    style: {\n      enum: ['form', 'simple', 'label', 'matrix', 'spaceDelimited', 'pipeDelimited', 'deepObject'],\n    },\n    explode: { type: 'boolean' },\n    allowReserved: { type: 'boolean' },\n  },\n};\n","lang":"ts"},"children":[]}]},"frontmatter":{},"tagList":["html"],"title":"Encoding Object","lastModified":"2025-05-28T16:01:32.000Z"}