-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add support for application/xml body #102
Conversation
Signed-off-by: Ugo Cottin <[email protected]>
Signed-off-by: Ugo Cottin <[email protected]>
Signed-off-by: Ugo Cottin <[email protected]>
Signed-off-by: Ugo Cottin <[email protected]>
Signed-off-by: Ugo Cottin <[email protected]>
Signed-off-by: Ugo Cottin <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good! A few initial comments, mostly minor suggestions.
@swift-server-bot test this please |
@czechboy0 I've made the suggested changes, the PR on swift-openapi-generator will follow soon, thanks |
@swift-server-bot test this please |
@swift-server-bot test this please |
Jenkins CI reports that
|
Just convert it to string when constructing the error. |
…ype(contentType:)
@swift-server-bot test this please |
@swift-server-bot test this please |
@swift-server-bot test this please |
Looks great, @ugocottin - will merge after CI passes. Feel free to move onto the generator PR. We'll do a release of the runtime early next week, at which point your generator PR should start passing on CI. |
Motivation
See apple/swift-openapi-generator#556 for more.
Modifications
Add converter methods for encoding and decoding XML request and response body.
Add
CustomCoder
protocol, allows to use otherEncoder
andDecoder
for othercontent-type
body.User can define custom coder, and assign a custom coder to a specific content-type within
Configuration.customCoders
dictionary.Result
It's now possible to define custom encoder and decoder for supported content-type.
Test Plan
Added converter methods are tested with a mock custom coder for
application/xml
content-type. To avoid adding a dependency to a XMLCoder like CoreOffice/XMLCoder, mock custom coder uses JSONEncoder and JSONDecoder.Encoding and decoding to XML are out of scope of the tests, because encoding and decoding logic must be provided by user through custom coder implementation.