예제 #1
0
        public void RunExample2()
        {
            var schema = GraphQL<Context>.CreateDefaultSchema(() =>
            new Context
            {
                Humans = new List<Human> {
                    new Human { Id = "1000", Name = "Luke Skywalker", Height = 1.72 }
                }
            });
            var humanSchema = schema.AddType<Human>();
            humanSchema.AddField(h => h.Id);
            humanSchema.AddField(h => h.Name);
            humanSchema.AddField(
                "height",
                new { unit = "METER"},
                (c, args, h) => args.unit == "FOOT" ? h.Height * 3.28084 : h.Height);

            schema.AddField(
                "human",
                new { id = "-1" },
                (c, args) => c.Humans.SingleOrDefault(h => h.Id == args.id));

            schema.Complete();

            var gql = new GraphQL<Context>(schema);
            var queryResult = gql.ExecuteQuery("{human(id: \"1000\") {name, height(unit: \"FOOT\")}}");
            DeepEquals(queryResult, "{human: {name: 'Luke Skywalker', height: 5.6430448}}");
        }
예제 #2
0
        public static void ChildFieldWithParameters <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ account(id:1) { id, name, firstUserWithActive(active:true) { id, name } } }");

            Test.DeepEquals(results, "{ account: { id: 1, name: 'My Test Account', firstUserWithActive: { id: 1, name: 'Joe User' } } }");

            results = gql.ExecuteQuery("{ account(id:1) { id, name, firstUserWithActive(active:false) { id, name } } }");
            Test.DeepEquals(results, "{ account: { id: 1, name: 'My Test Account', firstUserWithActive: null } }");
        }
예제 #3
0
        public static bool ChildListFieldWithParameters <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ account(id:1) { id, name, usersWithActive(active:true) { id, name } } }");

            return(Test.DeepEquals(results, "{ account: { id: 1, name: 'My Test Account', usersWithActive: [{ id: 1, name: 'Joe User' }] } }"));

            results = gql.ExecuteQuery("{ account(id:1) { id, name, usersWithActive(active:false) { id, name } } }");
            return(Test.DeepEquals(results, "{ account: { id: 1, name: 'My Test Account', usersWithActive: [] } }"));
        }
예제 #4
0
        public static void EnumerableSubField <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ account(id:1) { activeUsers { id, name } } }");

            Test.DeepEquals(results, "{ account: { activeUsers: [{ id: 1, name: 'Joe User' }] } }");

            var results2 = gql.ExecuteQuery("{ account(id:2) { activeUsers { id, name } } }");

            Test.DeepEquals(results2, "{ account: { activeUsers: [] } }");
        }
예제 #5
0
        public static void SimpleMutation <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("mutation { mutate(id:1,newVal:5) { id, value } }");

            Test.DeepEquals(results, "{ mutate: { id: 1, value: 5 } }");

            var results2 = gql.ExecuteQuery("mutation { mutate(id:1,newVal:123) { id, value } }");

            Test.DeepEquals(results2, "{ mutate: { id: 1, value: 123 } }");
        }
예제 #6
0
        public static void EnumFieldQuery <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ accountsByType(accountType:accountType_Gold) { id, accountType } }");

            Test.DeepEquals(results, @"{ 
                                            accountsByType: [
                                                    { id: 1, accountType: 'Gold' }
                                            ]
                                        }");
        }
예제 #7
0
        public static void GuidParameter <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ accountsByGuid(guid:\"00000000-0000-0000-0000-000000000000\") { id, someGuid } }");

            Test.DeepEquals(results, @"{
                                           accountsByGuid: [
                                               { id: 1, someGuid: '00000000-0000-0000-0000-000000000000' },
                                               { id: 2, someGuid: '00000000-0000-0000-0000-000000000000' },
                                           ]
                                       }");
        }
예제 #8
0
        public static void UnionTypeDroid <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery(
                @"query UnionTypeStarshipQuery {
                  search(text: ""droid"") {
                    __typename
                  }
                }");

            Test.DeepEquals(results,
                            "{ search: { __typename: 'Droid'} }");
        }
예제 #9
0
        public static void IntrospectionDroidType <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery(
                @"query IntrospectionDroidTypeQuery {
                    __type(name: ""Droid"") {
                      name
                    }
                  }");

            Test.DeepEquals(results,
                            "{ __type: { name: 'Droid' } }");
        }
예제 #10
0
        public static void InlineFragementWithoutTypenameField <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ heros { name, ... on Stormtrooper { height, specialization } } }");

            Test.DeepEquals(
                results,
                "{ heros: [ " +
                "{ name: 'Han Solo'}, " +
                "{ name: 'FN-2187', height: 4.9, specialization: 'Imperial Snowtrooper'}, " +
                "{ name: 'R2-D2' } ] }"
                );
        }
예제 #11
0
        public static GraphQLSchema <MemContext> CreateDefaultSchema()
        {
            var schema = GraphQL <MemContext> .CreateDefaultSchema(() => new MemContext());

            schema.AddScalar(new { year = 0, month = 0, day = 0 }, ymd => new DateTime(ymd.year, ymd.month, ymd.day));
            InitializeUserSchema(schema);
            InitializeAccountSchema(schema);
            InitializeMutationSchema(schema);
            InitializeNullRefSchema(schema);
            InitializeCharacterSchema(schema);
            return(schema);
        }
예제 #12
0
        public void AddAllFields()
        {
            var schema = GraphQL<MemContext>.CreateDefaultSchema(() => new MemContext());
            schema.AddType<User>().AddAllFields();
            schema.AddType<Account>().AddAllFields();
            schema.AddField("user", new { id = 0 }, (db, args) => db.Users.AsQueryable().FirstOrDefault(u => u.Id == args.id));
            schema.Complete();

            var gql = new GraphQL<MemContext>(schema);
            var results = gql.ExecuteQuery("{ user(id:1) { id, name } }");
            Test.DeepEquals(results, "{ user: { id: 1, name: 'Joe User' } }");
        }
예제 #13
0
        public static void FragementWithMultiLevelInheritance <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ heros { name, __typename, ... on Stormtrooper { height, specialization } } }");

            Test.DeepEquals(
                results,
                "{ heros: [ " +
                "{ name: 'Han Solo', __typename: 'Human'}, " +
                "{ name: 'FN-2187', __typename: 'Stormtrooper',  height: 4.9, specialization: 'Imperial Snowtrooper'}, " +
                "{ name: 'R2-D2', __typename: 'Droid' } ] }"
                );
        }
예제 #14
0
        public UserService()
        {
            var schema = GraphQL <SocialNetworkContext> .CreateDefaultSchema(() => new SocialNetworkContext());

            var userType = schema.AddType <User>();

            userType.AddAllFields();
            schema.AddListField("users", new { ids = new List <int>() }, (db, args) => db.Users.Where(x => args.ids.Contains(x.Id)));
            schema.AddField("user", new { id = 0 }, (db, args) => db.Users.FirstOrDefault(x => x.Id == args.id));

            schema.Complete();
            _graphQl = new GraphQL <SocialNetworkContext>(schema);
        }
예제 #15
0
        public static bool FragementWithMultipleTypenameFields <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery(
                "{ heros { name, ...stormtrooper, __typename } }, fragment stormtrooper on Stormtrooper { height, specialization, __typename } ");

            return(Test.DeepEquals(
                       results,
                       "{ heros: [ " +
                       "{ name: 'Han Solo', __typename: 'Human'}, " +
                       "{ name: 'FN-2187', height: 4.9, specialization: 'Imperial Snowtrooper', __typename: 'Stormtrooper'}, " +
                       "{ name: 'R2-D2', __typename: 'Droid'} ] }"
                       ));
        }
예제 #16
0
        public static void IntrospectionCharacterInterface <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery(
                @"query IntrospectionCharacterKindQuery {
                  __type(name: ""ICharacter"") {
                    name
                    kind
                  }
                }");

            Test.DeepEquals(results,
                            "{ __type: { name: 'ICharacter', kind: 'INTERFACE' } }");
        }
