-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: add sighting types and queries to schema #53
Conversation
Defines the Sighting type, a query for one sighting by id and a query for a list with search, filter, sort and cursor pagination. Documents the pagination choice in the README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sighting.city is declared String! (never null), but in the database UFO_SIGHTINGS.LOCATION_ID is nullable. A sighting with no location has no city, so the resolver would return null for city.
I tested it with a fake resolver returning two sightings, one with city: null:
{"data":null,"errors":["Cannot return null for non-nullable field Sighting.city."]}
GraphQL handles a null in a field marked ! by making the field above it null, and repeats this upwards. Every level here is marked !: node: Sighting!, [SightingEdge!]! and SightingConnection!. So the null climbs all the way to the top, and the whole response becomes data: null, including totalCount and the 19 valid sightings. A single bad row would break an entire page of search results.
I've pushed a change that fixes this |
|
datetime is documented as UTC, but NUFORC times are local wall-clock times (schema.ts:5) |
You're right, I assumed it was UTC since the places are all over the world. Changed the description to local time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Defines the Sighting type, a query for one sighting by id and a query for a list with search, filter, sort and cursor pagination. Documents the pagination choice in the README.