Skip to content

Issue importing doc #4

Open
Open
@podviaznikov

Description

@podviaznikov

When I import doc which has two array items (with a property that has null) all works fine:

const importedDoc = cambria.importDoc({
        items: [
                { name: 'Peter Johnson', nationality: null },
                // { name: 'Ashley Appleseed', nationality: null },
                { name: 'John Doe', nationality: null }
              ]
    })

but if I have 3 items in the array:

const importedDoc = cambria.importDoc({
        items: [
                { name: 'Peter Johnson', nationality: null },
                { name: 'Ashley Appleseed', nationality: null },
                { name: 'John Doe', nationality: null }
              ]
    })

it fails with error:

(node:21691) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'type' of null
    at Object.mergeSchemaObjs (.../node_modules/to-json-schema/lib/helpers.js:40:19)
    at .../node_modules/to-json-schema/lib/index.js:93:24
    at Array.reduce (<anonymous>)
    at ToJsonSchema.getCommonArrayItemSchema (...node_modules/to-json-schema/lib/index.js:92:22)

Node version: v12.18.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions