Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Input type LONG is converted to GraphQLString. #744
- Loading branch information
1 parent
07c89d6
commit 554827f
Showing
5 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
src/main/java/com/enonic/app/guillotine/graphql/fetchers/ContentDataFieldDataFetcher.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,27 @@ | ||
package com.enonic.app.guillotine.graphql.fetchers; | ||
|
||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
import graphql.schema.DataFetcher; | ||
import graphql.schema.DataFetchingEnvironment; | ||
|
||
import com.enonic.app.guillotine.graphql.helper.CastHelper; | ||
import com.enonic.app.guillotine.graphql.helper.DataFetcherHelper; | ||
|
||
public class ContentDataFieldDataFetcher | ||
implements DataFetcher<Object> | ||
{ | ||
@Override | ||
public Object get( final DataFetchingEnvironment environment ) | ||
throws Exception | ||
{ | ||
Map<String, Object> sourceAsMap = CastHelper.cast( environment.getSource() ); | ||
Object data = CastHelper.cast( sourceAsMap.get( "data" ) ); | ||
if ( Objects.equals( sourceAsMap.get( "type" ), "portal:site" ) || Objects.equals( sourceAsMap.get( "_path" ), "/content" ) ) | ||
{ | ||
data = DataFetcherHelper.removeField( data, "siteConfig" ); | ||
} | ||
return DataFetcherHelper.removeContentIdField( data ); | ||
} | ||
} |
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
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
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,7 @@ | ||
query { | ||
guillotine { | ||
get(key: "contentId") { | ||
dataAsJson | ||
} | ||
} | ||
} |