Marwes / schemafy

Crate for generating rust types from a json schema
MIT License
242 stars 51 forks source link

Suboptimal generation on `allOf` with a single `$ref` #75

Open woodruffw opened 11 months ago

woodruffw commented 11 months ago

To my interpretation, these forms within an object property are equivalent:

"some_prop": {
  "$ref": "#/definitions/SomeProp"
}

and:

"some_prop": {
  "allOf": [
    { "$ref": "#/definitions/SomeProp" }
  ]
}

however, Schemafy only generates some_prop: SomeProp for the first one: the second one receives a suboptimal production of some_prop: serde_json::Value.

This should be a relatively straightforward fix, so I'll look into it.

woodruffw commented 11 months ago

I've opened #76 for this, and have confirmed that it generates the Rust models/property types that I expect.