Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

request.query.settings should be object

See original GitHub issue


Is serialized objects not supported or am I doing something wrong? I have an endpoint defined like that ( I deliberately simplified this ) :

      summary: "Retrieve something"
        - in: query
          style: form
          name: settings
          explode: true
              - type: object
                    type: boolean
                    default: true
                    type: array
                    default: []
                    uniqueItems: true
                      type: integer
                      minimum: 0
                      example: 42
          description: "An array of items"
                type: array
                  $ref: "#/components/schemas/someItem"
                uniqueItems: true

I tested two approaches that have failed with Postman ( that imported the api definition ) :


    "message": "request.query.settings should be object",
    "errors": [
            "path": ".query.settings",
            "message": "should be object",
            "errorCode": "type.openapi.validation"


    "message": "Unknown query parameter onlyValidated",
    "errors": [
            "path": ".query.onlyValidated",
            "message": "Unknown query parameter onlyValidated"

FYI, here is my express server implementation :

const express = require('express');
const path = require('path');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');

const routes = require('./routes/index');

// miscellaneous passport things
const passport = require('passport');

// OpenAPI V3 validation middleware
const OpenApiValidator = require('express-openapi-validator').OpenApiValidator;
const spec = path.join(__dirname, 'api.yml');

// Initialize passport ( Passport is a singleton )

const app = express();

// middleware
app.use(bodyParser.urlencoded({ extended: false }));

// API validation before routes and password.js
// Install the OpenApiValidator on your express app
new OpenApiValidator({
    apiSpec: spec,
    validateRequests: true,
    validateResponses: false,
    // securityHandlers: {
    //   ApiKeyAuth: (req, scopes, schema) => true,
    // },

// Passport Js must have that

// routes
app.use('/', routes);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
    let err = new Error('Not Found');
    err.status = 404;

// error handler
// no stacktraces leaked to user unless in development environment
app.use(function(err, req, res, next) {

    // if error thrown by validation, give everything else depending of the environment
    res.status(err.status || 500).json({
        message: err.message,
        errors: err.hasOwnProperty("errors")
            ? err.errors
            : (app.get('env') === 'development') ? [err] : []


module.exports = app;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

jy95commented, Dec 6, 2019

It works like a charm : I can access object properties as expected ( req.query.settings )

cdimasciocommented, Dec 3, 2019

@jy95 please give v3.0.2 a try. it should improve the query param serialization handling. please let me know how it goes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Describing Parameters - Swagger
Query parameters can be primitive values, arrays and objects. ... OpenAPI lets you define custom request headers as in: header parameters.
Read more >
Query parameters versus request object
By default, PingFederate sends all request parameters through multiple query parameters, unsigned.
Read more >
OpenAPI JSON Objects as Query Parameters - Baeldung
Learn how to specify JSON objects as query parameters using the OpenAPI specification.
Read more >
REST API Design Best Practices for Parameter and Query ...
Where to put the parameters for APIs? Best practices for parameter and query string usage in REST APIs.
Read more >
Query options overview - OData | Microsoft Learn
A query option is basically requesting that a service perform a set of transformations such as filtering, sorting, etc. to its data before ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found