예제 #17
0
        public GraphQLSchema BillSchema()
        {
            var schema = GraphQL <KHParkContext> .CreateDefaultSchema(() => new KHParkContext());

            schema.AddType <M_BILL>().AddAllFields();
            schema.AddListField("M_BILL_RECS", db => db.M_BILL_REC);
            return(schema);
            //user.AddField(u => u.Id);
            //user.AddField(u => u.Name);
            //user.AddField(u => u.Account);
            //user.AddField("totalUsers", (db, u) => db.Users.Count());
            //user.AddField("accountPaid", (db, u) => u.Account.Paid);
        }
예제 #18
0
        private static GraphQL <EfContext> CreateDefaultContext()
        {
            var schema = GraphQL <EfContext> .CreateDefaultSchema(() => new EfContext());

            schema.AddScalar(new { year = 0, month = 0, day = 0 }, ymd => new DateTime(ymd.year, ymd.month, ymd.day));
            InitializeUserSchema(schema);
            InitializeAccountSchema(schema);
            InitializeMutationSchema(schema);
            InitializeNullRefSchema(schema);
            InitializeCharacterSchema(schema);
            schema.Complete();
            return(new GraphQL <EfContext>(schema));
        }
예제 #19
0
        public static void InlineFragements <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery(
                "{ heros { name, __typename, ... on Human { height }, ... on Stormtrooper { specialization }, " +
                "... on Droid { primaryFunction } } }");

            Test.DeepEquals(
                results,
                "{ heros: [ " +
                "{ name: 'Han Solo', __typename: 'Human',  height: 5.6430448}, " +
                "{ name: 'FN-2187', __typename: 'Stormtrooper',  height: 4.9, specialization: 'Imperial Snowtrooper'}, " +
                "{ name: 'R2-D2', __typename: 'Droid', primaryFunction: 'Astromech' } ] }"
                );
        }
예제 #20
0
        public GraphQLApi(HeroContext DB)
        {
            _DB = DB;

            var schema = GraphQL <HeroContext> .CreateDefaultSchema(() => _DB);

            schema.AddType <Hero>().AddAllFields();
            schema.AddListField("heros", db => db.Heroes);
            schema.AddField("user", new { id = 0 }, (db, args) => db.Heroes.Where(u => u.HeroId == args.id).FirstOrDefault());

            schema.Complete();

            this.Current = new GraphQL <HeroContext>();
        }
예제 #21
0
        public HttpResponseMessage GraphQLData(HttpRequestMessage query)
        {
            try
            {
                var gql  = new GraphQL <BeerContext>(_schema);
                var dict = gql.ExecuteQuery(query.Content.ReadAsStringAsync().Result);

                return(Request.CreateResponse(HttpStatusCode.Accepted, dict));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex));
            }
        }
예제 #22
0
        public static void InlineFragementWithListField <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery(
                "{ heros { name, __typename, ... on Human { height, vehicles { name } }, ... on Stormtrooper { specialization }, " +
                "... on Droid { primaryFunction } } }");

            Test.DeepEquals(
                results,
                "{ heros: [ " +
                "{ name: 'Han Solo', __typename: 'Human',  height: 5.6430448, vehicles: [ {name: 'Millennium falcon'}] }, " +
                "{ name: 'FN-2187', __typename: 'Stormtrooper',  height: 4.9, vehicles: [ {name: 'Speeder bike'}], specialization: 'Imperial Snowtrooper'}, " +
                "{ name: 'R2-D2', __typename: 'Droid', primaryFunction: 'Astromech' } ] }"
                );
        }
예제 #23
0
        public void AddAllFields()
        {
            var schema = GraphQL <EfContext> .CreateDefaultSchema(() => new EfContext());

            schema.AddType <User>().AddAllFields();
            schema.AddType <Account>().AddAllFields();
            schema.AddField("user", new { id = 0 }, (db, args) => db.Users.FirstOrDefault(u => u.Id == args.id));
            schema.Complete();

            var gql     = new GraphQL <EfContext>(schema);
            var results = gql.ExecuteQuery("{ user(id:1) { id, name } }");

            Test.DeepEquals(results, "{ user: { id: 1, name: 'Joe User' } }");
        }
        public RepositorioDeConsulta()          //ModeloPeliculas modelo)
        {
            var modelo = new ModeloPeliculas(); // = modelo;
            var pel    = modelo.Peliculas.FirstOrDefault();

            _schema = GraphQL <ModeloPeliculas> .CreateDefaultSchema(() => modelo);

            var pelicula = _schema.AddType <Pelicula>();

            pelicula.AddField(p => p.Id);
            pelicula.AddField(p => p.Nombre);

            _schema.AddListField("peliculas", db => db.Peliculas);
            _schema.AddField("pelicula", new { id = 0 }, (db, args) => db.Peliculas.Where(p => p.Id == args.id).FirstOrDefault());
            _schema.Complete();
        }
예제 #25
0
        public static bool Fragements <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery(
                "{ heros { name, __typename, ...human, ...stormtrooper, ...droid } }, " +
                "fragment human on Human { height }, " +
                "fragment stormtrooper on Stormtrooper { specialization }, " +
                "fragment droid on Droid { primaryFunction }");

            return(Test.DeepEquals(
                       results,
                       "{ heros: [ " +
                       "{ name: 'Han Solo', __typename: 'Human',  height: 5.6430448}, " +
                       "{ name: 'FN-2187', __typename: 'Stormtrooper',  height: 4.9, specialization: 'Imperial Snowtrooper'}, " +
                       "{ name: 'R2-D2', __typename: 'Droid', primaryFunction: 'Astromech' } ] }"
                       ));
        }
예제 #26
0
        public GraphQLSchemaProvider()
        {
            var options2 = new DbContextOptionsBuilder <AdventureWorksDbContext>();

            options2.UseSqlServer(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
            GraphQLSchema <AdventureWorksDbContext> schema = GraphQL <AdventureWorksDbContext> .CreateDefaultSchema(() => new AdventureWorksDbContext(options2.Options));

            schema.AddType <Employee>().AddAllFields();
            schema.AddListField("employees", db => db.Employees);
            schema.AddField("employee", new { id = 0 }, (db, args) => db.Employees.FirstOrDefault(u => u.EmployeeID == args.id));

            schema.AddType <JobCandidate>().AddAllFields();
            schema.AddType <Shift>().AddAllFields();
            schema.AddType <Department>().AddAllFields();

            schema.Complete();

            gql = new GraphQL <AdventureWorksDbContext>(schema);
        }
예제 #27
0
        public GraphQLService(IContext dbContext)
        {
            GraphQLSchema <TestContext> schema = GraphQL <TestContext> .CreateDefaultSchema(() => dbContext.Context as TestContext);



            var user = schema.AddType <User>();

            user.AddAllFields();
            user.AddField("totalUsers", (db, u) => db.Users.Count());
            user.AddField("accountPaid", (db, u) => u.Account.Paid);

            schema.AddType <Account>().AddAllFields();
            schema.AddListField("users", db => db.Users);
            schema.AddField("user", new { id = 0 }, (db, args) => db.Users.Where(u => u.Id == args.id).FirstOrDefault());
            schema.Complete();


            graphQL = new GraphQL <TestContext>(schema);
        }
예제 #28
0
        public void RunExample()
        {
            var schema = GraphQL <Context> .CreateDefaultSchema(CreateDefaultContext);

            schema.AddType <Character>().AddAllFields();
            schema.AddField("hero", c => c.Hero);

            schema.Complete();

            var gql         = new GraphQL <Context>(schema);
            var queryResult = gql.ExecuteQuery(
                @"{
                    hero {
                        name,
                        friends {
                            name
                        }
                    }
                  }"
                );

            DeepEquals(
                queryResult,
                @"{
                    hero: {
                        name: 'R2-D2',
                        friends: [
                            {
                              name: 'Luke Skywalker'
                            },
                            {
                                name: 'Han Solo'
                            },
                            {
                                name: 'Leia Organa'
                            }
                        ]
                    }
                  }"
                );
        }
