Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional fields in models #83

Open
CallumWatkins opened this issue Apr 20, 2024 · 0 comments
Open

Optional fields in models #83

CallumWatkins opened this issue Apr 20, 2024 · 0 comments

Comments

@CallumWatkins
Copy link
Contributor

Because all model fields are labelled as optional, it's unclear when a field is expected to always be available but is mislabelled, versus when it is actually known to be optional. It necessitates adding many additional checks when accessing the fields of the models, especially when using type-checking such as Mypy (where you simply can't access an optional without first checking if it is None).

Unfortunately, the App Store Server API documentation (e.g. https://developer.apple.com/documentation/appstoreserverapi/jwstransactiondecodedpayload) does not say which fields are optional in many cases. I would open a PR to mark non-optional fields as such, but I do not have enough information from Apple's own documentation. Perhaps someone working on this project from Apple would have the knowledge internally to do this and simultaneously improve the documentation for all developers. Alternatively, if even just the documentation was updated, I would be happy to contribute that knowledge to this project in the form of updates to the models.

It's clear that Apple knows when fields are optional. For example, take this Apple Developer Forum post where it is confirmed by Apple that JWSTransactionDecodedPayload.purchaseDate will always appear but quantity might not.

As a developer building a product with App Store Server Notifications, it is unnecessarily difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant