Title: Pydantic, exclude_defaults=True re-add `apiVersion` and `kind` by haarchri · Pull Request #114 · crossplane/function-sdk-python · GitHub
Open Graph Title: Pydantic, exclude_defaults=True re-add `apiVersion` and `kind` by haarchri · Pull Request #114 · crossplane/function-sdk-python
X Title: Pydantic, exclude_defaults=True re-add `apiVersion` and `kind` by haarchri · Pull Request #114 · crossplane/function-sdk-python
Description: Description of your changes In Pydantic, exclude_defaults=True in model_dump excludes fields that have their value equal to the default. If a field like apiVersion is set to its default value 's3.aws.upbound.io/v1beta2' (and not explicitly provided during initialization), it will be excluded from the serialized output. so we will explicit add apiVersion and kind Fixes # I have: Read and followed Crossplane's contribution process. Added or updated unit tests for my change. Tests tested via dependencies = [ "click==8.1.7", "grpcio==1.66.2", "crossplane-function-sdk-python @ git+https://github.com/haarchri/function-sdk-python@test" ] [tool.hatch.metadata] allow-direct-references = true before: up composition render apis/xstoragebuckets/composition.yaml examples/storagebucket/example.yaml --- apiVersion: platform.example.com/v1alpha1 kind: XStorageBucket metadata: name: example status: conditions: - lastTransitionTime: "2024-01-01T00:00:00Z" message: 'Unready resources: bucket' reason: Creating status: "False" type: Ready --- metadata: annotations: crossplane.io/composition-resource-name: bucket generateName: example- labels: crossplane.io/composite: example ownerReferences: - apiVersion: platform.example.com/v1alpha1 blockOwnerDeletion: true controller: true kind: XStorageBucket name: example uid: "" spec: forProvider: region: us-west-1 — with this PR: up composition render apis/xstoragebuckets/composition.yaml examples/storagebucket/example.yaml --- apiVersion: platform.example.com/v1alpha1 kind: XStorageBucket metadata: name: example status: conditions: - lastTransitionTime: "2024-01-01T00:00:00Z" message: 'Unready resources: bucket' reason: Creating status: "False" type: Ready --- apiVersion: s3.aws.upbound.io/v1beta1 kind: Bucket metadata: annotations: crossplane.io/composition-resource-name: bucket generateName: example- labels: crossplane.io/composite: example ownerReferences: - apiVersion: platform.example.com/v1alpha1 blockOwnerDeletion: true controller: true kind: XStorageBucket name: example uid: "" spec: forProvider: region: us-west-1
Open Graph Description: Description of your changes In Pydantic, exclude_defaults=True in model_dump excludes fields that have their value equal to the default. If a field like apiVersion is set to its default value '...
X Description: Description of your changes In Pydantic, exclude_defaults=True in model_dump excludes fields that have their value equal to the default. If a field like apiVersion is set to its default value &...
Opengraph URL: https://github.com/crossplane/function-sdk-python/pull/114
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:0025efaa-b2ee-0ffb-0c5d-f7e9ae61aa5a |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A640:15CAB5:3885BE:4C7DBA:6A613839 |
| html-safe-nonce | 36b9dc386392cad317faa97a3a45653bb7c7276740b21ccd3b9d903d771e9785 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNjQwOjE1Q0FCNTozODg1QkU6NEM3REJBOjZBNjEzODM5IiwidmlzaXRvcl9pZCI6IjQ3NzY3NTY2NzE1NTI3NjM5NjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f6f1a12fedc418fd38dce372aeea9de884f8e11afa5840b8cbce27eddd4eb387 |
| hovercard-subject-tag | pull_request:2262232478 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/crossplane/function-sdk-python/pull/114/files |
| twitter:image | https://avatars.githubusercontent.com/u/21083497?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/21083497?s=400&v=4 |
| og:image:alt | Description of your changes In Pydantic, exclude_defaults=True in model_dump excludes fields that have their value equal to the default. If a field like apiVersion is set to its default value '... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2b7a3d1e6770dc7153450d820fcfe9a7851c4cf2251dcc29c7ad3c5cd1b9e88b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/crossplane/function-sdk-python git https://github.com/crossplane/function-sdk-python.git |
| octolytics-dimension-user_id | 45158470 |
| octolytics-dimension-user_login | crossplane |
| octolytics-dimension-repository_id | 721365259 |
| octolytics-dimension-repository_nwo | crossplane/function-sdk-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 721365259 |
| octolytics-dimension-repository_network_root_nwo | crossplane/function-sdk-python |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 78cf9d43f120d1f03636ca22ab420bcbb1712804 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width