예제 #29
0
        public void RunExample()
        {
            var schema = GraphQL<Context>.CreateDefaultSchema(() =>
            new Context
            {
                Humans = new List<Human> {
                    new Human { Id = "1000", Name = "Luke Skywalker", Height = 1.72 }
                }
            });
            schema.AddType<Human>().AddAllFields();
            schema.AddField(
                "human",
                new { id = "-1" },
                (c, args) => c.Humans.SingleOrDefault(h => h.Id == args.id));

            schema.Complete();

            var gql = new GraphQL<Context>(schema);
            var queryResult = gql.ExecuteQuery("{human(id: \"1000\") {name, height}}");
            DeepEquals(queryResult, "{human: {name: 'Luke Skywalker', height: 1.72}}");
        }
예제 #30
0
        public void RunExample()
        {
            var schema = GraphQL<Context>.CreateDefaultSchema(() =>
            new Context
            {
                Heros = new List<Hero> {
                    new Hero { Id = "1000", Name = "Luke Skywalker", Episode = "EMPIRE" },
                    new Hero { Id = "1001", Name = "R2-D2", Episode = "JEDI" }
                }
            });
            schema.AddType<Hero>().AddAllFields();
            schema.AddField(
                "hero",
                new { episode = "EMPIRE" },
                (c, args) => c.Heros.SingleOrDefault(h => h.Episode == args.episode));

            schema.Complete();

            var gql = new GraphQL<Context>(schema);
            var queryResult = gql.ExecuteQuery("{empireHero: hero(episode: \"EMPIRE\") {name}, jediHero: hero(episode: \"JEDI\") {name}}");
            DeepEquals(queryResult, "{empireHero: {name: 'Luke Skywalker'}, jediHero: {name: 'R2-D2'}}");
        }
예제 #31
0
        public void RunExample()
        {
            var schema = GraphQL<Context>.CreateDefaultSchema(CreateDefaultContext);
            schema.AddType<Character>().AddAllFields();
            schema.AddField("hero", c => c.Hero);

            schema.Complete();

            var gql = new GraphQL<Context>(schema);
            var queryResult = gql.ExecuteQuery(
                @"{
                    hero {
                        name,
                        friends {
                            name
                        }
                    }
                  }"
                );
            DeepEquals(
                queryResult,
                @"{
                    hero: {
                        name: 'R2-D2',
                        friends: [
                            {
                              name: 'Luke Skywalker'
                            },
                            {
                                name: 'Han Solo'
                            },
                            {
                                name: 'Leia Organa'
                            }
                        ]
                    }
                  }"
                );
        }
예제 #32
0
        public static void FragmentsInlineFragments <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery(
                @"query UseInlineFragments {
                  luke: hero(episode: EMPIRE) {
                      ...HumanFragment,
                      ...DroidFragment
                  }
                  r2d2: hero {
                    ...HumanFragment,
                    ...DroidFragment
                  }
                }
                fragment HumanFragment on Human {
                  name
                  homePlanet
                }
                fragment DroidFragment on Droid {
                  name
                  primaryFunction
                }
            "
                );

            Test.DeepEquals(results,
                            @"
                {
                  luke: {
                    name: 'Luke Skywalker',
                    homePlanet: 'Tatooine'
                  },
                  r2d2: {
                    name: 'R2-D2',
                    primaryFunction: 'Astromech'
                  }
                }
            ");
        }
예제 #33
0
        public void RunExample()
        {
            var defaultContext = new Context
            {
                Reviews = new List <Review> {
                    new Review {
                        Stars      = 5,
                        Episode    = "EMPIRE",
                        Commentary = "Great movie"
                    }
                }
            };

            var schema = GraphQL <Context> .CreateDefaultSchema(() => defaultContext);

            schema.AddType <Review>().AddAllFields();
            schema.AddScalar(
                new
            {
                stars      = default(int),
                commentary = default(string)
            },
                i => new ReviewInput {
                Stars = i.stars, Commentary = i.commentary
            },
                "ReviewInput"
                );
            schema.AddMutation(
                "createReview",
                new { episode = "EMPIRE", review = default(ReviewInput) },
                (db, args) =>
            {
                var newId  = db.Reviews.Select(r => r.Id).Max() + 1;
                var review = new Review
                {
                    Id         = newId,
                    Episode    = args.episode,
                    Commentary = args.review.Commentary,
                    Stars      = args.review.Stars
                };
                db.Reviews.Add(review);
                return(newId);
            },
                (db, args, rId) => db.Reviews.AsQueryable().SingleOrDefault(r => r.Id == rId)
                );
            schema.Complete();

            var gql         = new GraphQL <Context>(schema);
            var queryResult = gql.ExecuteQuery(
                @"mutation CreateReviewForEpisode($ep: String!, $review: ReviewInput!) {
                    createReview(episode: ""JEDI"", review: {commentary: ""This is a great movie!"", stars: 5}) {
                        stars
                        commentary
                    }
                }"
                );

            DeepEquals(
                queryResult,
                @"{
                    ""createReview"": {
                        ""stars"": 5,
                        ""commentary"": ""This is a great movie!""
                    }
                  }
                ");
        }
