The documentation describes the app.license object itself as optional, which makes sense, since it can be missing for non-production environments.
However, the docs also describe all the properties below app.license as optional, which does not make sense - at the very least for the app.license.isActive field.
@atlassian, can someone clarify if the documentation is correct? What would be the point of providing the following license payload, which is valid according to the docs?
license object in Lambda context and FIT are having the same behavior.
The license.isActive property indicates the app’s license state; true if the installation has a valid license, and false otherwise.
Note: The license object is only present for paid apps in the production environment. license is undefined for free apps, apps not listed on the Atlassian Marketplace, and apps in custom environments.
Regard to your question
However, the docs also describe all the properties below app.license as optional, which does not make sense - at the very least for the app.license.isActive field.
You’re right about this. I would suggest to check license undefined first.
If yes → not published app
If no → published app, then read isActive. It should be present when license object defined. Since the type is optional, you can make default value as False.
I understand that I could check for undefined values. However, that’s not my goal. I am trying to write a schema validator for the license attribute (zod or similar) to ensure that expected license attributes are indeed present before working with the license value in code.
However, this only works if we have reliable documentation that clearly states which values are always present and which ones are optional. If, like the license docs right now, everything is marked as optional, then we do not gain much by running a schema validator.
Based on the documentation about the license attribute below, I thought that the license object is either present or not, AND if it is present, it will have some or all documented attributes available.
Note: The license object is only present for paid apps in the production environment. license is undefined for free apps, apps not listed on the Atlassian Marketplace, and apps in custom environments.
The way the FIT documentation currently describes optionality is that the license and all its sub-attributes may be missing (screenshot below). I would have expected app.license to be No, and at least one attribute under license to be Yes for the Required column.
I got your concern and it makes sense to me.
However, there might be some backward compatibility issue.
Let me check with the team to confirm which fields under license are always presented and update the docs accordingly.