Skip to content

Instantly share code, notes, and snippets.

@imranolas
Last active November 16, 2017 12:26
Show Gist options
  • Save imranolas/bdb4801826bfcae6da45e8d43dac86ef to your computer and use it in GitHub Desktop.
Save imranolas/bdb4801826bfcae6da45e8d43dac86ef to your computer and use it in GitHub Desktop.
A propose schema for lead data

Proposed Lead Data

Given the opaque nature of JSON data the following could work nicely as an alternative allowing effective introspection.

type Lead {
  ...
  data: LeadData
}

interface LeadData {
  firstName: String
  lastName: String
  email: String
  phone: String
}

type Buyer implements LeadData {
  firstName: String
  lastName: String
  email: String
  phone: String
}

type Seller implements LeadData {
  firstName: String
  lastName: String
  email: String
  phone: String
  
  address: String
  city: String
  state: String
  zip: String
  numBedrooms: Integer
  numBathrooms: Integer
}

This would allow us to query like so:

query {
  lead(nodeId: "123") {
    data {
      firstName
      lastName
      email
      phone
    }
    ... on Seller {
      address
      city
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment