'GraphQL Input set Boolean value

I am working on a GraphQL Input Scheme which is based on a Union. The goal is to have either only a delivery address with hasInvoice: false or have a delivery address and invoice address with hasInvoice: true. I got it everything working except the boolean part.

input BaseAddress {
  street: String!
  number: Int!
}

input OnlyDeliveryAddress {
  address: BaseAddress!
  withInvoiceAddress: false!
}

input WithInvoiceAddress {
  address: BaseAddress!
  withInvoiceAddress: true!
  invoiceAddress: BaseAddress!
}

union Address = OnlyDeliveryAddress | WithInvoiceAddress

Having booleans as Scalars is not working. Is there a way to only allow the specified boolean to be accepted?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source