-
-
Notifications
You must be signed in to change notification settings - Fork 674
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
No metadata found....
Error
#401
Comments
Once again, what is your problem? You don't use validation but you don't want to pass
See this for more info: |
No, I use validation, so I don't pass To remove the error, I'd think either |
Them having an error makes me believe that they're using a global within |
Yes, the problem is that TypeGraphQL and TypeORM uses So multiple instances of import * as TypeORM from "typeorm";
import * as ClassValidator from "class-validator";
import { Container } from "typedi";
TypeORM.useContainer(Container);
ClassValidator.useContainer(Container);
export * from "./entities";
export * from "./requests";
This doesn't fix the error. Without lerna and hoisting dependencies or using a private npm registry, you will have two node_modules for both project and both will have own instances of |
Okay, hmm. I'm using The error comes from within
Based off the error message, I'd think that if I brought my own I suppose I'll just play it safe and do manual validation. |
Try also There would be a problem with duplicated
You can use method or param decorators to create own validation rules, you don't have to do this manually inside each resolver's body. So you have a few options:
|
I oddly get the error even when I dedupe, use resolutions, and have one instance of class-validator. My mono-repo packages don't have any node_modules, they are all just in the root node_modules directory. node_modules under type-graphql package also doesn't contain class-validator. There's just one..... I'll look into using my own decorators. I'm also not using TypeORM. So it's interesting to not know what's going on. |
I'm sure it has to do with how I use inversify. I'm creating a container and bootstrapping code there, so my class imports happen before, but I get the error even after I remove |
@19majkel94 Is it possible now to create a middleware that has the converted inputs/args? If not, it might be cool if there was an option to get the decorated params on a middleware function call then people can bring their own. |
If you register your container after evaluating the class decorators, it will have empty metadata storage in the container, so you will see this warning.
Not yet - see #123.
Custom validation will be supported by vNext and plugins system 😉 |
@19majkel94 can't wait for it! :) |
The warning message is spot-on! You depend on an outdated version: Line 27 in 8e112d1
Whereas when someone imports class-validator in their own code, they will probably use the latest version, which is 0.10.0
|
I will close this issue for now as it looks like the problem is with how |
I'm using
class-validator
and having to bring it in as a dependency as well to add the constraints, but get the annoying console warning:No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
I don't want to pass
validate: false
and I don't want to get into a situation where my validation constraints aren't running due to how it works internally.The text was updated successfully, but these errors were encountered: