Skip to content

alias schema.query to schema.querystring in route definition #1690

@mcollina

Description

@mcollina

🐛 Bug Report

When defining a route, it's easier to schema.query be automatically copied into schema.querystring, mainly because request.query is what we use to access the querystring, and simmetry here would be good.

Moreover, we should look into doing some stricter validation of those properties to catch this type of errors.

To Reproduce

app.get('/', {
  schema: {
    query: { // this should querystring
      type: "object",
      properties: {
        name: {
          type: "string",
          default: "world"
        }
      },
      required: ["name"]
    }
  }
}, async (request, reply) => {
  return { hello: request.query.name }
})

Expected behavior

schema.query to work as schema.querystring.

Your Environment

  • node version: 10
  • fastify version: all
  • os: Mac, Windows, Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions