ThemeParks.wiki API 1.1.0: price amount can now be null
- Service change
tldr; The ThemeParks.wiki API can now return null for prices, where a price is unknown.
PriceData can now contain a null value for the amount field. When you see
null here, that implies that we don't know the price - but believe there is
one.
An example of this would be a theme park that doesn't advertise the prices until you have entered the park.
No park is returning null today. Every paid queue we publish either
carries a real price or is about to. This is a type change ahead of a need,
not a description of current data - we would rather the field be able to say
"unknown" before we meet a park that forces it than change the type under you
afterwards.
Before:
{
amount: 9999,
currency: "USD",
formatted: "$9999"
}
Now the API could return:
{
amount: null,
currency: "USD"
}
formatted is absent rather than null - we only send it when there's
something to format.
0 still means the queue is genuinely free. null means it costs money and
we don't know how much. Previously both came through as 0.
Worth watching: 0 and null are both falsy, so if (price.amount) no
longer tells the two apart. Check price.amount === null explicitly.
If you generate a client from our OpenAPI spec, regenerate. Languages with non-optional numbers - Swift, Kotlin, Go, C#, Python with pydantic - will reject the row otherwise. Our own JavaScript and Python libraries are already updated.
The spec is live and carries this change as version 1.1.0 - api.themeparks.wiki/docs/v1. The version now also carries a short digest of the contract itself, so it moves whenever the endpoints or schemas change and stays put when only the wording does.