예제 #34
0
        public static void DateTimeFilter <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ accountPaidBy(paid: { year: 2016 month: 1 day: 1 }) { id } }");

            Test.DeepEquals(results, "{ accountPaidBy: { id: 1 } }");
        }
예제 #35
0
        public static void TypeName <TContext>(GraphQL <TContext> gql)
        {
            var results = gql.ExecuteQuery("{ user(id:1) { id, __typename } }");

            Test.DeepEquals(results, "{ user: { id: 1, __typename: 'User' } }");
        }
예제 #36
0
        public void RunExample()
        {
            var schema = GraphQL<Context>.CreateDefaultSchema(() =>
            new Context
            {
                Heros = new List<Character> {
                    new Character {
                        Id = "1000",
                        Name = "Luke Skywalker",
                        Episode = "EMPIRE",
                        AppearsIn = new string[] { "NEWHOPE", "EMPIRE", "JEDI"},
                        Friends = new List<Character> {
                            new Character { Name = "Han Solo"},
                            new Character { Name = "Leia Organa"},
                            new Character { Name = "C-3PO"},
                            new Character { Name = "R2-D2"}
                        }
                    },
                    new Character {
                        Id = "1001",
                        Name = "R2-D2",
                        Episode = "JEDI",
                        AppearsIn = new string[] {"NEWHOPE", "EMPIRE", "JEDI" },
                        Friends = new List<Character> {
                            new Character { Name = "Luke Skywalker"},
                            new Character { Name = "Han Solo"},
                            new Character { Name = "Leia Organa"}
                        }
                    }
                }
            });
            schema.AddType<Character>().AddAllFields();
            schema.AddField(
                "hero",
                new { episode = "EMPIRE" },
                (c, args) => c.Heros.SingleOrDefault(h => h.Episode == args.episode));

            schema.Complete();

            var gql = new GraphQL<Context>(schema);
            var queryResult = gql.ExecuteQuery(
                @"{
                      leftComparison: hero(episode: ""EMPIRE"") {
                        ...comparisonFields
                      }
                      rightComparison: hero(episode: ""JEDI"") {
                        ...comparisonFields
                      }
                  }
                  fragment comparisonFields on Character {
                    name
                    appearsIn
                    friends {
                        name
                    }
                  }"
                );
            DeepEquals(
                queryResult,
                @"{
                    ""leftComparison"": {
                        ""name"": ""Luke Skywalker"",
                        ""appearsIn"": [
                            ""NEWHOPE"",
                            ""EMPIRE"",
                            ""JEDI""
                        ],
                        ""friends"": [
                            {
                              ""name"": ""Han Solo""
                            },
                            {
                              ""name"": ""Leia Organa""
                            },
                            {
                              ""name"": ""C-3PO""
                            },
                            {
                              ""name"": ""R2-D2""
                            }
                        ]
                    },
                    ""rightComparison"": {
                      ""name"": ""R2-D2"",
                      ""appearsIn"": [
                        ""NEWHOPE"",
                        ""EMPIRE"",
                        ""JEDI""
                      ],
                      ""friends"": [
                        {
                          ""name"": ""Luke Skywalker""
                        },
                        {
                          ""name"": ""Han Solo""
                        },
                        {
                          ""name"": ""Leia Organa""
                        }
                      ]
                    }
                  }
                ");
        }