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

Issue importing doc #4

Open
podviaznikov opened this issue Oct 8, 2020 · 3 comments
Open

Issue importing doc #4

podviaznikov opened this issue Oct 8, 2020 · 3 comments

Comments

@podviaznikov
Copy link

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

@scott-wyatt
Copy link

Bumping above ^^^

I created a Runkit snippet where the same thing happens.

https://runkit.com/embed/p5i1i5yqo6fr

It's related to the postProcessFnc in importDoc

@geoffturk
Copy link

image

Comment out line 20 in src/docs.ts and recompile (yarn build) and it works.

@michielbdejong
Copy link

I was able to reproduce both the problem and the mitigation. I'm not sure what that line does though, nor what the side-effects of removing it would be.

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

4 participants