Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/specs/functional.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,11 @@ describe('Functional', function () {
@D.ObjectType()
class QueryType {
@D.Field({ pagination: true, type: graphql.GraphQLString })
async paginated(): Promise<[string[], number]> {
return [['Hello, world!'], 1];
async paginated(
@D.Arg({name: 'value', type: graphql.GraphQLString}) value: string,
@D.Ctx() context: any,
): Promise<[string[], number]> {
return [[`Hello, ${value}!`], 1];
}
}

Expand All @@ -119,7 +122,7 @@ describe('Functional', function () {
const schema = schemaFactory(SchemaType);
const result = await graphql.graphql(schema, `
query {
paginated {
paginated(value: "world") {
count
nodes
pageInfo {
Expand Down
12 changes: 7 additions & 5 deletions src/type-factory/field.type-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ export function resolverFactory(
const argumentMetadata = (metadata.arguments.concat(metadata.orderBy))
.filter(value => value)
.find((value: ArgumentMetadata | OrderByMetadata) => value.index === index); //TODO: Can avoin O(n x m) here using a hash for arguments
argumentConfigMap[argumentMetadata.name] = {
name: argumentMetadata.name,
type: convertType(paramFn, argumentMetadata, true),
};
indexMap[argumentMetadata.name] = index;
if (argumentMetadata) {
argumentConfigMap[argumentMetadata.name] = {
name: argumentMetadata.name,
type: convertType(paramFn, argumentMetadata, true),
};
indexMap[argumentMetadata.name] = index;
}
});
}

Expand Down