# Graphql return None when no values are found

**URL:** <https://community.apollographql.com/t/graphql-return-none-when-no-values-are-found/5796>\
**Category:** Schema Design\
**Tags:** schema-design\
**Created:** [February 23, 2023, 7:24pm UTC](https://community.apollographql.com/t/graphql-return-none-when-no-values-are-found/5796 "2023-02-23T19:24:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hja24](https://avatars.discourse-cdn.com/v4/letter/h/b4bc9f/32.png) [@hja24](https://community.apollographql.com/u/hja24)\
**Post date:** [February 23, 2023, 7:24pm UTC](https://community.apollographql.com/t/graphql-return-none-when-no-values-are-found/5796/1 "2023-02-23T19:24:09Z")

</div>

I have the following query:

```
    """ query Odds($id: ID!) {
            odds(id: $id) {
                oddsMarkets {
                    oddsOptions {
                        ... on OddsToWin {
                            odds
                        }
                        ... on OddsFinishes {
                            odds
                        }
                        ... on OddsCutsPlayers {
                            odds
                        }
                        ... on OddsLeadersPlayers {
                            odds
                        }
                    }
                }
            }
        } 
   """

```

I was wondering if its possible to return all the desired values even if they are non-existent (return them as `None`). At the moment I am getting the following dictionary returned:

```
{
  'odds': {
    'oddsMarkets': [
      {
        'oddsOptions': [
          {
            'odds': '+1200'
          }
        ]
      }
    ]
  }
}

```

As you can see `+1200` is located in a list. By doing research I know that this value corresponds to `OddsToWin`. But if I don’t know this in advance, how do I know if `odds` represents the odds of winning, finishing, cutting or becoming the leader?  
Let’s say the server only returns the `odds` from `OddsLeadersPlayers`. It will also show up  
in `oddsOptions[0]` right?

Is it possible to retrieve all odds values even if they are null / None or is there another way to make it more clear?

---

<div class="post-metadata">

**Author:** ![andywgarcia](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/andywgarcia/32/5651_2.png) [@andywgarcia](https://community.apollographql.com/u/andywgarcia)\
**Post date:** [February 7, 2025, 1:37am UTC](https://community.apollographql.com/t/graphql-return-none-when-no-values-are-found/5796/2 "2025-02-07T01:37:23Z")

</div>

I think the easiest way for you to distinguish the type each is relevant for is to query for `__typename` as well

```auto
    """ query Odds($id: ID!) {
            odds(id: $id) {
                oddsMarkets {
                    oddsOptions {
                       __typename
                        ... on OddsToWin {
                            odds
                        }
                        ... on OddsFinishes {
                            odds
                        }
                        ... on OddsCutsPlayers {
                            odds
                        }
                        ... on OddsLeadersPlayers {
                            odds
                        }
                    }
                }
            }
        } 
   """

```

This will return to you

```auto
{
  'odds': {
    'oddsMarkets': [
      {
        'oddsOptions': [
          {
            '__typename': 'OddsToWin"
            'odds': '+1200'
          }
        ]
      }
    ]
  }
}

```

If you want the array to always return all options, you should be able to do that simply in your resolver with your own logic. But I don’t think there is a graphql schema way to force it to do that.
