Skip to content

Cannot disable defaults middleware #903

@coryasilva

Description

@coryasilva

Actual:
req.body = { status: 'Draft' }

Expected:
req.body = {}

Steps to Repo:

  1. Configure endpoint with this following doc:
    export const patch = [(req, res, next) => {
      console.log(req.body);
      res.status(204).end();
    }];
    
    patch.apiDoc = {
      "x-express-openapi-disable-defaults-middleware": true,
      requestBody: {
        required: true,
        "application/json": {
          schema: {
            additionalProperties: false,
            properties: {
              status: {
                type: "string",
                default: "Draft",
              },
            },
          },
        },
      },
    };
  2. Console log the request body after making a PATCH command
    curl -X PATCH  --data '{}' -H "content-type: application/json" http://localhost:8080/blah/1

Thoughts:

  • Was this caused by this PR
  • I was trying to opt-out of defaults middleware as described here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions