cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Self-referencing arrays / nested objects don't work with namespaces #90

Closed tommck closed 4 years ago

tommck commented 4 years ago

Related to #86.

When an object is self-referencing with an array, it still doesn't work.

Going to send a PR in a few minutes with a breaking test (and possibly a fix)

Source JSON:

{
  "openapi": "3.0.1",
  "info": {
    "title": "Blah",
    "version": "1"
  },
  "paths": {},
  "components": {
    "schemas": {
      "Foo.Bar.Baz": {
        "required": [
          "description",
          "childDetails"
        ],
        "type": "object",
        "properties": {
          "description": {
            "type": "string"
          },
          "childDetails": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Foo.Bar.Baz"
            }
          }
        },
        "additionalProperties": false
      }
    }
  }
}

Output TS:

/* tslint:disable */
export interface Baz {
  childDetails: Array<FooBarBaz>;
  description: string;
}
tommck commented 4 years ago

having trouble not breaking existing code with my "fix"... :( dammit