RepreZen / KaiZen-OpenAPI-Editor

Eclipse Editor for the Swagger-OpenAPI Description Language
Eclipse Public License 1.0
115 stars 12 forks source link

Array schemas that are their own item type should be marked as erroneous #445

Closed andylowry closed 6 years ago

andylowry commented 6 years ago

Examples:

list:
  type: array
  items:
    $ref: "#/definitions/list"

or

list:
  type: array
  items:
    type: array
    items:
      $ref: "#/definitions/list"

The swaggerdoc gentemplate in RepreZen API Studio throws an exception upon encountering anything like this, so currently, models that look like this create rendering errors in live doc view. If KZOE detected these and marked them as errors, the live view would be suppressed until model errors were fixed.

andylowry commented 6 years ago

Withdrawing this issue... JSON Schema (and hence also Swagger and OpenAPI3) is full of ways to create unsatisfiable or nonsensical schemas, and attempting to detect them is probably a losing cause. Better to have consumers do the best they can. In this case, the document generator will be modified to do something to present the recursive array types.