Skip to content

Commit b66f94a

Browse files
authored
[Fix] Fix two regressions in Converter (#16)
[Fix] Fix two regressions in Converter ### Motivation Found two regressions with the signature of two of the ~50 converter helper methods: - optional request body of type data - required header fields of type JSON ### Modifications Fixed up these signatures. ### Result Now a project which has both can build. ### Test Plan Used a test project for finding and fixing these. We should think about increasing the integration test coverage, and run it on runtime PRs. Reviewed by: simonjbeaumont Builds: ✔︎ pull request validation (5.8) - Build finished. ✔︎ pull request validation (5.9) - Build finished. ✔︎ pull request validation (nightly) - Build finished. ✔︎ pull request validation (soundness) - Build finished. #16
1 parent 2c093b0 commit b66f94a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Sources/OpenAPIRuntime/Conversion/Converter+Common.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ extension Converter {
247247
in headerFields: [HeaderField],
248248
name: String,
249249
as type: T.Type
250-
) throws -> T? {
250+
) throws -> T {
251251
try getRequiredHeaderField(
252252
in: headerFields,
253253
name: name,

Sources/OpenAPIRuntime/Conversion/Converter+Server.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,11 @@ public extension Converter {
268268
}
269269

270270
// | server | get | request body | binary | data | optional | getOptionalRequestBodyAsBinary |
271-
func getOptionalRequestBodyAsBinary(
271+
func getOptionalRequestBodyAsBinary<C>(
272272
_ type: Data.Type,
273273
from data: Data?,
274-
transforming transform: (Data) -> Data
275-
) throws -> Data? {
274+
transforming transform: (Data) -> C
275+
) throws -> C? {
276276
try getOptionalRequestBody(
277277
type,
278278
from: data,

0 commit comments

Comments
 (0)