Hi folks,
I've been writting a client from scratch using the OpenAPI specifications,
here is some information others might find useful.
The specification contains incomplete or incorrect definitions.
Most of the definitions are missing the required field list, for example,
the SpecGenerator does not indicate that the image name is required.
And here is an example of an incorrect definition:
https://github.com/containers/podman/issues/9578
The definitions location is not always consistent. Most of them are in
the top level `definitions` map, but some are defined differently.
For example:
- ExecConfig is specified in the path body, instead of using
a schema reference.
- LibpodImagesPullResponse is defined in the `responses` map, but
it just references another definition, causing an extra indirection.
Some endpoints need custom logic, for example:
- container/attach upgrades the connection to a tcp stream using a
binary format (see util.go makeHTTPAttachHeader).
- container/logs returns a binary chunked stream.
- images/pull returns a raw list of json objects.
- exec/start returns a raw integer.
API versioning does not seem to be implemented,
and the current version number is unclear.
Thus, generating the client code using swagger-codegen does not
work well. Instead, I wrote a custom script to process and fix
the definitions one endpoint at a time. I was able to cover
a significant amount of the endpoints and you can see a preview of
the client here:
https://docs.softwarefactory-project.io/podman-haskell/
Regards,
-Tristan