Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when schema object type is array #90

Open
av314 opened this issue Jan 31, 2023 · 1 comment
Open

Crash when schema object type is array #90

av314 opened this issue Jan 31, 2023 · 1 comment

Comments

@av314
Copy link

av314 commented Jan 31, 2023

According to the OpenAPI spec: "The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays."

However, ngx-form-generator crashes when the schema is of type array.

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

A schema Object example from the OpenAPI spec with an array:

animals:
  type: array
  items:
    type: string
{
    "animals": {
        "type": "array",
        "items": {
            "type": "string"
        }
    }
}

Or:

    Cdns:
      type: array
      items:
        type: string
        $ref: "#/components/schemas/Cdn"

Thanks,

Arjen

@av314
Copy link
Author

av314 commented Jan 31, 2023

ngx-form-generator also crashes when the schema has an element of type 'string'.
It seems only 'object' is accepted in the schema section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant