Skip to content

[Runtime] Stop generating an undocumented case for enums/oneOfs #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Sources/OpenAPIRuntime/Conversion/ErrorExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@ extension DecodingError {
)
)
}

/// Returns a decoding error used by the oneOf decoder when not a single
/// child schema decodes the received payload.
/// - Parameters:
/// - type: The type representing the oneOf schema in which the decoding
/// occurred.
/// - codingPath: The coding path to the decoder that attempted to decode
/// the type.
/// - Returns: A decoding error.
@_spi(Generated)
public static func failedToDecodeOneOfSchema(
type: Any.Type,
codingPath: [any CodingKey]
) -> Self {
DecodingError.valueNotFound(
type,
DecodingError.Context.init(
codingPath: codingPath,
debugDescription: "The oneOf structure did not decode into any child schema."
)
)
}
}

@_spi(Generated)
Expand Down