surfstudio/SurfGen

Recursive models

Closed this issue · 0 comments

Currently there is no support of cycles (when models A and B have references to each other) or recursive models.
For example, this model will not be generated:

ProductsCategory:
      type: object
      properties:
        id:
          type: string
        subcategories:
          type: array
          items:
            $ref: "#/components/schemas/ProductsCategory"

The error will be thrown: Message: There is a reference cycle which is found for reference #/components/schemas/ProductsCategory from file /products/models.yaml
Therefore it's impossible to generate api or models which have reference to this model.
To use generation, we need to be able to filter such model as described here #56, otherwise the support of recursion is required (if possible)