apideck-libraries / portman

Port OpenAPI Specs to Postman Collections, inject test suite and run via Newman 👨🏽‍🚀
http://getportman.com/
Apache License 2.0
638 stars 59 forks source link

overwrite - handle overwrite of non-empty objects with plain values #648

Closed thim81 closed 2 months ago

thim81 commented 2 months ago

linked to #646

Result before:

/Path/to/repro/node_modules/dot-object/index.js:118
        throw new Error("Trying to redefine non-empty obj['" + k + "']")
              ^

Error: Trying to redefine non-empty obj['startDateTime']
    at DotObject._fill (/Path/to/repro/node_modules/dot-object/index.js:118:15)
    at DotObject._fill (/Path/to/repro/node_modules/dot-object/index.js:114:10)
    at DotObject.str (/Path/to/repro/node_modules/dot-object/index.js:179:10)

Result after:

image
thim81 commented 2 months ago

@nicklloyd Do you see any risk or side-effect of this?

nicklloyd commented 2 months ago

it's getting 'set' later in the flow yea? You're just removing it beforehand if it's an object?

thim81 commented 2 months ago

it's getting 'set' later in the flow yea? You're just removing it beforehand if it's an object?

Yes, we are removing the "object" to replace it with a "string" value,

// Update property from object
return dot.str(path, newValue, objectOrArray)

since the "dotObject" library cannot handle overwriting an object, so it throws an error.

nicklloyd commented 2 months ago

seems fine... can't recall if it was just bloat that kept us from using lodash... they've fixed all that with more recent version

thim81 commented 2 months ago

Sidetrack: Do you suggest that we can/should replace DotObject with Lodash?