Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SPIs for throwing RuntimeError from shorthand generated APIs (#56)
### Motivation The review period for SOAR-0007 (Shorthand APIs for inputs and outputs) has now concluded. This pull request adds the required SPIs to the runtime library to throw a runtime error when the response and/or body does not match that of the shorthand API being used. For further context, please review the proposal itself.[^1] [^1]: apple/swift-openapi-generator#291 ### Modifications - Extend `internal enum RuntimeError: Error` with two new cases: - `.unexpectedResponseStatus(expectedStatus:response:)` - `.unexpectedResponseBody(expectedContent:body:)` - Add SPI for generated code, to throw these errors: - `@_spi(Generated) public throwUnexpectedResponseStatus(expectedStatus:response:)` - `@_spi(Generated) public throwUnexpectedResponseBody(expectedStatus:body:)` ### Result Runtime library has two SPIs that can be used by the generator to implement the shorthand throwing getter APIs described in SOAR-0007. ### Test Plan Companion PR in swift-openapi-generator. --------- Signed-off-by: Si Beaumont <[email protected]> Co-authored-by: Honza Dvorsky <[email protected]>
- Loading branch information