Unable to use add mutation with required custom fields

Given the following schema:

type User {
  id: ID!
  email: String!
  name: String!
  profile: Profile
}

type Profile {
  username: String! @id @search(by: [hash])
  userinfo: PublicUser! @custom(http: {...})
}

type PublicUser @remote {
  name: String!
}

When using the addUser mutation like so:

mutation AddUser($input: [AddUserInput!]!) {
  addUser(input: $input) {
    numUids
    user {
      id
      profile {
        username
      }
    }
  }
}

with variables:

{
  "input": [{
    "email": "test@example.com",
    "name": "John Doe",
    "profile": {
      "username": "johndoe1"
    }
  }]
}

I get the following error:

{
  "errors": [
    {
      "message": "couldn't rewrite query for mutation addUser because xid \"johndoe1\" doesn't exist and input object not well formed because type Profile requires a value for field userinfo, but no value present"
    }
  ]
}

It’s not possible to provide the userinfo field in the add mutation, due to it being @custom, it’s not part of the ProfileRef input.

If I make userinfo optional, everything works, but this isn’t really what I want since it’s always computable (and should error if it’s not).

remove the ! from the schema and you should be good to go.

type User {
  id: ID!
  email: String!
  name: String!
  profile: Profile
}

type Profile {
  username: String! @id @search(by: [hash])
  userinfo: PublicUser @custom(http: {...})
}

type PublicUser @remote {
  name: String!
}