Convert JSON or Dict to client objects
Les mainteneurs répondent en général sous 2 jours
@roycaihw y travaille déjà.
Depuis le 8/10/2019.
Évaluation
Cette issue n'a pas encore été évaluée.
Description
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.
- Langage dominant
- Python
- Étoiles
- 7.7k
- Forks
- 3.5k
- Merge moyen
- 2 j 10 h
- PR mergées (30 j)
- 19
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de kubernetes-client/python
-
kind/bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 68/100
kubernetes-client/python#2280 · 16 commentaires · 9 réactions ·
Les mainteneurs répondent en général sous 2 jours
-
Release 1.37Peut-être à nouveau libre @yliaog l’a pris il y a 32 jours, et aucune pull request n’est ouverte. Ouverte
kubernetes-client/python#2691 · 1 commentaire · 1 réaction · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
Growing library sizeOuvertehelp wanted
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
kubernetes-client/python#2677 · 14 commentaires · 1 réaction ·
Les mainteneurs répondent en général sous 2 jours
-
Add option to disable strict x509 verifcation in sync clientPeut-être à nouveau libre @Vishwa0223 l’a pris il y a 36 jours, et aucune pull request n’est ouverte. Ouvertehelp wanted kind/feature
kubernetes-client/python#2602 · 6 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
-
v36.0.0 regression fetching container logsPeut-être à nouveau libre @yliaog l’a pris il y a 75 jours, et aucune pull request n’est ouverte. Ouvertekind/bug
kubernetes-client/python#2596 · 14 commentaires · 2 réactions · 1 personne assignée ·
Les mainteneurs répondent en général sous 2 jours
Toutes les issues de kubernetes-client/python
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
Les mainteneurs répondent en général sous 1 jour
-
https://search.utilibre.orgOuverteinstance instance add
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
searxng/searx-instances#941 · 1 commentaire ·
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
FluidNumerics/fluid-walk-blocker#89 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
Les mainteneurs répondent en général sous 1 jour