Closed sivizius closed 10 months ago
There was a similar request some time ago for a different crate: https://github.com/juhaku/utoipa
https://github.com/fussybeaver/bollard/issues/289
I believe the author ended up forking bollard for his/her purpose.
The main problem is that we already abide by an existing json schema spec: https://github.com/moby/moby/blob/master/api/swagger.yaml - even if we did decide to support a second spec, you would need to amend the templates that generate the code.
Unfortunately, I'm not that keen to support it, because you could just be using the original schema to get the same benefits, and bollard maintainers would need to maintain quite a bit of code for effectively a duplicated specification. But happy to discuss any workarounds that may help integrate your project.
Closing for now
Outside the crate
schemars
, the traitJsonSchema
can only implemented on owned types due to the orphan rule. So ifJsonSchema
is required to be implemented for a type in an API, e.g.aide
, those types have to be basically copied and#[derive(JsonSchema)]
as well as some serde-remote/wrapper-magic applied. This PR avoids all of this by optionally derivingJsonSchema
if used with featureschemars
.