09-18-2022 19:22
09-18-2022 19:22
There was a relevant thread to my question, however it was left hanging a little, so I decided to post this question again. In addition to what was attempted, I also tried using openapi-typescript to try to derive the response body schema, but was unable to do so.
As part of our use case, we need to know the fields that are guaranteed to be returned / optional from different endpoints. Is there a way to derive the response body schema type? Thanks!
09-19-2022 11:24
09-19-2022 11:24
Hi @lyqht
In the description of each endpoint, we have displayed the schema. For example, see https://dev.fitbit.com/build/reference/web-api/activity/get-activity-goals/#Response. Does this give you the information you need?
Gordon
09-19-2022 18:31
09-19-2022 18:31
Hi @Gordon-C , yes we have been manually writing typescript interfaces based on the response section in the Web API Docs. This is because when I import fitbit web api swagger.json into postman, no response examples are not documented on swagger directly, so we couldn't generate the types off the API docs. However, this has been inefficient and also insufficient because we might miss out which fields are nullable e.g. Get Daily Activity Summary End point's response has possibly nullable fields such as heartRateZones, elevation, and these facts are only briefly mentioned in additional notes where it could be due to device limitations or scopes. They should be included as part of the schema description itself.
For our use case, we are performing data ingestion in a way where we have to validate every field in the object, so it is necessary for us to know which fields are nullable.
09-20-2022 11:52
09-20-2022 11:52
Hi @lyqht
We have an enhancement to update the swagger documentation and the json file. I'll see what we can do to expand on the information in the json file based on the specification. If there is anything specific you're looking for, please point it out the information in the swagger documentation (swagger.io).