@@ -28178,9 +28178,7 @@ var QueryBuilder = /** @class */ (function () {
2817828178 var value = args[key];
2817928179 var isForeignKey = model.skipField(key);
2818028180 var skipFieldDueId = (key === 'id' || isForeignKey) && !allowIdFields;
28181- var schema = Context.getInstance().schema;
28182- var type = schema.getType(model.singularName + (filter ? 'Filter' : ''));
28183- var schemaField = type ? (filter ? type.inputFields : type.fields).find(function (f) { return f.name === key; }) : null;
28181+ var schemaField = _this.findSchemaFieldForArgument(key, field, model, filter);
2818428182 var isConnectionField = schemaField && Schema.getTypeNameOfField(schemaField).endsWith('TypeConnection');
2818528183 // Ignore null fields, ids and connections
2818628184 if (value && !skipFieldDueId && !isConnectionField) {
@@ -28262,6 +28260,23 @@ var QueryBuilder = /** @class */ (function () {
2826228260 }
2826328261 }
2826428262 };
28263+ QueryBuilder.findSchemaFieldForArgument = function (name, field, model, isFilter) {
28264+ var schema = Context.getInstance().schema;
28265+ var schemaField;
28266+ if (field) {
28267+ schemaField = field.args.find(function (f) { return f.name === name; });
28268+ if (!schemaField) {
28269+ Context.getInstance().logger.warn("Could find the argument with name " + name + " for the mutation/query " + field.name);
28270+ }
28271+ }
28272+ else {
28273+ // We try to find the FilterType or at least the Type this query belongs to.
28274+ var type = schema.getType(model.singularName + (isFilter ? 'Filter' : ''));
28275+ // Next we try to find the field from the type
28276+ schemaField = type ? (isFilter ? type.inputFields : type.fields).find(function (f) { return f.name === name; }) : undefined;
28277+ }
28278+ return schemaField;
28279+ };
2826528280 /**
2826628281 * Generates the fields for all related models.
2826728282 *
0 commit comments