You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 <beaumont@apple.com>
Co-authored-by: Honza Dvorsky <honza@apple.com>
0 commit comments