Convert JSON or Dict to client objects
Maintainer thường phản hồi trong vòng 3 ngày
@roycaihw đang làm issue này rồi.
Từ ngày 8/10/2019.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
See also https://github.com/kubernetes-client/python/issues/340#issuecomment-526249075 (was closed for inactivity, NOT resolved)
See also #63
Motivation
It is sometimes useful to be able to load Python objects from JSON, for example to read it from a config file. It should be possible to get Python objects from JSON, to pass around the code in a type-safe manner, for modification and ultimately sending through the client.
Feature request
There should be functions to convert JSON to objects and objects to JSON. This code already exists (it's required to talk to the API server), it should be exposed.
Workaround?
Right now, you can put this raw JSON into Python objects' fields, and the API client will apparently accept this, however if you use such mixed objects your code will probably break since their attribute names are different (API uses PascalCase, Python objects use snake_case). Even if taking care to handle that, you will reach the point where you have to handle things coming from the API client (Python objects using snake_case) differently from what you load from config files (JSON using PascalCase). Really messy.
Right now I am left considering dropping this lib altogether and issuing requests directly, since the point of the wrapper is to expose safe typed Python classes instead of the raw JSON, but this doesn't work if you use any kind of config file.
Current status
It is somewhat possible to convert from a Python object to JSON using client.api_client.sanitize_for_serialization(), however converting from JSON to Python is completely impossible; the deserialize() method that exists expects a requests.Response, not JSON. Calling client.api_client._ApiClient__deserialize() works, but that is a private method, and you need to pass it the kind read from the JSON yourself.
Apologies for duplicating #340 but I cannot re-open it myself.
- Ngôn ngữ chính
- Python
- Star
- 7.7k
- Fork
- 3.5k
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của kubernetes-client/python
-
getheaders is deprecated in urllib3 >= 2.0.0Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởkind/bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
kubernetes-client/python#2280 · 16 bình luận · 9 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Security: pin oauthlib>=4.0.0 (CVE-2026-49264, CVE-2026-49265)Có thể đã có người làm @friedrichwilken đã nhận 4 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 30/100
kubernetes-client/python#2720 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Release 1.37Có thể làm lại được @yliaog đã nhận 37 ngày trước và không có pull request nào đang mở. Đang mở
kubernetes-client/python#2691 · 1 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Growing library sizeĐang mởhelp wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
kubernetes-client/python#2677 · 14 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Add option to disable strict x509 verifcation in sync clientCó thể đã có người làm @Vishwa0223 đã nhận 42 ngày trước. Đang mởhelp wanted kind/feature
kubernetes-client/python#2602 · 6 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của kubernetes-client/python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Qiskit/qiskit-ibm-runtime#3431 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Lesson] A compatibility-gate rejection is a verdict, not something to overwrite with --accept-riskĐang mởlesson-submission needs-ac pending-review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Ikalus1988/MisakaNet#2870 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature:LinkChecker
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
digitalfabrik/integreat-cms#4594 ·
Maintainer thường phản hồi trong vòng 5 ngày