GithubHelp home page GithubHelp logo

Comments (5)

tosiek88 avatar tosiek88 commented on April 28, 2024

I find out what was wrong:
I shouldn't use

import { IntersectionType } from '@nestjs/swagger'

instead of that use from mapped-types

import { IntersectionType } from '@nestjs/mapped-types'

mapped-types is working as expect.

  @Post()
  @UsePipes(new ValidationPipe({ transform: true }))
  create(@Body('dto') dto: combineDto) {
    Logger.debug(dto);
    return 'OK';
  }

Response:

OK
<!-- POST http://localhost:3000/ -->
<!-- HTTP/1.1 201 Created -->
<!-- X-Powered-By: Express -->
<!-- Content-Type: text/html; charset=utf-8 -->
<!-- Content-Length: 2 -->
<!-- ETag: W/"2-nOO9QiTIwXgNtWtBJezz8kv3SLc" -->
<!-- Date: Mon, 26 Oct 2020 19:44:36 GMT -->
<!-- Connection: keep-alive -->
<!-- Request duration: 0.053106s -->
[Nest] 15392   - 10/26/2020, 8:48:10 PM   [NestFactory] Starting Nest application...
[Nest] 15392   - 10/26/2020, 8:48:10 PM   [InstanceLoader] AppModule dependencies initialized +13ms
[Nest] 15392   - 10/26/2020, 8:48:10 PM   [RoutesResolver] AppController {}: +6ms
[Nest] 15392   - 10/26/2020, 8:48:10 PM   [RouterExplorer] Mapped {, GET} route +3ms
[Nest] 15392   - 10/26/2020, 8:48:10 PM   [RouterExplorer] Mapped {, POST} route +2ms
[Nest] 15392   - 10/26/2020, 8:48:10 PM   [NestApplication] Nest application successfully started +3ms
[Nest] 15392   - 10/26/2020, 8:48:10 PM    Listen to port : 3000 +5ms
[Nest] 15392   - 10/26/2020, 8:49:12 PM   Object:
{
  "table": [
    1,
    2,
    3,
    4
  ],
  "table2": [
    1,
    2,
    3,
    4
  ],
  "text": "test"
}
 +61848ms

from mapped-types.

tosiek88 avatar tosiek88 commented on April 28, 2024

So looks like I was too fast, because today morning I realize that Swagger will not work with that :D

from mapped-types.

kamilmysliwiec avatar kamilmysliwiec commented on April 28, 2024

Lets' track this here nestjs/swagger#1015

from mapped-types.

viczam avatar viczam commented on April 28, 2024

The issue is still present on "@nestjs/mapped-types": "^0.1.1".

I have a use case similar to the one above, except I'm validating query params.

from mapped-types.

kamilmysliwiec avatar kamilmysliwiec commented on April 28, 2024

If you face any issue, please, create a separate ticket with a minimal reproduction repository.

from mapped-types.

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.