Comments (3)
so if you remove/comment out the following:
if not isinstance(obj, dict):
return cls.model_validate(obj)
the code works as expected?
from openapi-generator.
@wing328 no. In my case all obj passed to this class are instance of dict so this code is anyway noop. It does work if you omit the "not" meaning if you simply return return cls.model_validate(obj) . In that case pydantic will deserialize (one might to also need to assign the result to _obj)
from openapi-generator.
And as you can see
_obj = cls.model_validate({
"name": obj.get("name"),
"address": Address.from_dict(obj.get("address")) if obj.get("address") is not None else None,
})
filters out all entries from a dict that are not name, address which I do not understand why (sorry code snippet is not completely up to date. I removed address and added age in the example repo but it does not make a difference.)
from openapi-generator.
Related Issues (20)
- Question: [Java] How to customise Base-class if oneOf is used as request body
- [BUG] Enum default values do not work in Python when enum is a `$ref`
- [REQ] [typescript-fetch] Add support for splitting models into separate files when runtime checks are disabled.
- [REQ][typescript] Enable header override at request time
- [REQ] request middleware for Zapier generator.
- [BUG] JAX-RS does not honor sourceFolder for invoker package
- [REQ] [JAVA] Generation should exit with error when an unsupported serialization library is chosen
- [BUG][Typescript][Axios/Fetch] Wrong generated code for array of items using FormData (multipart/form-data)
- [BUG] [kotlin-spring] Unbalanced parenthesis in generated function declarations when using default value HOT 3
- [REQ] Feature Request Description docker openapi-generator-online
- [BUG] Kotlin-retrofit2-gson-coroutines CollectionsFormat.CSVParams default value is set to arrayListOf()
- [REQ] Is support for Angular V18 planned?
- [BUG] [Java] hasMore is not working as expected with Java using version 7.6.0 of openapi-generator-maven-plugin HOT 2
- [BUG][JavaSpring] wrong parsing of space separated lombok annotations HOT 4
- [BUG] [JAVA] Microprofile library doesn't create @JacksonXmlRootElement on class when Jackson selected
- [BUG] [python] the client should not forcefully turn off httplib debug
- [BUG] Use API version in npm, not the npm version HOT 6
- [REQ] Update boundary for http package in dart generator
- [BUG] [typescript-fetch] Type error in oneOf when legacyDiscriminatorBehavior is false
- [C++] Using generated QT Client: How to know which response corresponds to which request?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-generator.