Giter Club home page Giter Club logo

Comments (9)

rodakr avatar rodakr commented on September 12, 2024

Generic List<class> of classes creates correct Result ( case TypeRepresentation.ConcreteTypeRepresentation )
But if Generic List<enum> holds "enum" , result is wrong.
If Rest Services returns just "enum" Type and not a generic Collection of "enum" like List<enum>, result is correct.
It looks like the case with TypeRepresentation.EnumTypeRepresentation and generic Collection of "enum" is not working.

from jaxrs-analyzer.

rodakr avatar rodakr commented on September 12, 2024

Using javax.ws.rs.core.GenericEntity<List<enum>> for JAX-RS Service Response also produce wrong Result, just empty reference... in swagger yaml/json

from jaxrs-analyzer.

rodakr avatar rodakr commented on September 12, 2024

jars-analyzer version 0.16, running with -b swagger

from jaxrs-analyzer.

sdaschner avatar sdaschner commented on September 12, 2024

Ok, that's interesting... Yes, I think your assumption with EnumTypeRepresentation goes into the right direction. I don't know if I can find the time to look into it within the next days, but please feel free to verify it using some tests in the mean time :) Have you seen the https://github.com/sdaschner/jaxrs-analyzer-st project? That helps in verifying local builds.

from jaxrs-analyzer.

rodakr avatar rodakr commented on September 12, 2024

changing visit(final TypeRepresentation.EnumTypeRepresentation representation) in SchemaBuilder has fixed the problem.
Handling in case if inCollection was not present like in visit(final TypeRepresentation.ConcreteTypeRepresentation representation) :-)

from jaxrs-analyzer.

rodakr avatar rodakr commented on September 12, 2024

@Override
public void visit(final TypeRepresentation.EnumTypeRepresentation representation) {
builder.add("type", "string");
if (!representation.getEnumValues().isEmpty()) {
final JsonArrayBuilder array = representation.getEnumValues().stream().sorted().collect(Json::createArrayBuilder, JsonArrayBuilder::add, JsonArrayBuilder::add);
//
if (inCollection) {
builder.add("items", Json.createObjectBuilder().add("type", "string").add("enum", array).build());
} else {
builder.add("enum", array);
}
//

}
}

from jaxrs-analyzer.

rodakr avatar rodakr commented on September 12, 2024

basically last if else fix it from code above

from jaxrs-analyzer.

rodakr avatar rodakr commented on September 12, 2024

#165

Successfully tested with quite complex swagger contract :-)

from jaxrs-analyzer.

rodakr avatar rodakr commented on September 12, 2024

from jaxrs-analyzer.

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.