🪃
Engineering Playbook
  • Engineering Playbook
  • Agile Development
    • Kanban from the start
    • Daily Stand-up
    • Collaboration
      • Mobile Designer X Mobile Developer
    • Backlog Management
      • Backlog Refinement
    • Card Management
      • Epics
      • User story
        • Collaboration experience with acceptance criteria
        • Proper acceptance criteria
      • Task
      • Bug
      • Hotfix
      • Sub-task
      • Defect
      • Columns
      • Card organization
      • Column Limit
      • Board Templates
    • Pull System Task Assignment
    • Retrospectives
    • Team Agreement
      • Working Agreement
      • Definition of Ready
      • Definition of Done
    • Agile Metrics
  • Github
    • Source Control
    • Merge Strategies
    • Versioning
    • Code Reviews
      • Author's Checklist
      • Reviewer's Checklist
  • Documentation
    • GraphQL as an API Doc
  • DevOps
    • Continuous Integration
Powered by GitBook
On this page

Was this helpful?

  1. Documentation

GraphQL as an API Doc

Make use of @mock directive for mocked APIs, list down the potential propagated errors, add a short description to the fields if necessary. For example:

"""
This is a sample
"""
type Account {
  """
  Add documentation, if necessary. 
  """
  name: String!
  """
  Additional details to take note of
  """
  username: String!
}

type UpdateMeResponse {
  """
  Newly updated account
  """
  account: Account!
}

input UpdateMeInput {
  """
  It requires an email verification
  """
  email: String
  
  """
  It requires a phone number OTP
  """
  phoneNumber: String
}

type Query {
  """
  Checks the current user's details.
  
  ### Error Codes
  - \`A00001\` - <Error summary>
  """
  me: Account @mock
  
  """
  To check other accounts. 
  
  Please use \`Query.me\` if you want to check the current user's details.
  
  ### Error Codes
  - \`A00002\` - <Error sumamry>
  """
  account(id: ID!): Account @mock
}

type Mutation {
  """
   ### Error Codes
   - \`A00003\` - Invalid email
   - \`A00004\` - Invalid phone number
  """
  updateMe(input: UpdateMeInput!): UpdateMeResponse!
}

Add comments to add more clarity to the fields. For example:

enum CoinDropStatus {
  """
  CoinDrop is waiting for transfer confirmation.
  """
  PENDING
  """
  CoinDrop is active and can be claimed.
  """
  ACTIVE
  """
  CoinDrop is inactive. The current time is outside the start time and end time.
  """
  INACTIVE
  """
  A maximum number of claims is reached.
  """
  EXHAUSTED
}
PreviousReviewer's ChecklistNextContinuous Integration

Last updated 3 years ago

Was this helpful?