Skip to content

Empty arrays are stripped from request bodies #882

Open
@ArielPrevu3D

Description

@ArielPrevu3D

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.

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