@@ -28178,9 +28178,7 @@ var QueryBuilder = /** @class */ (function () {
28178
28178
var value = args[key];
28179
28179
var isForeignKey = model.skipField(key);
28180
28180
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);
28184
28182
var isConnectionField = schemaField && Schema.getTypeNameOfField(schemaField).endsWith('TypeConnection');
28185
28183
// Ignore null fields, ids and connections
28186
28184
if (value && !skipFieldDueId && !isConnectionField) {
@@ -28262,6 +28260,23 @@ var QueryBuilder = /** @class */ (function () {
28262
28260
}
28263
28261
}
28264
28262
};
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
+ };
28265
28280
/**
28266
28281
* Generates the fields for all related models.
28267
28282
*
0 commit comments