sdk-for-python icon indicating copy to clipboard operation
sdk-for-python copied to clipboard

🚀 Feature: generate dataclasses from schemas

Open iron3oxide opened this issue 1 year ago • 1 comments

🔖 Feature description

As a developer, I want to know what exactly an SDK method, for example Accounts.get(), will return. It would be way more useful for this method to return an Account object with all the fields correctly typed than to receive json as I do at the moment; which leads to me having to write my own models and parsing the json into those (+ error handling ofc).

🎤 Pitch

Since the schema for e.g. Account is available in the OpenAPI spec, it should be possible to translate it into some form of dataclass. This could be the included dataclasses.dataclass or a pydantic.BaseModel, depending on your preferences regarding extra dependencies.

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

iron3oxide avatar Jul 11 '24 12:07 iron3oxide

can i handle it , we can use pydantic basemodels due to their large community support and robust docs

Shriniwas18K avatar Aug 23 '24 19:08 Shriniwas18K

type hints is a WIP issue which you can checkout here:

  • https://github.com/appwrite/sdk-for-python/issues/43

ChiragAgg5k avatar Feb 12 '25 06:02 ChiragAgg5k