Skip to content
This repository was archived by the owner on Jul 18, 2023. It is now read-only.
This repository was archived by the owner on Jul 18, 2023. It is now read-only.

Selecting specific item properties of List type properties #38

@RavenLiquid

Description

@RavenLiquid

I'm trying this out on the PokeApi GraphQL api, and I'm having a hard time figuring out how to either select a specific property of a list in a select query or do a subquery on the type.

pokemonContext.Pokemon_v2_pokemonspecies(
                    null,
                    null,
                    null,
                    null,
                    new pokemon_v2_pokemonspecies_bool_exp
                    {
                        Name = new string_comparison_exp { _ilike = name }
                    }
                )
                .Include(p => p.Pokemon_v2_pokemonevolutions.Select(evo => evo.Id) // Does nothing
                .Include(p => p.Pokemon_v2_pokemonevolutions(null, 1, 0, null, new pokemon_v2_pokemonevolution_bool_exp { Evolved_species_id = new int_comparison_exp { _eq = p.Id } }).Select(e => e.Id)) // Causes null error
                .Include(p => p.Evolution_chain_id)
                .Select(p =>
                    new
                    {
                        Id = p.Id,
                        Name = p.Name,
                        Evolutions = p.Pokemon_v2_pokemonevolutions,  // works but includes all properties
                        Evolutions = p.Pokemon_v2_pokemonevolutions.Select(evo => evo.Id),  // Does nothing
                        Evolutions = p.Pokemon_v2_pokemonevolutions(null, 0,0, null,  new pokemon_v2_pokemonevolution_bool_exp{ Evolved_species_id = new int_comparison_exp{ _eq = p.Id}}).AsQueryable().Select(e => e.Id), // Does nothing
                        EvolutionChainId = p.Evolution_chain_id,
                        BabyItemId = p.Pokemon_v2_evolutionchain.Baby_trigger_item_id // Correctly selects only the Baby_trigger_item_id 
                    });

Any type of filtering seems to omit the evolutions from the query.

I would have expected this to be generated

pokemon_v2_pokemonspecies(where: {name: {_like: "Name"}}) {
    id
    evolution_chain_id
    pokemon_v2_pokemonevolutions{
      id
    }
    name
  }

Some separate issues I encountered:
Scaffolding created all classes with an uppercase first character, this didn't work as it seems to expect lowercase names.
e.g. pokemon_v2_pokemonspecies_bool_exp instead of Pokemon_v2_pokemonspecies_bool_exp
kind of the opposite of #15

Debugging with the nuget package is impossible, the exceptions generated never have a message in the Errors property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions