Add a generator?
We've started introducing codable to our codebase, and are rewriting a few API client libraries to use codable. It has become a very repetitive task, and we just thought that a generator would be ideal...
My initial idea is something like this:
- Create a
.jsonor.yamlfile, that defines the properties for each message and its type - Define which class is in charge to decode/encode the message
The generator should then add the (camelized) names of the properties to the target class, and write the encode and decode methods for the specified class.
For types that are not native, it should be possible to specify a function that is in charge of en/decoding it.
What do you think?
A generator from a standardized format (OpenAPI) is a great idea. package:open_api parses OpenAPI specifications, so that piece is there. I had started a generator awhile back, but had not had time finish it or update it to use codable (https://github.com/stablekernel/open-api-generator). The good news is that that effort is what led to this package, so it may be really easy to update the generator.
This effort is on our roadmap - because aqueduct can autogenerate an OpenAPI doc for an api - but it has not been prioritized. If you’d be interested in helping out, I can provide more guidance.
That sounds good. Unfortunately I don't have the time right now, but if I manage to squeeze it in a few weeks from now, I'll get back to you!