Giter Club home page Giter Club logo

Comments (3)

llfbandit avatar llfbandit commented on June 19, 2024

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.

smhc avatar smhc commented on June 19, 2024

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.

llfbandit avatar llfbandit commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.