-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling of concrete type datafetchers for interface fields. (#1693)
- Loading branch information
1 parent
e726e3b
commit c022e61
Showing
3 changed files
with
81 additions
and
8 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
.../main/java/com/netflix/graphql/dgs/example/shared/datafetcher/ActionMovieDataFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2021 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.graphql.dgs.example.shared.datafetcher; | ||
|
||
import com.netflix.graphql.dgs.DgsComponent; | ||
import com.netflix.graphql.dgs.DgsData; | ||
|
||
@DgsComponent | ||
public class ActionMovieDataFetcher { | ||
@SuppressWarnings("SameReturnValue") | ||
@DgsData(parentType = "ActionMovie", field = "director") | ||
public String director() { | ||
|
||
return "Action movie director"; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...c/main/java/com/netflix/graphql/dgs/example/shared/datafetcher/ScaryMovieDataFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2021 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.graphql.dgs.example.shared.datafetcher; | ||
|
||
import com.netflix.graphql.dgs.DgsComponent; | ||
import com.netflix.graphql.dgs.DgsData; | ||
import com.netflix.graphql.dgs.example.shared.types.ActionMovie; | ||
import com.netflix.graphql.dgs.example.shared.types.Movie; | ||
import com.netflix.graphql.dgs.example.shared.types.ScaryMovie; | ||
import graphql.schema.DataFetchingEnvironment; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@DgsComponent | ||
public class ScaryMovieDataFetcher { | ||
@SuppressWarnings("SameReturnValue") | ||
@DgsData(parentType = "ScaryMovie", field = "director") | ||
public String director() { | ||
|
||
return "Scary movie director"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters