Comments (7)
Hi @ugocottin,
yes XML is officially supported by the OpenAPI specification, so it'd be reasonable for us to support it here.
Since we already generate Codable
types, I think the main piece of work would be to create an XMLEncoder
and XMLDecoder
that can work with Codable
types, and then we can update the generator.
Once that's in place, your plan above with extending the Converter
, adding a CodingStrategy
is exactly right.
A heads up - this would need to be contributed by you, and we'd help steer the code through pull request review.
If that sounds good, go ahead! 🙏
from swift-openapi-generator.
Looks good - feel free to open a PR for the generator as well (even if it won't pass until the runtime change lands and is released), it's easier to review both changes together.
from swift-openapi-generator.
Ok @ugocottin, the runtime changes landed in swift-openapi-runtime 1.4.0, so please bump the dependency of the generator's Package.swift and you should be able to finish the generator work.
from swift-openapi-generator.
Oh I missed that you already linked to such encoder/decoder in https://github.com/CoreOffice/XMLCoder.
The only concern there is that it's a dependency that isn't API-stable.
I wonder if we could somehow offer this as explicitly opt-in, where only adopters who want XML would include that dependency.
Maybe some new optional conversion methods on OpenAPIRuntime.Configuration
, able to convert between HTTPBody
and Codable
using a custom encoder/decoder.
from swift-openapi-generator.
Hello @czechboy0
Thanks for the feedback. I've submitted a first pull request to apple/swift-openapi-runtime#102.
As you suggested, I added the possibility to define custom encoding / decoding behaviour through OpenAPIRuntime.Configuration
, with CustomCoder
protocol.
Thanks!
from swift-openapi-generator.
As part of the generator PR, it'd be great to also add an example project that shows how to bring your own XML encoder/decoder and plug it all together (see the Examples directory).
from swift-openapi-generator.
Hi @czechboy0, thanks for letting me know. I will make a pr soon
from swift-openapi-generator.
Related Issues (20)
- Null property type with quotes not generated HOT 14
- Support schemas.type: string, format: uri generates URL property not String HOT 3
- How to support OAuth2 Password flows? HOT 3
- allOf plus properties HOT 2
- OpenAPI shared components HOT 4
- bug/regression: latest yams results in incomplete generation of types HOT 10
- Logging and HTTPBody HOT 3
- Merging oneOf with many compatible enums of a single value HOT 10
- anyOf encoder does not include discriminator's `parameterName` leading to incorrect encoding HOT 2
- Is there a workaround to deal with slow compilation times for a very large openapi file? HOT 3
- Empty arrays are omitted from query params HOT 5
- Support for `multipart/mixed`? HOT 1
- When a delete path do not have responses content an error generated HOT 2
- Add ability to attach protocols to generated models HOT 9
- Protocol where each `Output` conforms to HOT 3
- Make the generator usable on very big specs HOT 3
- Old and new examples HOT 3
- visionOS can't use HOT 4
- How to convert the binary obtained from the server into a playable Data type? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-openapi-generator.