How to use the @gapi/core.buildSchema function in @gapi/core

To help you get started, we’ve selected a few @gapi/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rxdi / graphqj / src / app / app.module.ts View on Github external
useFactory: () => (schema: GraphQLSchema) => {
        let externalSchema;
        try {
          const config = JSON.parse(
            readFileSync(join(process.cwd(), 'gj.json'), {
              encoding: 'utf-8'
            })
          );
          config.$schema = config.$schema || nextOrDefault('--schema', false);
          if (config.$schema) {
            externalSchema = readFileSync(config.$schema, {
              encoding: 'utf-8'
            });
            externalSchema = buildSchema(externalSchema);
          }
        } catch (e) {}
        const schemas = [externalSchema, schema].filter(i => !!i);
        let mergedSchemas: GraphQLSchema;
        if (schemas.length === 1) {
          mergedSchemas = schema;
        } else {
          mergedSchemas = mergeSchemas({
            schemas
          });
        }

        if (includes('--verbose')) {
          console.log(`
Schema:
${printSchema(mergedSchemas)}
github rxdi / graphqj / lib / app / app.module.js View on Github external
useFactory: () => (schema) => {
                    let externalSchema;
                    try {
                        const config = JSON.parse(fs_1.readFileSync(path_1.join(process.cwd(), 'gj.json'), {
                            encoding: 'utf-8'
                        }));
                        config.$schema = config.$schema || args_extractors_1.nextOrDefault('--schema', false);
                        if (config.$schema) {
                            externalSchema = fs_1.readFileSync(config.$schema, {
                                encoding: 'utf-8'
                            });
                            externalSchema = core_1.buildSchema(externalSchema);
                        }
                    }
                    catch (e) { }
                    const schemas = [externalSchema, schema].filter(i => !!i);
                    let mergedSchemas;
                    if (schemas.length === 1) {
                        mergedSchemas = schema;
                    }
                    else {
                        mergedSchemas = core_1.mergeSchemas({
                            schemas
                        });
                    }
                    if (args_extractors_1.includes('--verbose')) {
                        console.log(`
Schema: