Skip to content

handleState when state.kind is null#7

Open
mohbahbah wants to merge 1 commit into
tctree333:mainfrom
mohbahbah:handleState-null-stat.kind
Open

handleState when state.kind is null#7
mohbahbah wants to merge 1 commit into
tctree333:mainfrom
mohbahbah:handleState-null-stat.kind

Conversation

@mohbahbah

@mohbahbah mohbahbah commented Aug 15, 2023

Copy link
Copy Markdown

when a yaml file array property has item without a value (which will cause a validation error)
it was found that state.kind is reported as null causing the handleState method to skip this scalar type
in the example below filename doesn't have a value

rootpath:
   - pathtype: type1
     filename: 

which js-yaml will report its filename json data as null

{
  rootpath: [
    {
      pathtype: "type1",
      filename: null,
    },
  ],
}

a fix (workaround) can be applied by adding kind === null condition to the scalar types are primitives (non maps/arrays) condition

// scalar types are primitives (non maps/arrays)
      if (kind === "scalar" || kind === null) {
            ........
      }

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

Successfully merging this pull request may close these issues.

1 participant