Skip to content

vlingo/xoom-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xoom-graphql

Javadocs Build Download Gitter chat

The VLINGO XOOM platform SDK GraphQL Server running on XOOM HTTP.

References

https://graphql.org/

https://graphql.org/learn/serving-over-http

https://www.graphql-java.com/

Code Example: Initializing GraphQL

public GraphQL graphQL(final String schemaName, final WarbleDataFetcher warbleDataFetcher) {

    final SchemaParser schemaParser = new SchemaParser();
    final SchemaGenerator schemaGenerator = new SchemaGenerator();

    // Parse schema
    final TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry();
    
    // SchemaLoader is our component (yet to be implemented) that loads
    // a GraphQL schema as a String
    final String schema = SchemaLoader.by(schemaName);
    
    typeRegistry.merge(schemaParser.parse(schema));

    // New runtime wiring
    final RuntimeWiring runtimeWiring =
            RuntimeWiring.newRuntimeWiring()
                    .type("Query", typeWiring -> typeWiring.dataFetcher("warble", warbleDataFetcher))
                    .build();

    // New executable schema
    final GraphQLSchema graphQLSchema = schemaGenerator.makeExecutableSchema(typeRegistry, runtimeWiring);

    // Answer GraphQL instance
    return GraphQL.newGraphQL(graphQLSchema).build();
}

Important

If using snapshot builds follow these instructions or you will experience failures.

License (See LICENSE file for full license)

Copyright © 2012-2023 VLINGO LABS. All rights reserved.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

About

The VLINGO XOOM platform SDK GraphQL Server running on XOOM HTTP.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages