nestjs / swagger

OpenAPI (Swagger) module for Nest framework (node.js) :earth_americas:

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Support ] How can I use NestJS decorators to wrap the schema into content/<media-type>?

mmmitit opened this issue · comments

commented

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

  1. I want to create a JSON-formatted query based on the following information.

Describe the solution you'd like

The request URL on the Swagger page is incorrectly written.

image

Incorrect URL:
http://localhost:3000/?type=t-shirt&color=blue

Desired URL:
http://localhost:3000/?filter={"type":"t-shirt","color":"blue"

How can I write a decorator for the desired URL?"

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Currently, @nestjs/swagger is using the open api 3.0 version as the latest version (7.1.2). I want to make a request url in JSON-formatted query format using a decorator.

The current code is as follows.

export class testFliterDto {
  @ApiProperty({
    example: '{"type": t-shirty,"color": blue }',
    description: 'filter',
    required: false,
    type: 'object',
  })
  filter: {
    type: string;
    color: string;
  };
}

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.