コード例 #1
0
ファイル: GenderType.cs プロジェクト: mylogon341/PokeGraphQL
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <Gender> descriptor)
 {
     descriptor.Description(@"Genders were introduced in Generation II for the purposes of breeding pokémon 
         but can also result in visual differences or even different evolutionary lines.");
     descriptor.Field(x => x.PokemonSpeciesDetails)
     .Description("A list of pokémon species that can be this gender and how likely it is that they will be.")
     .Type <ListType <PokemonSpeciesGenderType> >();
     descriptor.UseNamedApiResourceCollectionField <Gender, PokemonSpecies, PokemonSpeciesType>(x => x.RequiredForEvolution);
 }
コード例 #2
0
        protected override void Configure(IObjectTypeDescriptor <Platform> descriptor)
        {
            descriptor.Description("Represents any software or service that has a command line interface");

            descriptor
            .Field(p => p.LicenseKey).Ignore();

            descriptor.Field(p => p.Commands)
            .ResolveWith <Resolvers>(p => p.GetCommands(default !, default !))
コード例 #3
0
        protected override void Configure(IObjectTypeDescriptor <Platform> descriptor)
        {
            descriptor.Description("Represents any software or service that has a CLI.");
            descriptor.Field(p => p.LicenseKey).Ignore(); // Don't expose it in the API
            descriptor.Field(p => p.Name).Description("Name of the software or service.");

            //Resolve p=>p.Commands field (that is nested in the Platform object) with a resolver that is below
            descriptor.Field(p => p.Commands)
            .ResolveWith <Resolvers>(p => p.GetCommands(default !, default !))        //! can't be null
コード例 #4
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <Language> descriptor)
 {
     descriptor.Description("Languages for translations of api resource information.");
     descriptor.Field(x => x.Official)
     .Description("Whether or not the games are published in this language.");
     descriptor.Field(x => x.Iso639)
     .Description("The two-letter code of the country where this language is spoken. Note that it is not unique.");
     descriptor.Field(x => x.Iso3166)
     .Description("The two-letter code of the language. Note that it is not unique.");
 }
コード例 #5
0
        protected override void Configure(IObjectTypeDescriptor <Platform> descriptor)
        {
            descriptor.Description("Representa qualquer software ou serviço que tem uma interface de linha de comando");

            descriptor
            .Field(p => p.LicenseKey).Ignore();

            descriptor
            .Field(p => p.Commands)
            .ResolveWith <Resolvers>(p => p.GetCommands(default !, default !))
コード例 #6
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <SuperContestEffect> descriptor)
 {
     descriptor.Description("Super contest effects refer to the effects of moves when used in super contests.");
     descriptor.Field(x => x.Appeal)
     .Description("The level of appeal this super contest effect has.");
     descriptor.UseNamedApiResourceCollectionField <SuperContestEffect, Move, MoveType>(x => x.Moves);
     descriptor.Field(x => x.FlavorTextEntries)
     .Description("The flavor text of this contest effect listed in different languages.")
     .Type <ListType <FlavorTextType> >();
 }
コード例 #7
0
        protected override void Configure(IObjectTypeDescriptor <Platform> descriptor)
        {
            descriptor.Description("Represents any software or service that has a command line interafce.");

            descriptor                              //use Ignore() as we're not exposing this LicenseKey Property to GraphQL,
            .Field(p => p.LicenseKey).Ignore();     //so no need for a Descriptor

            descriptor
            .Field(p => p.Commands)
            .ResolveWith <Resolvers>(p => p.GetCommands(default !, default !))       //Map the Resolver with Descriptor
コード例 #8
0
        protected override void Configure(IObjectTypeDescriptor <Platform> descriptor)
        {
            descriptor.Description("Software or Service that can be executed through command line");

            descriptor
            .Field(p => p.LicenseKey).Ignore();

            descriptor
            .Field(p => p.Commands)
            .ResolveWith <Resolvers>(p => p.GetCommands(default !, default !))
コード例 #9
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <VersionGroup> descriptor)
 {
     descriptor.Description("Version groups categorize highly similar versions of the games.");
     descriptor.Field(x => x.Order)
     .Description("Order for sorting. Almost by date of release, except similar versions are grouped together.");
     descriptor.UseNamedApiResourceField <VersionGroup, Generation, GenerationType>(x => x.Generation);
     descriptor.UseNamedApiResourceCollectionField <VersionGroup, MoveLearnMethod, MoveLearnMethodType>(x => x.MoveLearnMethods);
     descriptor.UseNamedApiResourceCollectionField <VersionGroup, Pokedex, PokedexType>(x => x.Pokedexes);
     descriptor.UseNamedApiResourceCollectionField <VersionGroup, Region, RegionType>(x => x.Regions);
     descriptor.UseNamedApiResourceCollectionField <VersionGroup, Version, VersionType>(x => x.Versions);
 }
コード例 #10
0
        protected override void Configure(IObjectTypeDescriptor <Book> descriptor)
        {
            descriptor.Description("Respresents all the books");

            //For ignoring a field
            descriptor
            .Field(p => p.CreatedAt).Ignore();

            descriptor
            .Field(c => c.BookAuthors)
            .ResolveWith <Resolvers>(c => c.GetBookAuthors(default !, default !))
コード例 #11
0
        protected override void Configure(IObjectTypeDescriptor <IType> descriptor)
        {
            descriptor.Description(
                "The fundamental unit of any GraphQL Schema is the type. There are " +
                "many kinds of types in GraphQL as represented by the `__TypeKind` enum." +
                "\n\nDepending on the kind of a type, certain fields describe " +
                "information about that type. Scalar types provide no information " +
                "beyond a name and description, while Enum types provide their values. " +
                "Object and Interface types provide the fields they describe. Abstract " +
                "types, Union and Interface, provide the Object types possible " +
                "at runtime. List and NonNull types compose other types.");

            descriptor.Field("kind")
            .Type <NonNullType <__TypeKind> >()
            .Resolver(c => GetKind(c.Parent <IType>()));

            descriptor.Field("name")
            .Type <StringType>()
            .Resolver(c => GetName(c.Parent <IType>()));

            descriptor.Field("description")
            .Type <StringType>()
            .Resolver(c => GetDescription(c.Parent <IType>()));

            descriptor.Field("fields")
            .Type <ListType <NonNullType <__Field> > >()
            .Argument("includeDeprecated",
                      a => a.Type <BooleanType>().DefaultValue(false))
            .Resolver(c => GetFields(c.Parent <IType>(),
                                     c.Argument <bool>("includeDeprecated")));

            descriptor.Field("interfaces")
            .Type <ListType <NonNullType <__Type> > >()
            .Resolver(c => GetInterfaces(c.Parent <IType>()));

            descriptor.Field("possibleTypes")
            .Type <ListType <NonNullType <__Type> > >()
            .Resolver(c => GetPossibleTypes(c.Schema, c.Parent <INamedType>()));

            descriptor.Field("enumValues")
            .Type <ListType <NonNullType <__EnumValue> > >()
            .Argument("includeDeprecated",
                      a => a.Type <BooleanType>().DefaultValue(false))
            .Resolver(c => GetEnumValues(c.Parent <IType>(),
                                         c.Argument <bool>("includeDeprecated")));

            descriptor.Field("inputFields")
            .Type <ListType <NonNullType <__InputValue> > >()
            .Resolver(c => GetInputFields(c.Parent <IType>()));

            descriptor.Field("ofType")
            .Type <__Type>()
            .Resolver(c => GetOfType(c.Parent <IType>()));
        }
コード例 #12
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <Generation> descriptor)
 {
     descriptor.Description(@"A generation is a grouping of the Pokémon games that separates them based on the Pokémon they include.
         In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.");
     descriptor.UseNamedApiResourceCollectionField <Generation, Ability, AbilityType>(x => x.Abilities);
     descriptor.UseNamedApiResourceField <Generation, Region, RegionType>(x => x.MainRegion);
     descriptor.UseNamedApiResourceCollectionField <Generation, Move, MoveType>(x => x.Moves);
     descriptor.UseNamedApiResourceCollectionField <Generation, PokemonSpecies, PokemonSpeciesType>(x => x.PokemonSpecies);
     descriptor.UseNamedApiResourceCollectionField <Generation, Type, TypePropertyType>(x => x.Types);
     descriptor.UseNamedApiResourceCollectionField <Generation, VersionGroup, VersionGroupType>(x => x.VersionGroups);
 }
コード例 #13
0
 protected override void Configure(IObjectTypeDescriptor <Choice> descriptor)
 {
     descriptor.Description("Kullanıcıya sorulan sorulara verilebilecek cevaplar");
     descriptor.Field(c => c.ChoiceId)
     .Description("Cevap Id");
     descriptor.Field(c => c.QuestionId)
     .Description("Soru Id");
     descriptor.Field(c => c.ChoiceType)
     .Description("Cevap");
     descriptor
     .Field(c => c.Question)
     .ResolveWith <Resolvers>(r => r.GetQuestion(default !, default !))
コード例 #14
0
 protected override void Configure(IObjectTypeDescriptor <User> descriptor)
 {
     descriptor.Description("Pobranie użytkowników oraz stworzonych przez nich postów.");
     descriptor.Field(x => x.Password).Ignore();
     descriptor.Field(x => x.Id).Description("Identyfikator użytkownika");
     descriptor.Field(x => x.FirstName).Description("Imię");
     descriptor.Field(x => x.LastName).Description("Nazwisko");
     descriptor.Field(x => x.Address).Description("Adres");
     descriptor.Field(x => x.City).Description("Miasto");
     descriptor.Field(x => x.Country).Description("Kraj");
     descriptor.Field(x => x.Posts).Description("Posty stworzone przez użytkownika");
 }
コード例 #15
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <Characteristic> descriptor)
 {
     descriptor.Description(@"Characteristics indicate which stat contains a Pokémon's highest IV.
         A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo).");
     descriptor.Field(x => x.GeneModulo)
     .Description("The remainder of the highest stat/IV divided by 5.");
     descriptor.Field(x => x.PossibleValues)
     .Description("The possible values of the highest stat that would result in a pokémon recieving this characteristic when divided by 5.")
     .Type <ListType <IntType> >();
     descriptor.UseNamedApiResourceField <Characteristic, Stat, StatType>(x => x.HighestStat);
     descriptor.Ignore(x => x.Descriptions);
 }
コード例 #16
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <GrowthRate> descriptor)
 {
     descriptor.Description("Growth rates are the speed with which pokémon gain levels through experience.");
     descriptor.Ignore(x => x.Descriptions);
     descriptor.Field(x => x.Formula)
     .Description("The formula used to calculate the rate at which the pokémon species gains level.")
     .Type <NonNullType <StringType> >();
     descriptor.Field(x => x.Levels)
     .Description("A list of levels and the amount of experienced needed to atain them based on this growth rate.")
     .Type <ListType <GrowthRateExperienceLevelType> >();
     descriptor.UseNamedApiResourceCollectionField <GrowthRate, PokemonSpecies, PokemonSpeciesType>(x => x.PokemonSpecies);
 }
コード例 #17
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <EvolutionChain> descriptor)
 {
     descriptor.Description(@"Evolution chains are essentially family trees. 
         They start with the lowest stage within a family 
         and detail evolution conditions for each as well as pokémon 
         they can evolve into up through the hierarchy.");
     descriptor.UseNullableNamedApiResourceField <EvolutionChain, Item, ItemType>(x => x.BabyTriggerItem);
     descriptor.Field(x => x.Chain)
     .Description(@"The base chain link object. 
             Each link contains evolution details for a pokémon in the chain. 
             Each link references the next pokémon in the natural evolution order.")
     .Type <ChainLinkType>();
 }
コード例 #18
0
        protected override void Configure(IObjectTypeDescriptor <Droid> descriptor)
        {
            descriptor.Description("The Droid Description.");

            descriptor.Interface <CharacterType>();

            descriptor.Field(t => t.Id)
            .Type <NonNullType <IdType> >();

            descriptor.Field(t => t.AppearsIn)
            .Type <ListType <EpisodeType> >();

            descriptor.Field <SharedResolvers>(r => r.GetCharacter(default, default))
コード例 #19
0
ファイル: __Type.cs プロジェクト: zaneclaes/hotchocolate
        protected override void Configure(IObjectTypeDescriptor <IType> descriptor)
        {
            descriptor.Name("__Type");

            descriptor.Description(TypeResources.Type_Description);

            descriptor.BindFields(BindingBehavior.Explicit);

            descriptor.Field("kind")
            .Type <NonNullType <__TypeKind> >()
            .Resolver(c => c.Parent <IType>().Kind);

            descriptor.Field("name")
            .Type <StringType>()
            .Resolver(c => GetName(c.Parent <IType>()));

            descriptor.Field("description")
            .Type <StringType>()
            .Resolver(c => GetDescription(c.Parent <IType>()));

            descriptor.Field("fields")
            .Type <ListType <NonNullType <__Field> > >()
            .Argument("includeDeprecated",
                      a => a.Type <BooleanType>().DefaultValue(false))
            .Resolver(c => GetFields(c.Parent <IType>(),
                                     c.ArgumentValue <bool>("includeDeprecated")));

            descriptor.Field("interfaces")
            .Type <ListType <NonNullType <__Type> > >()
            .Resolver(c => GetInterfaces(c.Parent <IType>()));

            descriptor.Field("possibleTypes")
            .Type <ListType <NonNullType <__Type> > >()
            .Resolver(c => GetPossibleTypes(c.Schema, c.Parent <INamedType>()));

            descriptor.Field("enumValues")
            .Type <ListType <NonNullType <__EnumValue> > >()
            .Argument("includeDeprecated",
                      a => a.Type <BooleanType>().DefaultValue(false))
            .Resolver(c => GetEnumValues(c.Parent <IType>(),
                                         c.ArgumentValue <bool>("includeDeprecated")));

            descriptor.Field("inputFields")
            .Type <ListType <NonNullType <__InputValue> > >()
            .Resolver(c => GetInputFields(c.Parent <IType>()));

            descriptor.Field("ofType")
            .Type <__Type>()
            .Resolver(c => GetOfType(c.Parent <IType>()));
        }
コード例 #20
0
        protected override void Configure(IObjectTypeDescriptor <Genre> descriptor)
        {
            descriptor.Description("Respresents all the Genre");

            //For ignoring a field
            descriptor
            .Field(p => p.CreatedAt).Ignore();

            descriptor
            .Field(c => c.Id)

            .UseDbContext <GlobalAzureContext>()
            .Description("This is the Genre");
        }
コード例 #21
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <Nature> descriptor)
 {
     descriptor.Description("Natures influence how a pokémon's stats grow.");
     descriptor.UseNamedApiResourceField <Nature, Stat, StatType>(x => x.DecreasedStat);
     descriptor.UseNamedApiResourceField <Nature, Stat, StatType>(x => x.IncreasedStat);
     descriptor.UseNamedApiResourceField <Nature, BerryFlavor, BerryFlavorType>(x => x.HatesFlavor);
     descriptor.UseNamedApiResourceField <Nature, BerryFlavor, BerryFlavorType>(x => x.LikesFlavor);
     descriptor.Field(x => x.PokeathlonStatChanges)
     .Description("A list of pokéathlon stats this nature effects and how much it effects them.")
     .Type <ListType <NatureStatChangeType> >();
     descriptor.Field(x => x.MoveBattleStylePreferences)
     .Description("A list of battle styles and how likely a pokémon with this nature is to use them in the Battle Palace or Battle Tent.")
     .Type <ListType <MoveBattleStylePreferenceType> >();
 }
コード例 #22
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <ContestEffect> descriptor)
 {
     descriptor.Description("Contest effects refer to the effects of moves when used in contests.");
     descriptor.Field(x => x.Appeal)
     .Description("The base number of hearts the user of this move gets.");
     descriptor.Field(x => x.Jam)
     .Description("The base number of hearts the user's opponent loses.");
     descriptor.Field(x => x.EffectEntries)
     .Description("The result of this contest effect listed in different languages.")
     .Type <ListType <EffectsType> >();
     descriptor.Field(x => x.FlavorTextEntries)
     .Description("The flavor text of this contest effect listed in different languages.")
     .Type <ListType <FlavorTextType> >();
 }
コード例 #23
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <LocationArea> descriptor)
 {
     descriptor.Description(@"Location areas are sections of areas, such as floors in a building or cave. 
         Each area has its own set of possible pokemon encounters.");
     descriptor.Field(x => x.GameIndex)
     .Description("The internal id of an api resource within game data.");
     descriptor.Field(x => x.EncounterMethodRates)
     .Description(@"A list of methods in which pokémon may be encountered in this area 
             and how likely the method will occur depending on the version of the game.")
     .Type <ListType <EncounterMethodRateType> >();
     descriptor.UseNamedApiResourceField <LocationArea, Location, LocationType>(x => x.Location);
     descriptor.Field(x => x.PokemonEncounters)
     .Description("A list of pokémon that can be encountered in this area along with version specific details about the encounter.")
     .Type <ListType <PokemonEncounterType> >();
 }
コード例 #24
0
        protected override void Configure(
            IObjectTypeDescriptor descriptor)
        {
            descriptor.Name("__Directive");

            descriptor.Description(
                "A Directive provides a way to describe alternate runtime execution and " +
                "type validation behavior in a GraphQL document.\n\n" +
                "In some cases, you need to provide options to alter GraphQL's " +
                "execution behavior in ways field arguments will not suffice, such as " +
                "conditionally including or skipping a field. Directives provide this by " +
                "describing additional information to the executor.");

            descriptor.Field("name")
            .Type <NonNullType <StringType> >()
            .Resolver(c => c.Parent <DirectiveType>().Name);

            descriptor.Field("description")
            .Type <StringType>()
            .Resolver(c => c.Parent <DirectiveType>().Description);

            descriptor.Field("isRepeatable")
            .Type <BooleanType>()
            .Resolver(c => c.Parent <DirectiveType>().IsRepeatable);

            descriptor.Field("locations")
            .Type <NonNullType <ListType <NonNullType <__DirectiveLocation> > > >()
            .Resolver(c => c.Parent <DirectiveType>().Locations);

            descriptor.Field("args")
            .Type <NonNullType <ListType <NonNullType <__InputValue> > > >()
            .Resolver(c => c.Parent <DirectiveType>().Arguments);

            descriptor.Field("onOperation")
            .Type <NonNullType <BooleanType> >()
            .Resolver(c => GetOnOperation(c))
            .DeprecationReason("Use `locations`.");

            descriptor.Field("onFragment")
            .Type <NonNullType <BooleanType> >()
            .Resolver(c => GetOnFragment(c))
            .DeprecationReason("Use `locations`.");

            descriptor.Field("onField")
            .Type <NonNullType <BooleanType> >()
            .Resolver(c => GetOnField(c))
            .DeprecationReason("Use `locations`.");
        }
コード例 #25
0
        protected override void Configure(IObjectTypeDescriptor <IEdge> descriptor)
        {
            // TODO : Fix this with the new schema builder
            descriptor.Name($"{new T().Name}Edge");
            descriptor.Description("An edge in a connection.");

            descriptor.Field(t => t.Cursor)
            .Name("cursor")
            .Description("A cursor for use in pagination.")
            .Type <NonNullType <StringType> >();

            descriptor.Field(t => t.Node)
            .Name("node")
            .Description("The item at the end of the edge.")
            .Type <T>();
        }
コード例 #26
0
        /// <inheritdoc/>
        protected override void ConcreteConfigure(IObjectTypeDescriptor <Pokedex> descriptor)
        {
            descriptor.Description(@"A Pokédex is a handheld electronic encyclopedia device; one which is capable of recording 
            and retaining information of the various Pokémon in a given region with the exception of the national dex
            and some smaller dexes related to portions of a region.");
            descriptor.Field(x => x.IsMainSeries)
            .Description("Whether or not this pokédex originated in the main series of the video games.");
            descriptor.Field(x => x.PokemonEntries)
            .Description("A list of pokémon catalogued in this pokédex  and their indexes.")
            .Type <ListType <PokemonEntryType> >();
            descriptor.UseNamedApiResourceField <Pokedex, Region, RegionType>(x => x.Region);
            descriptor.UseNamedApiResourceCollectionField <Pokedex, VersionGroup, VersionGroupType>(x => x.VersionGroups);

            // TODO: implement ignored field
            descriptor.Ignore(x => x.Descriptions);
        }
コード例 #27
0
 /// <inheritdoc/>
 protected override void ConcreteConfigure(IObjectTypeDescriptor <PokemonSpecies> descriptor)
 {
     descriptor.Description(@"A Pokémon Species forms the basis for at least one pokémon. 
         Attributes of a Pokémon species are shared across all varieties of pokémon within the species. 
         A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.");
     descriptor.Ignore(x => x.FormDescriptions);
     descriptor.Field(x => x.Order)
     .Description(@"The order in which species should be sorted.
             Based on National Dex order, except families are grouped together and sorted by stage.");
     descriptor.Field(x => x.GenderRate)
     .Description("The chance of this Pokémon being female, in eighths; or -1 for genderless.");
     descriptor.Field(x => x.CaptureRate)
     .Description("The base capture rate; up to 255. The higher the number, the easier the catch.");
     descriptor.Field(x => x.BaseHappiness)
     .Description("The happiness when caught by a normal pokéball; up to 255. The higher the number, the happier the pokémon.");
     descriptor.Field(x => x.IsBaby)
     .Description("Whether or not this is a baby pokémon.");
     descriptor.Field(x => x.HatchCounter)
     .Description("Initial hatch counter: one must walk 255 × (hatch_counter + 1) steps before this Pokémon's egg hatches, unless utilizing bonuses like Flame Body's.");
     descriptor.Field(x => x.HasGenderDifferences)
     .Description("Whether or not this pokémon can have different genders.");
     descriptor.Field(x => x.FormsSwitchable)
     .Description("Whether or not this pokémon has multiple forms and can switch between them.");
     descriptor.UseNamedApiResourceField <PokemonSpecies, GrowthRate, GrowthRateType>(x => x.GrowthRate);
     descriptor.Field(x => x.PokedexNumbers)
     .Description("A list of pokedexes and the indexes reserved within them for this pokémon species.")
     .Type <ListType <PokemonSpeciesDexEntryType> >();
     descriptor.UseNamedApiResourceCollectionField <PokemonSpecies, EggGroup, EggGroupType>(x => x.EggGroups);
     descriptor.UseNamedApiResourceField <PokemonSpecies, PokemonColor, PokemonColorType>(x => x.Color);
     descriptor.UseNamedApiResourceField <PokemonSpecies, PokemonShape, PokemonShapeType>(x => x.Shape);
     descriptor.UseNullableNamedApiResourceField <PokemonSpecies, PokemonSpecies, PokemonSpeciesType>(x => x.EvolvesFromSpecies);
     descriptor.UseApiResourceField <PokemonSpecies, EvolutionChain, EvolutionChainType>(x => x.EvolutionChain);
     descriptor.UseNamedApiResourceField <PokemonSpecies, PokemonHabitat, PokemonHabitatType>(x => x.Habitat);
     descriptor.UseNamedApiResourceField <PokemonSpecies, Generation, GenerationType>(x => x.Generation);
     descriptor.Field(x => x.PalParkEncounters)
     .Description("A list of encounters that can be had with this pokémon species in pal park.")
     .Type <ListType <PalParkEncounterAreaType> >();
     descriptor.Field(x => x.Genera)
     .Description("The genus of this pokémon species listed in multiple languages.")
     .Type <ListType <GenusType> >();
     descriptor.Field(x => x.Varieties)
     .Description("A list of the pokémon that exist within this pokémon species.")
     .Type <ListType <PokemonSpeciesVarietyType> >();
     descriptor.Field(x => x.FlavorTextEntries)
     .Type <ListType <PokemonSpeciesFlavorTextsType> >();
 }
コード例 #28
0
        protected override void Configure(IObjectTypeDescriptor <InputField> descriptor)
        {
            descriptor.Name("__InputValue");

            descriptor.Description(
                "Arguments provided to Fields or Directives and the input fields of an " +
                "InputObject are represented as Input Values which describe their type " +
                "and optionally a default value.");

            descriptor.BindFields(BindingBehavior.Explicit);

            descriptor.Field(t => t.Name)
            .Type <NonNullType <StringType> >();

            descriptor.Field(t => t.Description);

            descriptor.Field(t => t.Type)
            .Type <NonNullType <__Type> >();

            descriptor.Field(t => t.DefaultValue)
            .Description(
                "A GraphQL-formatted string representing the default value for this " +
                "input value.")
            .Type <StringType>()
            .Resolver(c =>
            {
                InputField field = c.Parent <InputField>();
                if (field.Type.IsNonNullType() &&
                    field.DefaultValue is NullValueNode)
                {
                    return(null);
                }

                if (field.DefaultValue != null)
                {
                    object nativeValue = field.Type.ParseLiteral(field.DefaultValue);
                    if (field.Type is ISerializableType serializableType)
                    {
                        return(JsonConvert.SerializeObject(
                                   serializableType.Serialize(nativeValue)));
                    }
                }

                return(null);
            });
        }
コード例 #29
0
        protected override void Configure(IObjectTypeDescriptor <Profile> descriptor)
        {
            // Adding description of type object for documentation
            descriptor.Description("Represents the file holding the clients and any of their applications, such as mortgages, loans and insurance policies");

            // Removing Profile.CreateDate from schema as do not want this exposed via API
            descriptor
            .Field(p => p.CreateDate).Ignore()
            .Description("The date this profile was added to the system");

            descriptor
            .Field(p => p.DisplayName)
            .Description("Reference number for overall profile, visible within the platform.");

            descriptor
            .Field(p => p.Clients)
            .ResolveWith <Resolvers>(p => p.GetClients(default !, default))
コード例 #30
0
        protected override void Configure(
            IObjectTypeDescriptor <IConnection> descriptor)
        {
            // TODO : Fix this with the new schema builder
            descriptor.Name($"{new T().Name}Connection");
            descriptor.Description("A connection to a list of items.");

            descriptor.Field(t => t.PageInfo)
            .Name("pageInfo")
            .Description("Information to aid in pagination.")
            .Type <NonNullType <PageInfoType> >();

            descriptor.Field(t => t.Edges)
            .Name("edges")
            .Description("A list of edges.")
            .Type <ListType <NonNullType <EdgeType <T> > > >();
        }