Adam Leventhal
Adam Leventhal
We did this with a hand-rolled `JsonSchema` implementation: https://github.com/oxidecomputer/omicron/blob/17485e8bc05a0e50d5223a09094c9b90b677d55c/nexus/src/external_api/params.rs#L404-L482 Note that while this is applicable for our use case with OpenAPI v3.0.3, it would be good to see schemars updated...
That sounds like a bug in ajv: https://json-schema.org/draft/2019-09/json-schema-validation.html#rfc.section.7.2.3 > An implementation MUST NOT fail validation or cease processing due to an unknown format attribute.
There isn't a tremendously clean way to do this. Here are some options: ## Copy, Derive, `with` You can copy the type definitions, add derive, and then do something like:...
What would you expect that JSON schema to be for `RawValue`? Same as `Value`?
> I believe we could achieve it for all types by leveraging [`std::any::type_name()`](https://doc.rust-lang.org/std/any/fn.type_name.html). However, this does mean that the values _may_ not be stable, particularly between different versions of rustc....
@GREsau if you'd be amenable to my proposal, I'd be happy to write a PR for this
@GREsau can you take a look
Something like this? ```rust pub trait OutputVisitor { type Output; fn visit_root_schema(&mut self, root: &mut RootSchema) -> Self::Output; fn visit_schema(&mut self, schema: &mut Schema) -> Self::Output; fn visit_schema_object(&mut self, schema:...
FWIW if you do this: ```rust #[derive(JsonSchema)] #[schemars(deny_unknown_fields)] struct StringMap { foo: String, #[serde(flatten)] bar: std::collections::HashMap, } #[derive(JsonSchema)] #[schemars(deny_unknown_fields)] struct Value { foo: String, #[serde(flatten)] bar: std::collections::HashMap, } #[derive(JsonSchema)] #[schemars(deny_unknown_fields)]...
> It is a bit weird that it generates `additionalProperties: false` for `#[serde(flatten)] serde_json::Value` (but imho, using `serde_json::Value` is a bit weird anyway. That'll fail serialization if the value is...