Ask a Question

Circular definitions with oneOf and allOf

Occasional Visitor

Circular definitions with oneOf and allOf

Hello Community,


we are having a openApi definition with a curcular reference with oneOf and allOf. Object Foo is defined to be of object Bar and object Bar is defined to be All of Bar.



"Foo" : {
        "properties" : {
          "createdBy" : {
            "format" : "int64",
            "type" : "integer",
            "readOnly" : true
        "oneOf" : [ {
          "$ref" : "#/components/schemas/Bar"
        }, {
          "$ref" : "#/components/schemas/Baz"
        } ],




"Bar" : {
        "allOf" : [ {
          "$ref" : "#/components/schemas/Foo"
        } ],



From all I can find in the documentation in oneOf, anyOf, allOf, not (, this is a valid swagger file, however the outcome of the generator for angular-typescript is not compiling because it ignores the Bar properties, for Java it seems to ignore the Baz possibility.


Is this definition actually allowed?


Potential similar issue:

Showing results for 
Search instead for 
Did you mean: