Closed mgsasaki closed 1 year ago
Hey, can you explain how to reproduce it?
Not sure I understand how your change is fixing it. I was trying to repro with the latest hasura and I wasn't able to connect my app with this lib as a remote schema. The error is different. And you made this change only for filters but what about sorting?
I was able to repro. In order to fix it you have to understand for what reason I did this thing
class EntitySortingInput extends SortingInputType {
@Field({defaultValue: SORTING_DECORATOR_NAME_METADATA_KEY})
_name_: string;
}
Answering, I did it for a better experience of finding parameters in the resolver.
export const applyFilterParameter = (args: any[], target, property: string) => {
const filterArgIndex = args.findIndex(x => x?._name_ === FILTER_DECORATOR_NAME_METADATA_KEY);
if (filterArgIndex != -1) {
const options = Reflect.getMetadata(FILTER_DECORATOR_OPTIONS_METADATA_KEY, target, property) as IFilterDecoratorParams;
const customFields = Reflect.getMetadata(FILTER_DECORATOR_CUSTOM_FIELDS_METADATA_KEY, target, property) as Map<string, GraphqlFilterFieldMetadata>;
args[filterArgIndex] = convertParameters(args[filterArgIndex], customFields, options);
}
}
Your fix is not fixing it, because if you add sorting in your resolver it will break. I've implemented a good solution for this problem and also fixed a couple of other problems I wanted to fix before but postponed it.
the link to the PR: https://github.com/Adrinalin4ik/Nestjs-Graphql-Tools/pull/18 It was released under 0.7.11 version.
This fix was reimplemented in another PR https://github.com/Adrinalin4ik/Nestjs-Graphql-Tools/pull/18
Thank you for working on it. I actually wasn't using sorting, only filter and select.
…here parameter
ERROR: { "code": "validation-failed", "error": "validation for the given role-based schema failed because expected default value of input value: \"where\"of input object \"Entity\" to be {} but received {name: \"FilterPropertyDecorator\"}", "path": "$.args[1].args" }