Skip to content

feat: Impossible to use UUID as param for object construction #703

Closed
@ivanproskuryakov

Description

@ivanproskuryakov
Contributor

Description

The usage of UUID instead of id in routes like: http://0.0.0.0:3000/api/products/04879b32-c329-48d7-a652-818794b684f1
Is trying to build JSON object while returning a raw parameter(uuid) provided.

References to similar problems:

References to the actual line in the code: https://github.com/typestack/routing-controllers/blob/master/src/ActionParameterHandler.ts#L189

Minimal code-snippet showcasing the problem

  @Get('/:id')
  public getProduct(
    @EntityFromParam("id") product: Product,
  ) {
    return product;
  }

Expected behavior

constructed product entity from the UUID

Actual behavior

Error: 
    at new HttpError (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/http-error/HttpError.ts:16:18)
    at new BadRequestError (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/http-error/BadRequestError.ts:10:5)
    at new ParameterParseJsonError (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/error/ParameterParseJsonError.ts:10:5)
    at ActionParameterHandler.parseValue (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/ActionParameterHandler.ts:194:15)
    at ActionParameterHandler.normalizeParamValue (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/ActionParameterHandler.ts:139:20)
    at ActionParameterHandler.handle (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/ActionParameterHandler.ts:39:24)
    at /Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/RoutingControllers.ts:114:43
    at Array.map (<anonymous>)
    at RoutingControllers.executeAction (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/RoutingControllers.ts:114:8)
    at /Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/RoutingControllers.ts:82:23
    at routeHandler (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/driver/express/ExpressDriver.ts:165:14)
    at Layer.handle [as handle_request] (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/express/lib/router/route.js:137:13)
    at routeGuard (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/src/driver/express/ExpressDriver.ts:179:16)
    at Layer.handle [as handle_request] (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/proskuryakovivan/code/byg/byg-admin-core/node_modules/express/lib/router/route.js:137:13)

Activity

changed the title [-]fix: <your-title-goes-here>[/-] [+]Impossible to use UUID as param for object construction, BUG[/+] on Apr 9, 2021
changed the title [-]Impossible to use UUID as param for object construction, BUG[/-] [+]feat: Impossible to use UUID as param for object construction[/+] on Aug 3, 2021
attilaorosz

attilaorosz commented on Dec 9, 2022

@attilaorosz
Member

Should be released

github-actions

github-actions commented on Jan 9, 2023

@github-actions

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

locked as resolved and limited conversation to collaborators on Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageIssues which needs to be reproduced to be verified report.type: fixIssues describing a broken feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ivanproskuryakov@attilaorosz

        Issue actions

          feat: Impossible to use UUID as param for object construction · Issue #703 · typestack/routing-controllers