go-qemu
go-qemu copied to clipboard
qmp: API codegen based on QMP schema
For my own uses, I'm in the middle of writing a go generate
codegen to transform the QMP API spec (qapi-schema.json) into reasonably idiomatic Go code. Would you be interested in a contribution of this autogen and resulting API?
Depending on how idiomatic I'm able to make it (the API is pretty rough in places), we could make it a subpackage and allow the main qmp library to use either higher level types that wrap the raw ones, or the raw ones directly if the user needs to use a feature that hasn't been exposed. My aspirational goal is to make the autogenerated bindings good enough that this isn't necessary, but of course that's hard :).
Sounds excellent to me. I like the approach of generating a subpackage and then wrapping it with cleaner types. We actually have #97 open to do some of that work anyway.
Please do let us know what you come up with!
CC @benlemasurier
I've got a WIP here: https://github.com/danderson/go-qemu/tree/master/internal/qmp-gen
The code is still very much in flux, exploratory programming and all that. A sample of the current output is in https://github.com/danderson/go-qemu/blob/master/internal/qmp-gen/autogen .
I'll send another update when the code is actually able to speak QMP to an active connection, at that point we can decide if the generated API has the right shape, and if/how you'd like to incorporate it.
This looks very cool. I'm excited to see what you come up with!
@danderson we just created #go-qemu
on freenode if you're interested in joining us on IRC to discuss this more!
This has been merged since 6edbae9940961a9f61d3fc0aa3d518ba372168db.