question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide nullability information for data models used in the API

See original GitHub issue

For statically typed languages which differentiate between null and non-null types such as Kotlin, it gets difficult to handle null values in fields where we previously expected a non-null value.

For example, the Launch data for Starlink 5 right now looks like this:

{
    "flight_number": 91,
    "mission_name": "Starlink 5",
    "mission_id": [],
    "launch_year": "2020",
    "launch_date_unix": 1581638400,
    "launch_date_utc": "2020-02-14T00:00:00.000Z",
    "launch_date_local": "2020-02-13T18:00:00-06:00",
    "is_tentative": true,
    "tentative_max_precision": "day",
    "tbd": false,
    "launch_window": null,
    "launch_site": {
      "site_id": null,
      "site_name": null,
      "site_name_long": null
    },
    ...
  },

All the fields in “launch_site” are null, which started causing a crash in my app. I would really love to have a schema of the data models returned by this API so that I don’t have to fix null fields previously marked as non-null.

The schema should be adhered-to by the API, and the client apps, guaranteeing that the data shall be sent in that particular format only. The schema should include nullability information too.

Having a solid schema will also encourage people to write wrapper libraries for this API in different languages, and make life easier for developers of existing apps.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jakewmeyercommented, Feb 8, 2020

Go is the most likely candidate, but definitely moving away from Mongo as the db.

1reaction
jakewmeyercommented, Feb 7, 2020

As far as the future goes, I’ve been working on a new relational data model for the project, and exploring a rewrite of the api in a statically typed language.

Going to create a pinned issue for that over the weekend, with a potential rough draft of the schema to iterate on.

I’ll put all the other details in the issue, but this should solve most of the existing shortcomings the api currently has 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Optional and Nullable Properties in API Requests
OpenAPI supports values of data types to be null. To specify, one can use the “nullable: true” property while defining a data type...
Read more >
Using nullability in GraphQL
In object type fields where the data is fetched from a separate data source. I'd suggest making any fields that have resolvers that...
Read more >
Embracing Nullability for GraphQL APIs - Atomic Spin
Embracing Uncertainty. Nullable fields reflect an important property of data backing software: uncertainty. As software grows and evolves, the ...
Read more >
Designating Nullability in Objective-C APIs - Apple Developer
You can use nullability annotations in your Objective-C code to designate whether a parameter type, property type, or return type is nullable. Annotate...
Read more >
Nullable reference types - Microsoft Learn
This article provides an overview of nullable reference types. You'll learn how the feature provides safety against null reference ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found