Schema Stitching resolve conflict by adding prefix

Schema Stitching resolve conflict by adding prefix

So I have this two schemas

So I have this two schemas

Schema1

type Permission {
    relation: Relation
}

enum Relation { ONE TWO THREE }

Schema2

type Permission {
    relation: Relation
}

enum Relation { FOUR FIVE SIX }

The expect result is something similar to: (but I'm open to different ideas) The queries I would like to make after the merge are:

{
    permissions{
        relation
    }
}

And get a result like

"permissions": [
  {
    "relation": "ONE"
  },
  {
    "relation": "SIX"
  }
]

or

"permissions": [
  {
    "relation": "schema1ONE"
  },
  {
    "relation": "schema2SIX"
  }
]

And mutations like:

mutation{
  createPermission(
    relation: ONE
  ){
    relation
  }
}

mutation{ createPermission( relation: SIX ){ relation } }

or

mutation{
  createPermission(
    relation: schema1ONE
  ){
    relation
  }
}

mutation{ createPermission( relation: schema2SIX ){ relation } }

I'm trying using the transformSchema function on graphql-tools but can't quite figure it out correctly:

const Schema1 = await getRemoteSchema('schema1_url', 'schema1');
const Schema2 = await getRemoteSchema('schema2_url', 'schema2');

const schemas = [Schema1, Schema2]

const schema = mergeSchemas({ schemas: schemas, resolvers: {} });

getRemoteSchema definition

export const getRemoteSchema = async (uri: string, schemaName: string): Promise<GraphQLSchema> => {
  const httpLink = new HttpLink({ uri, fetch });

const schema = await introspectSchema(httpLink);

const executableSchema = makeRemoteExecutableSchema({ schema, httpLink, });

// transform schema by renaming root fields and types const renamedSchema = transformSchema( executableSchema, [ new RenameTypes(name => { if (name == 'Relation') { return schemaName + name } else { return name } }), // new RenameRootFields((operation, name) => ${schemaName}_${name}) ] );

return renamedSchema; }

I made this glitch https://glitch.com/edit/#!/schema-stitching-conflict So it's easier to see the problem.

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Fully functional WhatsApp Clone using Angular, GraphQL, Apollo, TypeScript and PostgreSQL

An open-source full-stack example app made with Angular 7.2, TypeScript, GraphQL Subscriptions, GraphQL Code Generator, GraphQL Modules, PostgreSQL and TypeORM.

Typescript & GraphQL | TypeORM, Type-GraphQL y ApolloServer

En este ejemplo práctico de Nodejs y GraphQL aprenderemos a crear una API usando Typescript ademas de algunos modulos de npm relacionados como Apollo Server, type-graphql, typeorm, ts-node, entre otros. Typescript & GraphQL | TypeORM, Type-GraphQL y ApolloServer

Need Help in apollo-graphql

hi sir, I am Abhijeet from India. I just started working on graphql.I am trying to set reminder in apollo-graphql and I have no idea how it works in apollo. I am doing only backend graphql (nodejs) . help me for set a reminder in backend using apollo-graphql. This is urgent for me to create my new project.