Comments (3)
Thanks for the report, now map is directly converted to JsonNode and more generally, content "primitives" (i.e. not object or array) are now mapped regardless what the type is supposed to be. Wrong content type is now converted to string node instead of null node for better error reports.
Are you able to confirm the fix in latest snapshot?
from openapi4j.
Thanks that appears to have resolved those simple test cases using strings and integers.
(i.e. not object or array) are now mapped regardless what the type is supposed to be.
Does this suggest that objects and arrays are mapped according to the spec rather than the data object type? I think there will be issues if you use the spec for anything during conversion without doing full validation.
The use of discriminators means the data is polymorphic and cannot be converted using the spec without doing full validation. A property may be a string or an object/hash, depending on the value of another property.
Is there any reason you can't inspect the object and see if it is a hash or a list rather than using the spec? The jackson libraries may have some helpers to do this.
from openapi4j.
I wrote this for other un-structured content types (x-www-form-urlencoded) and parameters (cookies, query, ...) also combined with defined styles. Map<String, Object> as input is fine here.
For the others, I'll digg into it for in a separate issue but it may be impossible to achieve. Let's take an example for a query parameter with exploded form style : /users?id=5
without the schema we can't determine if it's a primitive or an array with a single value in the collection. This is also true for x-www-form-urlencoded
content type as an Encoding Object can be defined to setup a style.
from openapi4j.
Related Issues (20)
- int64 or int32 format not identified by openapi4j tool HOT 3
- Mandatory element missing is not throwing error HOT 3
- Some of the optional fields when using oneOf are not being validated HOT 1
- Convenience methods to support easy response validation HOT 3
- Spring Adapter
- Validating data against schema with $ref HOT 2
- Incorrect path pattern for path parameter HOT 2
- Creating schema references programatically HOT 7
- OpenApi3Parser - add ability to provide spec string/stream to parse method HOT 2
- Integer formats not identified in 1.0.5 version openapi4j tool HOT 1
- Scheme that contains path parameters with minus sign in name fails validation HOT 1
- Throw ValidationException on path pattern collision
- Give the option to throw a validation error with no response validator is found
- RequestValidator fails when path params contains minus char HOT 1
- Get the path of an operation HOT 2
- ADDITIONAL_PROPS_RESTRICT = true rejects all attributes HOT 1
- Duplicate properties, Duplicate Headers are not being validated HOT 2
- Remove toString() call to replace NPE with more meaningful message
- Validation of callback URLs can't handle allOf/oneOf/... HOT 3
- Path pattern collision leads to incorrect Path selection
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 openapi4j.