# Using Custom with a nullable variable

**URL:** <https://discuss.dgraph.io/t/using-custom-with-a-nullable-variable/12171>\
**Category:** GraphQL\
**Tags:** kind:question, custom-directive\
**Created:** [January 4, 2021, 7:48pm UTC](https://discuss.dgraph.io/t/using-custom-with-a-nullable-variable/12171 "2021-01-04T19:48:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![verneleem](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/verneleem/32/5801_2.png) [@verneleem](https://discuss.dgraph.io/u/verneleem)\
**Post date:** [January 4, 2021, 7:48pm UTC](https://discuss.dgraph.io/t/using-custom-with-a-nullable-variable/12171/1 "2021-01-04T19:48:25Z")

</div>

I have the schema:

```auto
type Project {
  id: ID
  name: String!
  url: String
  icons: Icons @custom(http: {
    url: "http://favicongrabber.com/api/grab/$url"
    method: GET
  })
  description: String
}

type Icons @remote {
  domain: String
  icons: [Icon]
  error: String
}

type Icon @remote {
  src: String!
  type: String
  sizes: String
}

```

However this is not able to be deployed due to the following error:

> resolving updateGQLSchema failed because input:29: Type Project; Field icons; url path inside @custom directive uses a field url that can be null.

I can’t make the url field a mandatory field because not every project will have a url, but I do want to use the custom with that field. Any resolution to this besides making url a mandatory field?

---

<div class="post-metadata">

**Author:** ![chewxy](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/chewxy/32/4339_2.png) [@chewxy](https://discuss.dgraph.io/u/chewxy)\
**Post date:** [January 4, 2021, 10:58pm UTC](https://discuss.dgraph.io/t/using-custom-with-a-nullable-variable/12171/2 "2021-01-04T22:58:14Z")

</div>

An idea would be to use a default value for the URL, with a URL for blank favicons. Then your `Project` can look like this:

```auto
type Project{
   id: ID!
   name: String!
   url: String!
   icons: ...
}

```

Right now Dgraph doesn’t support default values yet, so that will have to be programmed in your frontend. But I’ve been thinking about this for some time now, and this seems to be a good thing to have.

EDIT: I just realized that `@lambda` had landed in the latest versions. So you can just use `@lambda` to do your default values for you. Docs here:

[https://dgraph.io/docs/graphql/lambda/overview/](https://dgraph.io/docs/graphql/lambda/overview/)
