Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in typestack ValidateBody #785

Closed
AleksandrSl opened this issue Aug 6, 2020 · 1 comment · Fixed by #786
Closed

Error in typestack ValidateBody #785

AleksandrSl opened this issue Aug 6, 2020 · 1 comment · Fixed by #786
Assignees
Labels

Comments

@AleksandrSl
Copy link
Contributor

import { ValidateBody } from '@foal/typestack'

abstract class EntityController {
  protected constructor(
    protected entityClass: Class<I>
  ) {
  }  

  @ValidateBody((controller: EntityController<any>) => controller.entityClass)
  async create(ctx: Context) {}
}

class SomeController extends EntityController {
  constructor() {
    super(SomeEntity)
  }
}

class AnotherController extends EntityController {
  constructor() {
    super(AnotherEntity)
  }
}

When you call create for one repository validator is fixed to SomeEntity for example.

Error is in '@foal/typestack' ValidateBody cls = isArrowFunction(cls) ? cls(this) : cls;.
Function parameter is overriden on the first call.
Spotted by @vedyakov.

@LoicPoullain LoicPoullain mentioned this issue Aug 7, 2020
2 tasks
@LoicPoullain LoicPoullain added this to Backlog in Issue tracking via automation Aug 7, 2020
@LoicPoullain LoicPoullain moved this from Backlog to Work In Progress in Issue tracking Aug 7, 2020
@LoicPoullain
Copy link
Member

Resolved in v1.11.1

Issue tracking automation moved this from Work In Progress to Done / Closed This Release Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Issue tracking
  
Done / Closed This Release
Development

Successfully merging a pull request may close this issue.

2 participants