Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Duplicate query argument fix #332

Merged
merged 42 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
19ee83b
Upstream merge
michaeldgraham Sep 4, 2019
3e7d4b1
Upstream merge
michaeldgraham Oct 2, 2019
2372903
Update for augmentation refactor
michaeldgraham Oct 8, 2019
8f3e41f
Update for augmentation refactor
michaeldgraham Oct 8, 2019
3834f49
formatting fix
michaeldgraham Oct 8, 2019
c8c9042
Update for augmentation refactor
michaeldgraham Oct 8, 2019
e351c48
Update for augmentation refactor
michaeldgraham Oct 9, 2019
555b86e
Update for augmentation refactor
michaeldgraham Oct 9, 2019
2fcc59b
Update for augmentation refactor
michaeldgraham Oct 9, 2019
917fa1b
Augmentation refactor
michaeldgraham Oct 9, 2019
a5c8b21
Replaced with folder for refactor
michaeldgraham Oct 9, 2019
8094500
avoid overwriting existent filtering test file
michaeldgraham Oct 9, 2019
f97548c
Updates resultant from augmentation refactor
michaeldgraham Oct 9, 2019
797155a
file name change for generated filtering tests
michaeldgraham Oct 9, 2019
d2b5269
Removal of Windows \r line separators
michaeldgraham Oct 9, 2019
df2e3ce
documentation comments
michaeldgraham Oct 22, 2019
534a967
schema type support, documentation comments
michaeldgraham Oct 22, 2019
bc5d452
documentation comments
michaeldgraham Oct 22, 2019
1f28271
documentation comments
michaeldgraham Oct 22, 2019
3468ce6
documentation comments
michaeldgraham Oct 22, 2019
1a707a5
schema type support, documentation comments
michaeldgraham Oct 22, 2019
43f9f46
schema type support, documentation comments
michaeldgraham Oct 22, 2019
ba85677
schema type support, documentation comments
michaeldgraham Oct 22, 2019
39287e3
documentation comments
michaeldgraham Oct 22, 2019
5df9d61
schema type support, documentation comments
michaeldgraham Oct 22, 2019
accf5d2
documentation comments
michaeldgraham Oct 22, 2019
dc7146c
documentation comments
michaeldgraham Oct 22, 2019
2ed9b27
documentation comments
michaeldgraham Oct 22, 2019
e803f09
schema type support, documentation comments
michaeldgraham Oct 22, 2019
35baa04
schema type support, subscription persistence
michaeldgraham Oct 22, 2019
72c7f4f
prints directives, persists schema and subscription type
michaeldgraham Oct 22, 2019
622274b
non-default operation type names
michaeldgraham Oct 22, 2019
29af6a0
small refactor
michaeldgraham Oct 22, 2019
e6d6bd3
merge resolution
michaeldgraham Oct 22, 2019
c370b0a
CasedType inclusion for merge resolution
michaeldgraham Oct 22, 2019
16246f3
CasedType resolver for merge resolution
michaeldgraham Oct 22, 2019
8d148ba
merge conflict and formatting fix
michaeldgraham Oct 22, 2019
a37fed6
CasedType test addition
michaeldgraham Oct 22, 2019
730c22a
put @isAuthenticated back into testing schema
michaeldgraham Oct 22, 2019
275493f
Merge branch 'pr/33'
michaeldgraham Oct 24, 2019
bf2d9fe
fix for duplicate query arguments
michaeldgraham Oct 24, 2019
241cc62
removal of duplicate query arguments
michaeldgraham Oct 24, 2019
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
50 changes: 38 additions & 12 deletions src/augment/input-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const buildQueryFieldArguments = ({
Object.values(argumentMap).forEach(name => {
if (isListTypeField({ wrappers: outputTypeWrappers })) {
if (name === PagingArgument.FIRST) {
// Result Arguments
// Does not overwrite
if (
!getFieldDefinition({
fields: fieldArguments,
Expand All @@ -111,7 +111,7 @@ export const buildQueryFieldArguments = ({
);
}
} else if (name === PagingArgument.OFFSET) {
// Result Arguments
// Does not overwrite
if (
!getFieldDefinition({
fields: fieldArguments,
Expand All @@ -125,22 +125,48 @@ export const buildQueryFieldArguments = ({
);
}
} else if (name === OrderingArgument.ORDER_BY) {
// Overwrite
fieldArguments.push(
buildQueryOrderingArgument({
typeName: outputType
})
const argumentIndex = fieldArguments.findIndex(
arg => arg.name.value === OrderingArgument.ORDER_BY
);
// Does overwrite
if (argumentIndex === -1) {
fieldArguments.push(
buildQueryOrderingArgument({
typeName: outputType
})
);
} else {
fieldArguments.splice(
argumentIndex,
1,
buildQueryOrderingArgument({
typeName: outputType
})
);
}
}
}
// Overwrite
if (name === FilteringArgument.FILTER) {
if (!isCypherField({ directives: fieldDirectives })) {
fieldArguments.push(
buildQueryFilteringArgument({
typeName: outputType
})
const argumentIndex = fieldArguments.findIndex(
arg => arg.name.value === FilteringArgument.FILTER
);
// Does overwrite
if (argumentIndex === -1) {
fieldArguments.push(
buildQueryFilteringArgument({
typeName: outputType
})
);
} else {
fieldArguments.splice(
argumentIndex,
1,
buildQueryFilteringArgument({
typeName: outputType
})
);
}
}
}
});
Expand Down
9 changes: 0 additions & 9 deletions test/unit/augmentSchemaTest.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ test.cb('Test augmented schema', t => {
imdbRating: Float
first: Int
offset: Int
orderBy: _MovieOrdering
orderBy: [_MovieOrdering]
filter: _MovieFilter
): [Movie]
Expand Down Expand Up @@ -135,8 +134,6 @@ test.cb('Test augmented schema', t => {
offset: Int
orderBy: [_GenreOrdering]
filter: _GenreFilter
orderBy: [_GenreOrdering]
filter: _GenreFilter
): [Genre] @hasScope(scopes: ["Genre: Read"])
Actor(
userId: ID
Expand All @@ -146,8 +143,6 @@ test.cb('Test augmented schema', t => {
offset: Int
orderBy: [_ActorOrdering]
filter: _ActorFilter
orderBy: [_ActorOrdering]
filter: _ActorFilter
): [Actor] @hasScope(scopes: ["Actor: Read"])
Book(
genre: BookGenre
Expand All @@ -156,8 +151,6 @@ test.cb('Test augmented schema', t => {
offset: Int
orderBy: [_BookOrdering]
filter: _BookFilter
orderBy: [_BookOrdering]
filter: _BookFilter
): [Book] @hasScope(scopes: ["Book: Read"])
TemporalNode(
datetime: _Neo4jDateTimeInput
Expand All @@ -173,8 +166,6 @@ test.cb('Test augmented schema', t => {
offset: Int
orderBy: [_TemporalNodeOrdering]
filter: _TemporalNodeFilter
orderBy: [_TemporalNodeOrdering]
filter: _TemporalNodeFilter
): [TemporalNode] @hasScope(scopes: ["TemporalNode: Read"])
}

Expand Down