api icon indicating copy to clipboard operation
api copied to clipboard

Empty arrays are stripped from request bodies

Open ArielPrevu3D opened this issue 9 months ago • 0 comments

Empty arrays stripped from my request bodies, even when they are specified as "required" in the schema. Is this the intended behavior?

https://github.com/readmeio/oas/blob/main/packages/oas-to-har/src/index.ts#L442 https://github.com/readmeio/remove-undefined-objects/blob/5.0.0/src/index.ts#L27

My current workaround is the following

import * as ruo from 'remove-undefined-objects';
Object.defineProperty(ruo, 'default', {
  get: () => (obj: unknown) => obj,
});

The API I'm working with needs me to send an empty array, it won't accept a missing field in the body.

ArielPrevu3D avatar May 08 '24 15:05 ArielPrevu3D