elguardian commented on code in PR #1962:
URL: 
https://github.com/apache/incubator-kie-kogito-apps/pull/1962#discussion_r1464503098


##########
data-audit/data-audit-common/src/main/java/org/kie/kogito/app/audit/graphql/GraphQLSchemaManager.java:
##########
@@ -103,22 +125,52 @@ private GraphQLSchemaManager() {
         SchemaGenerator schemaGenerator = new SchemaGenerator();
         // we merge the query object
         
typeDefinitionRegistry.add(ObjectTypeDefinition.newObjectTypeDefinition().name("Query").fieldDefinitions(queryDefinitions).build());
-        graphQLSchema = 
schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
+        GraphQLSchema newGraphQLSchema = 
schemaGenerator.makeExecutableSchema(typeDefinitionRegistry, runtimeWiring);
+        GraphQL newGraphQL = GraphQL.newGraphQL(newGraphQLSchema).build();
 
+        // we got to this point then everything is validated
+        this.graphQLSchema = newGraphQLSchema;
+        this.graphQL = newGraphQL;
+        LOGGER.debug("Succesfuly rebuilding graphQL definitions");
     }
 
-    private TypeDefinitionRegistry readDefintionRegistry(String graphQLSchema) 
{
-        try (InputStream is = 
Thread.currentThread().getContextClassLoader().getResourceAsStream(graphQLSchema))
 {
-            SchemaParser schemaParser = new SchemaParser();
-            return schemaParser.parse(is);
+    private InputStream toInputStream(String classpathFile) {
+        try (InputStream is = 
Thread.currentThread().getContextClassLoader().getResourceAsStream(classpathFile))
 {
+            return new ByteArrayInputStream(is.readAllBytes());
         } catch (IOException e) {
             LOGGER.error("could not find or process {}", graphQLSchema, e);
-            return new TypeDefinitionRegistry();
+            return new ByteArrayInputStream(new byte[0]);
         }
     }
 
+    private TypeDefinitionRegistry readDefintionRegistry(InputStream 
inputStream) {

Review Comment:
   changed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to