apple / swift-openapi-generator

Generate Swift client and server code from an OpenAPI document.
https://swiftpackageindex.com/apple/swift-openapi-generator/documentation
Apache License 2.0
1.45k stars 121 forks source link

Support for XML request body and response body #664

Open ugocottin opened 3 weeks ago

ugocottin commented 3 weeks ago

Motivation

See this issue for more.

Modifications

Based on modifications in the swift-openapi-runtime, I've added support for XML coding strategy and content-type category.

Result

Bodies with XML content-type can be encoded and decoded through xmlCoder in OpenAPIRuntime.Configuration.

Test Plan

I've updated test for ContentType parsing with application/xml content-type. 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.

czechboy0 commented 3 weeks ago

@ugocottin could you also review this section of OpenAPI to see if we should be taking that info into account? https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#xml-object