ngx-form-generator icon indicating copy to clipboard operation
ngx-form-generator copied to clipboard

swagger.json handle properties under 'allOf'

Open MrBasque opened this issue 4 years ago • 7 comments

Hi, thanks for this nice package. However, we are currently unable to generate a form due to the following error:

node_modules\@verizonconnect\ngx-form-generator\dist\generator-lib.js:59
  const fields = Object.keys(definition.properties);
                        ^
TypeError: Cannot convert undefined or null to object

Our swagger.json contains several definitions that are structured like this:

"definitions":{
  "Trade": {
    "allOf": [{
        "$ref": "#/definitions/RootEntity"
      },
      {
        "type": "object",
        "properties": {
         "companyName": {
            "type": "string"
          },
          ....
        }
      }
    ]
  },
....
}

We did nothing special to the swagger configuration that I know of. the generator-lib.js though, searches for "properties" as a direct child property which it cannot find in this case, because the properties are within an child under the "allOf" property.

anything we can do to resolve this?

MrBasque avatar Nov 25 '20 15:11 MrBasque