1

Using Apollo Studio to explore my company’s GraphQL-based API is handy, but I was wondering if there was any way to have the Studio format certain fields (or maybe it's something one can do in GraphQL):

query SomeQuery {
  searchOurThings(statuses:["somestatus"], categories:["somecategory"]) {
    edges {
      node {
        ... on OurThing {
          id
          description
          startTime     // <--- can I tell it to format this, from seconds to human-readable?
        }
      }
    }
  }
}

That query returns this:

{
"data": {
    "searchOurThings": {
      "edges": [
        {
          "node": {
            "id": "<redacted>",
            "description": null,
            "startTime": 1620853234000
          }
        },
        {
          "node": {
            "id": "<redacted>",
            "description": null,
            "startTime": 1620852304173
          }
        }
      ]
    }
  }
}

But I'd love to see:

{
"data": {
    "searchOurThings": {
      "edges": [
        {
          "node": {
            "id": "<redacted>",
            "description": null,
            "startTime": "2021-05-12 12:34:56 -0700"
          }
        },
        {
          "node": {
            "id": "<redacted>",
            "description": null,
            "startTime": "2021-05-12 12:34:56 -0700"
          }
        }
      ]
    }
  }
}
Rick
  • 3,298
  • 3
  • 29
  • 47
  • Did you ever figure this out? I'm not sure why Apollo Studio does this by default. Pretty annoying. – CodingWithoutComments Aug 30 '21 at 01:25
  • No, the value seems to be precisely what’s returned by the server. It’s ironic because I really want seconds-since-epoch for my code, but for testing an exploration I’d like a human-readable format. – Rick Aug 30 '21 at 01:47

0 Answers0