impocode / jsonapi-pydantic Goto Github PK
View Code? Open in Web Editor NEWjsonapi-pydantic provides a suite of Pydantic models matching the JSON:API specification.
Home Page: https://pypi.org/project/jsonapi-pydantic/
License: MIT License
jsonapi-pydantic provides a suite of Pydantic models matching the JSON:API specification.
Home Page: https://pypi.org/project/jsonapi-pydantic/
License: MIT License
Hi,
Cannot test with your example on jsonapi-pydantic 0.2.2/pydantic 2.5.2
external_data = {
"data": [
{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON:API paints my bikeshed!",
"body": "The shortest article. Ever.",
"created": "2015-05-22T14:56:29.000Z",
"updated": "2015-05-22T14:56:28.000Z",
},
"relationships": {"author": {"data": {"id": "42", "type": "people"}}},
}
],
"included": [
{"type": "people", "id": "42", "attributes": {"name": "John", "age": 80, "gender": "male"}}
],
}
top_level = TopLevel(**external_data)
Traceback (most recent call last):
File "/home/gdo/.local/share/JetBrains/Toolbox/apps/pycharm-professional/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
exec(exp, global_vars, local_vars)
File "<input>", line 1, in <module>
File "/home/gdo/.local/share/virtualenvs/neorezo_cws-0mPvbHYg/lib/python3.10/site-packages/pydantic/main.py", line 164, in __init__
__pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)
File "/home/gdo/.local/share/virtualenvs/neorezo_cws-0mPvbHYg/lib/python3.10/site-packages/jsonapi_pydantic/v1_0/resource/resource.py", line 31, in check_all_values
attributes, relationships = data.get("attributes"), data.get("relationships")
AttributeError: 'list' object has no attribute 'get'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.