Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch Operations and data standardization proposal #2

Open
wuxiaohua1011 opened this issue Jul 17, 2020 · 5 comments
Open

Batch Operations and data standardization proposal #2

wuxiaohua1011 opened this issue Jul 17, 2020 · 5 comments

Comments

@wuxiaohua1011
Copy link

Hi,
Thank you so much for drafting up this API.

As title suggest, I'd love to propose two addional features to this API.

  1. Batch Operations. This would be really useful because at least in our use case, we wanted to POST and GET as much as possible. Here's a sample implementation that suited our need, but i think it can be easily adjusted to a more generic one
    batch get
    batch post this might not be a good example, input to the function should probably be a dictionary/Pydantic model, and then the function will translate that into XML format, but the idea of batch posting is there

  2. Standardizing Data types. Dictionaries are great, but it will be even better if libraries such as Pydantic can be used. The perks of using it is that it will provide out of the box data validation (like which data are required, which are optional, default fields, data type, etc) and also it will give the developer a very clear idea of what the data looks like. We have actually already created Pydantics models that you can easily use/adapt.
    ElinkGetResponseModel
    ElinkPostResponseModel
    You might want to consider changing the names

Thank you very much! I think this API will help a lot of developers to get their data in quickly.

Best,
Michael Wu

@dmlb2000
Copy link
Contributor

  1. Batch operations I completely agree with, we should totally add them.

  2. For validation of the data structures we should serialize them to JSON since that's what the community wants anyway. Then, utilizing JSON Schema https://json-schema.org/ makes more sense to validate the data structure before sending it to the API.

Just my thoughts.

@dmlb2000
Copy link
Contributor

A jsonschema document for validation can be pulled out and used in any client library not just Python.

@wuxiaohua1011
Copy link
Author

Ah, yes, I totally agree, the output data should be in JSON format. I was proposing Pydantic partially because it has JSON output
https://pydantic-docs.helpmanual.io/usage/exporting_models/#modeljson

@nensor
Copy link
Member

nensor commented Jul 21, 2020

Will definitely look at that. You won't find any opposition to JSON from me, part of the reason for dabbling with python. The language is new to me, so certainly open to suggestions.

@nensor
Copy link
Member

nensor commented Sep 1, 2020

Will be looking into some JSON validation as well as translating XML to JSON for output. I did make a minor modification I'm going to put up to post() method. Seems it was assuming the "data" was a singleton object; should now check to see if it's getting a list and post through all items at once if so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants