Skip to content

Commit

Permalink
Test schema will use TestObject instead of Car.
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDragon-ru committed Oct 18, 2023
1 parent 2087c1a commit fe68a00
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 79 deletions.
2 changes: 1 addition & 1 deletion packages/graphql/src/Stream/Directives/DirectiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public function decryptString(mixed $payload): string {
public function testManipulateFieldDefinition(): void {
config([
'lighthouse.namespaces.models' => [
(new ReflectionClass(Car::class))->getNamespaceName(),
(new ReflectionClass(TestObject::class))->getNamespaceName(),
],
]);

Expand Down
132 changes: 66 additions & 66 deletions packages/graphql/src/Stream/Directives/DirectiveTest~expected.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,19 @@ enum SortByTypeDirection {
}

"""
Available conditions for `type Car` (only one property allowed at a time).
Available conditions for `type TestObject` (only one property allowed at a time).
"""
input SearchByConditionCar {
input SearchByConditionTestObject {
"""
All of the conditions must be true.
"""
allOf: [SearchByConditionCar!]
allOf: [SearchByConditionTestObject!]
@searchByOperatorAllOf

"""
Any of the conditions must be true.
"""
anyOf: [SearchByConditionCar!]
anyOf: [SearchByConditionTestObject!]
@searchByOperatorAnyOf

"""
Expand All @@ -147,7 +147,7 @@ input SearchByConditionCar {
"""
Not.
"""
not: SearchByConditionCar
not: SearchByConditionTestObject
@searchByOperatorNot
}

Expand Down Expand Up @@ -181,13 +181,13 @@ input SearchByScalarID {
}

"""
Available conditions for `type Car` (only one property allowed at a time).
Available conditions for `type TestObject` (only one property allowed at a time).
"""
input SearchByScoutConditionCar {
input SearchByScoutConditionTestObject {
"""
All of the conditions must be true.
"""
allOf: [SearchByScoutConditionCar!]
allOf: [SearchByScoutConditionTestObject!]
@searchByOperatorAllOf

"""
Expand Down Expand Up @@ -221,9 +221,9 @@ input SearchByScoutScalarID {
}

"""
Sort clause for `type Car` (only one property allowed at a time).
Sort clause for `type TestObject` (only one property allowed at a time).
"""
input SortByClauseCar {
input SortByClauseTestObject {
"""
Property clause.
"""
Expand All @@ -232,9 +232,9 @@ input SortByClauseCar {
}

"""
Sort clause for `type Car` (only one property allowed at a time).
Sort clause for `type TestObject` (only one property allowed at a time).
"""
input SortByScoutClauseCar {
input SortByScoutClauseTestObject {
"""
Property clause.
"""
Expand Down Expand Up @@ -267,9 +267,9 @@ interface InterfaceA {
argument: String
cursor: StreamCursor
limit: Int!
order: [SortByClauseCar!]
where: SearchByConditionCar
): CarsStream!
order: [SortByClauseTestObject!]
where: SearchByConditionTestObject
): TestObjectsStream!
}

interface InterfaceB
Expand All @@ -279,17 +279,17 @@ implements
fieldNotSearchable(
cursor: StreamCursor
limit: Int!
order: [SortByClauseCar!]
): CarsStream!
order: [SortByClauseTestObject!]
): TestObjectsStream!
}

interface InterfaceC {
fieldWithDirectives(
a: SearchByConditionCar
b: [SortByClauseCar!]
a: SearchByConditionTestObject
b: [SortByClauseTestObject!]
c: Int!
d: StreamCursor
): CarsStream!
): TestObjectsStream!
}

"""
Expand All @@ -305,28 +305,6 @@ scalar StreamCursor
class: "LastDragon_ru\\LaraASP\\GraphQL\\Stream\\Types\\Cursor"
)

type Car {
id: ID!
}

type CarsStream {
"""
Requested items.
"""
items: [Car!]!

"""
Total number of items. Not recommended querying it in each query
due to performance.
"""
length: Int

"""
Cursors to navigate within the stream.
"""
navigation: StreamNavigation!
}

type Query
implements
& InterfaceA
Expand All @@ -348,9 +326,9 @@ implements
apply: ["integer", "min:1", "max:100"]
)

order: [SortByClauseCar!]
order: [SortByClauseTestObject!]
@sortBy
): CarsStream!
): TestObjectsStream!
@stream(
searchable: false
)
Expand All @@ -372,9 +350,9 @@ implements
apply: ["integer", "min:1", "max:100"]
)

where: SearchByConditionCar
where: SearchByConditionTestObject
@searchBy
): CarsStream!
): TestObjectsStream!
@stream(
sortable: false
)
Expand All @@ -398,21 +376,21 @@ implements
apply: ["integer", "min:1", "max:100"]
)

order: [SortByClauseCar!]
order: [SortByClauseTestObject!]
@sortBy

where: SearchByConditionCar
where: SearchByConditionTestObject
@searchBy
): CarsStream!
): TestObjectsStream!
@stream
@validate

fieldWithDeprecations(
a: SearchByConditionCar
a: SearchByConditionTestObject
@deprecated
@searchBy

b: [SortByClauseCar!]
b: [SortByClauseTestObject!]
@deprecated
@sortBy

Expand Down Expand Up @@ -453,22 +431,22 @@ implements
apply: ["integer", "min:1", "max:100"]
)

order: [SortByClauseCar!]
order: [SortByClauseTestObject!]
@sortBy

where: SearchByConditionCar
where: SearchByConditionTestObject
@searchBy
): CarsStream!
): TestObjectsStream!
@stream(
limit: 15
)
@validate

fieldWithDirectives(
a: SearchByConditionCar
a: SearchByConditionTestObject
@searchBy

b: [SortByClauseCar!]
b: [SortByClauseTestObject!]
@sortBy

"""
Expand All @@ -488,15 +466,15 @@ implements
"""
d: StreamCursor
@streamCursor
): CarsStream!
): TestObjectsStream!
@stream
@validate

fieldWithDirectivesAndDefaults(
a: SearchByConditionCar
a: SearchByConditionTestObject
@searchBy

b: [SortByClauseCar!]
b: [SortByClauseTestObject!]
@sortBy

"""
Expand All @@ -515,7 +493,7 @@ implements
"""
d: StreamCursor
@streamCursor
): CarsStream!
): TestObjectsStream!
@stream(
limit: 15
)
Expand All @@ -537,15 +515,15 @@ implements
apply: ["integer", "min:1", "max:100"]
)

order: [SortByScoutClauseCar!]
order: [SortByScoutClauseTestObject!]
@sortBy

search: String!
@search

where: SearchByScoutConditionCar
where: SearchByScoutConditionTestObject
@searchBy
): CarsStream!
): TestObjectsStream!
@stream
@validate

Expand All @@ -565,12 +543,12 @@ implements
apply: ["integer", "min:1", "max:100"]
)

order: [SortByClauseCar!]
order: [SortByClauseTestObject!]
@sortBy

where: SearchByConditionCar
where: SearchByConditionTestObject
@searchBy
): CarsStream!
): TestObjectsStream!
@stream
@validate
}
Expand All @@ -580,3 +558,25 @@ type StreamNavigation {
next: StreamCursor
previous: StreamCursor
}

type TestObject {
id: ID!
}

type TestObjectsStream {
"""
Requested items.
"""
items: [TestObject!]!

"""
Total number of items. Not recommended querying it in each query
due to performance.
"""
length: Int

"""
Cursors to navigate within the stream.
"""
navigation: StreamNavigation!
}
24 changes: 12 additions & 12 deletions packages/graphql/src/Stream/Directives/DirectiveTest~schema.graphql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type Query implements InterfaceA & InterfaceB {
fieldWithoutArguments: [Car] @stream
fieldWithoutArguments: [TestObject] @stream

fieldWithArguments(argument: String): [Car] @stream
fieldWithArguments(argument: String): [TestObject] @stream

fieldWithDirectives(
a: _ @searchBy,
Expand All @@ -12,7 +12,7 @@ type Query implements InterfaceA & InterfaceB {
max: 10
)
d: _ @streamCursor
): [Car] @stream
): [TestObject] @stream

fieldWithDirectivesAndDefaults(
a: _ @searchBy,
Expand All @@ -22,14 +22,14 @@ type Query implements InterfaceA & InterfaceB {
default: 123
)
d: _ @streamCursor
): [Car]
): [TestObject]
@stream(
limit: 15
)

fieldNotSearchable: [Car] @stream(searchable: false)
fieldNotSearchable: [TestObject] @stream(searchable: false)

fieldNotSortable: [Car] @stream(sortable: false)
fieldNotSortable: [TestObject] @stream(sortable: false)

fieldWithDeprecations(
a: _ @deprecated @searchBy,
Expand All @@ -41,24 +41,24 @@ type Query implements InterfaceA & InterfaceB {
max: 123
)
d: _ @deprecated @streamCursor
): [Car]
): [TestObject]
@stream(
limit: 15
)

fieldWithSearch(search: String! @search): [Car] @stream
fieldWithSearch(search: String! @search): [TestObject] @stream
}

type Car {
type TestObject {
id: ID!
}

interface InterfaceA {
fieldWithArguments(argument: String): [Car]
fieldWithArguments(argument: String): [TestObject]
}

interface InterfaceB implements InterfaceC {
fieldNotSearchable: [Car]
fieldNotSearchable: [TestObject]
}

interface InterfaceC {
Expand All @@ -67,5 +67,5 @@ interface InterfaceC {
b: TypeDoesntMatter,
c: TypeDoesntMatter,
d: TypeDoesntMatter,
): [Car]
): [TestObject]
}

0 comments on commit fe68a00

Please sign in to comment.