Value of JSON fields returned by the API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2023
03:40 AM
Hi everyone,
I'm trying to create a (somewhat) up-to-date OpenAPI3 specification (here) for the Canvas API, to use it with an OpenAPI3 Haskell code generator (here) to generate a Haskell client library for the API.
My questions:
Is it specified somewhere which fields in the JSON objects, that are returned from API calls, can be null and which cannot?
Is the list of fields marked with Optional: in the description of each object complete?
What is the difference between nullable fields and optional fields?
For example, in the documentation of a Profile object:
// user, sample "sortable_name": "user, sample", "title": null, "bio": null,
...
// Optional: This field is only returned in certain API calls, and will return
// the IANA time zone name of the user's preferred timezone.
"time_zone": "America/Denver",
Can I correctly infer from the documentation that
- title and bio are always present in the response, and can take null as a value,
- on the other hand, time_zone is not always present in the response, and cannot take null as a value?
Thank you in advance!