oliyh / martian

The HTTP abstraction library for Clojure/script, supporting OpenAPI, Swagger, Schema, re-frame and more
MIT License
525 stars 42 forks source link

Support `allOf` type in OpenAPI #107

Open oliyh opened 3 years ago

oliyh commented 3 years ago

https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#composition-and-inheritance-polymorphism

The OpenAPI Specification allows combining and extending model definitions using the allOf property of JSON Schema, in effect offering model composition. allOf takes an array of object definitions that are validated independently but together compose a single object.

e.g.

author: {
  description: "Details of the user who attached the file.",
  readOnly: true,
  allOf: [
    {
      $ref: "#/components/schemas/User"
    }
  ]
}
jwhitlark commented 10 months ago

Note that there are several related properties: oneOf, anyOf. I've run into this trying to use martian in the field. https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/