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

User command error on return value validation #6

Open
Nokitoo opened this issue May 22, 2018 · 3 comments
Open

User command error on return value validation #6

Nokitoo opened this issue May 22, 2018 · 3 comments

Comments

@Nokitoo
Copy link
Contributor

Nokitoo commented May 22, 2018

export class PlayerModule {
    async list(state: mage.core.IState) {
        const players = await Player.list(state, {});
        console.log(players);

        return players;
    }
}

The validation of the return value players makes classValidator.validate crash, and I don't know where it could come from.

I don't think it comes from my topic because I can correctly create data with it using @Acl and validation decorators.

@stelcheck
Copy link
Member

What is the error stack? First guess would be that the backend vault for player does not support list, but maybe the error being thrown isn't clear enough.

@Nokitoo
Copy link
Contributor Author

Nokitoo commented May 25, 2018

[MAGE state] Cannot read property 'prototype' of undefined
  error: {
    "type": "TypeError",
    "file": "MetadataStorage.ts",
    "line": 79,
    "offset": 37,
    "stack": [
      "src/metadata/MetadataStorage.ts:79:37",
      "Array.filter (<anonymous>)",
      "MetadataStorage.getTargetValidationMetadatas (src/metadata/MetadataStorage.ts:75:61)",
      "ValidationExecutor.execute (src/validation/ValidationExecutor.ts:44:54)",
      "Validator.coreValidate (src/validation/Validator.ts:31:18)",
      "Validator.validate (src/validation/Validator.ts:56:21)",
      "Object.validate (src/index.ts:49:44)",
      "validateObject (node_modules/mage-validator/src/decorators.ts:157:31)",
      "Function.value (node_modules/mage-validator/src/decorators.ts:218:16)",
      "<anonymous>"
    ]
  }
  data: {
    "description": "players.list",
    "actorId": "fff135d0-58c8-4591-9aa9-fc605155ec24"
  }

@stelcheck
Copy link
Member

@Nokitoo can you confirm if this is still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants