Code Monkey home page Code Monkey logo

Comments (8)

Wicpar avatar Wicpar commented on May 16, 2024 1

@SerVB I changed the model acquisition system in the new release. Please verify if your issue persists or not.

from ktor-openapi-generator.

Wicpar avatar Wicpar commented on May 16, 2024

Hi, Generics classes are unsupported.
Reflection is used during initialization, and generic types are erased. See JVM type erasure. This is one of the biggest caveats of JVM languages...
One way around it is to wrap your generic types like this:

class NotGeneric: GenericClass<Generic>()

This should allow the reflection to find the appropriate types.

from ktor-openapi-generator.

Wicpar avatar Wicpar commented on May 16, 2024

As for the nulls, the library currently relies on ktor to serialize the model into json. The mapper.setSerializationInclusion(Include.NON_NULL) should be activated for Jackson.

from ktor-openapi-generator.

Wicpar avatar Wicpar commented on May 16, 2024

Although thinking about it, the KType information seems to have the generic information... Maybe there is a way to handle it.

from ktor-openapi-generator.

Wicpar avatar Wicpar commented on May 16, 2024

Also, there is a hook in the configuration that allows you to properly rename the classes to be digestible by the standard.

from ktor-openapi-generator.

Wicpar avatar Wicpar commented on May 16, 2024

https://github.com/papsign/Ktor-OpenAPI-Generator/releases/tag/0.1-beta.1

Fixed. Marking as closed.

from ktor-openapi-generator.

SerVB avatar SerVB commented on May 16, 2024

@Wicpar, thank you! I see many changes, for example, T and kotlin.collections.List have disappeared.

However, there are things that I still don't understand:

  1. minimum: null/maximum: null for string and boolean seem redundant.

If I do mapper.setSerializationInclusion(Include.NON_NULL), these redundant lines disappear but it's not a solution, because also my server stops sending fields with null values. I want it to continue sending objects like {"data": null}.

  1. minimum: -2147483648 for id: int32 isn't appropriate, I want it to start with 0.

So is there a way to annotate it?

from ktor-openapi-generator.

Wicpar avatar Wicpar commented on May 16, 2024

these are separate issues...
Currently the model is made with data classes and serialised from it. I'll have to change the whole model system to make it work like that. This can be quick fixed with a separate object mapper that serialises it to string in the openapi.json endpoint.
Also, currently there are no @min @max annotations. Though it can be added quite rapidly iirc.

from ktor-openapi-generator.

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.