davsclaus opened a new pull request, #24784:
URL: https://github.com/apache/camel/pull/24784
## Summary
_Claude Code on behalf of davsclaus_
Fixes a family of 7+ related defects in `RestOpenApiReader` where the
generated OpenAPI 3.x documents are invalid or semantically wrong. All defects
predate the swagger-core migration and were faithfully ported from the
apicurio-era code.
### Fixes included
1. **formData params** — no longer emit illegal `"in":"formData"`. Instead,
formData params are collected and emitted as a `requestBody` with
`application/x-www-form-urlencoded` (or `multipart/form-data`) object schema,
per OAS 3.x spec.
2. **collectionFormat -> style mapping** — `multi` now maps to `style: form,
explode: true` (was incorrectly `deepObject`). `csv` now maps to `style: form,
explode: false` (was missing `explode: false`, silently getting multi
semantics).
3. **boolean outType** — `outType("boolean")` now emits `BooleanSchema`
(`type: boolean`) instead of `NumberSchema.format("boolean")` (`type: number,
format: boolean`).
4. **Primitive-array outTypes** — `outType("int[]")`, `outType("string[]")`
etc. now use the computed typed schema as array items instead of discarding it.
Previously emitted `{"type":"array","items":{}}`.
5. **Response header types** — `long`, `float`, `double` now map to valid
JSON Schema types: `long` -> `integer/int64`, `float` -> `number/float`,
`double` -> `number/double`. Previously emitted raw type strings which are not
valid OAS 3.x types.
6. **Array response headers** — `setHeaderSchemaOas30` now wraps the inner
type in an `ArraySchema`. Previously set the inner type directly as the header
schema, losing the array wrapper.
7. **OAS 3.1 type loss** — response header schemas and byte[] now use typed
schema classes (`IntegerSchema`, `NumberSchema`, `BooleanSchema`,
`StringSchema`) which correctly populate both the `type` field (3.0) and
`types` set (3.1). Previously used raw `new Schema().type(...)` which only sets
the 3.0 field.
8. **byte[] outType** — now uses `ByteArraySchema` (`type: string, format:
byte`) instead of `new Schema().type("number").format("byte")`.
## Test plan
- [x] All 97 existing `camel-openapi-java` tests pass
- [ ] Manual validation of generated OpenAPI documents for each fixed
scenario
Co-Authored-By: Claude Opus 4.6 <[email protected]>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]