hello I have some issues with root
class Pets(BaseModel):
__root__: List[str]
class PetHouse(BaseModel):
Animals: Pets
Location: str
pet1 = Pets(__root__=['dog', 'cat'])
pet2 = Pets.parse_obj(['dog', 'cat'])
pet1_json_str = json.dumps(pet1.json())
pet2_json_str = json.dumps(pet2.json())
pet_house_json_str = '{"Animals": ["dog", "cat"], "Location": "Montpellier"}'
pet_house = PetHouse(**json.loads(pet_house_json_str))
pet_house_result_json_str = json.dumps(pet_house.json())
my_pets = pet_house.Animals
my_pets_result_json_str = json.dumps(my_pets.json())
we have {"Animals": ["dog", "cat"], "Location": "Montpellier"} as input json
we have {"Animals": {"root": ["dog", "cat"]}, "Location": "Montpellier"} as result json, from the pydantic object which make it impossible to reload by other application
Moreover my_pets_result_json_str gives ["dog", "cat"] ...
(sorry if the format is not correct, it is my first bug on github)
hello I have some issues with root
we have {"Animals": ["dog", "cat"], "Location": "Montpellier"} as input json
we have {"Animals": {"root": ["dog", "cat"]}, "Location": "Montpellier"} as result json, from the pydantic object which make it impossible to reload by other application
Moreover my_pets_result_json_str gives ["dog", "cat"] ...
(sorry if the format is not correct, it is my first bug on github)