Git Product home page Git Product logo

Comments (5)

mdmower avatar mdmower commented on June 9, 2024 1

UPDATE: _d was not defined in the function, i defined it and now it works :)

Thanks for fixing my derp. I'll request a review on the PR.

from express-openapi-validator.

mdmower avatar mdmower commented on June 9, 2024

@tflolo - Do any of your security handlers depend on form values submitted as part of the multipart/form-data request? From the OpenAPI schema you posted, it doesn't look this this would be the case, unless you removed those values before pasting here?

from express-openapi-validator.

tflolo avatar tflolo commented on June 9, 2024

@mdmower - None of my security handlers does anything other than check for a valid session. The code i posted is complete, and only thing i change between runs is the version of express-openapi-validator from 5.0.1 to 5.1.0. I can try to move multipartMiddlware after securityMiddleware in 5.0.1 and see if that works.

from express-openapi-validator.

mdmower avatar mdmower commented on June 9, 2024

@tflolo - Is there a chance that you recently updated your openapi schema to support multiple uploads via oneOf schema? I was able to reproduce the same error as you, but the error I found also exists in version 5.0.5. To see if we're observing the same error, when version 5.1.0 is installed, could you temporarily update the following file and retest?

in node_modules/express-openapi-validator/dist/middlewares/openapi.request.validator.js, replace old line 131:

const type = (_c = (_b = (_a = schemaBody === null || schemaBody === void 0 ? void 0 : schemaBody.properties) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.properties[key]) === null || _c === void 0 ? void 0 : _c.type;

with new line:

const type = (_d = (_c = (_b = (_a = schemaBody === null || schemaBody === void 0 ? void 0 : schemaBody.properties) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.properties) === null || _c === void 0 ? void 0 : _c[key]) === null || _d === void 0 ? void 0 : _d.type;

I've drafted PR #878 (which outputs the compiled JS above) but would like confirmation that it resolves the issue.

UPDATE: I just noticed that your report says you updated from 5.0.1 to 5.1.0, so this is starting to make sense. Support for nested JSON in multipart bodies was added in 5.0.2. See e5cb5d6 .

from express-openapi-validator.

tflolo avatar tflolo commented on June 9, 2024

@mdmower The error changed,

      status: 500,
      text: '{"message":"_d is not defined"}',
      method: 'POST',
      path: '/api/wave-log/upload'

I upgraded to 5.1.0 and copied the line 131 you posted

UPDATE: _d was not defined in the function, i defined it and now it works :)

from express-openapi-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.