-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Typing of deployment's payload field #178
Comments
Actually, there is a |
I looked at https://github.com/github/rest-api-description/blob/main/descriptions/api.github.com/api.github.com.2022-11-28.yaml. However, I only checked I reported this upstream: github/rest-api-description#4421 |
Thank you for correcting the webhook model. 🙏 However, using a plain from githubkit.versions.latest.types import ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type
empty : ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type = {}
some_field_bool : ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type = {"downtime": False}
some_field_str : ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type = {"downtime": "false"} > pyright
payload_test.py
payload_test.py:5:77 - error: Type "dict[str, bool]" is not assignable to declared type "ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type"
"downtime" is an undefined item in type "ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type" (reportAssignmentType)
payload_test.py:6:76 - error: Type "dict[str, str]" is not assignable to declared type "ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type"
"downtime" is an undefined item in type "ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type" (reportAssignmentType)
2 errors, 0 warnings, 0 informations
> mypy
payload_test.py:5: error: Extra key "downtime" for TypedDict "ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type" [typeddict-unknown-key]
payload_test.py:6: error: Extra key "downtime" for TypedDict "ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type" [typeddict-unknown-key] I think for the time being |
object without any field and allow extra properties can be a plain dict. Since this is not relative to the webhook schema, could you please create a separate issue to track this? |
Of cause: #182 |
GitHub deployments API includes a
payload
field. That can be JSON payload (either as string or directly embedded).It is currently documented as:
it is currently typed as
Both represent the
type: object
aspect, but ignoreadditionalProperties: true
. This makes the field useless (as they only allow to encode an empty json object).For pydantic
extra=allow
is needed:I am not so sure about
ReposOwnerRepoDeploymentsPostBodyPropPayloadOneof0Type
. I think, it needs to be encoded as a normaldict[str, ...]
asTypedDict
s have currently no way to allow for extra keys.(I can try to create a PR but I am not familiar with the code base at the moment).
The text was updated successfully, but these errors were encountered: