Skip to content

Commit 04d4b68

Browse files
committed
docs: Document form-urlencoded and text/plain request body support
1 parent 4db4012 commit 04d4b68

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ Map<String, Object> raw = new Yaml().load(Files.newInputStream(Path.of("openapi.
100100
```
101101
The rest is identical.
102102

103+
### Request body content types
104+
105+
The server reads `requestBody.content` from the spec and selects a parser by `Content-Type` subtype:
106+
107+
| Content type | Parser | Coercion |
108+
| ------------------------------------- | ---------------------------------------------------------------------------- | -------- |
109+
| `application/json` | Caller-supplied `JsonMapper` | No — strict against the schema |
110+
| `application/x-www-form-urlencoded` | Built-in. `Map<String, Object>` (string or `List<String>` for repeated keys) | Yes — field values coerced to the property schema type (integer / number / boolean / array of those) |
111+
| `text/plain` | Built-in. Decoded `String` | No — schema should be `type: string` |
112+
113+
Form-field coercion mirrors the rules already used at the parameter boundary: the wire is string-only by definition, so a property typed as `integer` accepts `"42"` and yields `42`. Coercion failures surface as RFC-7807 `400` responses with a JSON-pointer to the failing field.
114+
115+
Both built-in parsers honour the `charset=` parameter on the `Content-Type` header (default UTF-8). Unknown charsets fall back to UTF-8.
116+
103117
### Extra (non-OpenAPI) handlers
104118

105119
Mount handlers at arbitrary paths outside the OpenAPI spec — useful for liveness probes,

0 commit comments

Comments
 (0)