Giter VIP home page Giter VIP logo

Comments (7)

jdubois avatar jdubois commented on May 12, 2024 1

One solution would be to have Swagger only when the "development" profile is enabled

from generator-jhipster.

jmirc avatar jmirc commented on May 12, 2024

I finished the first step, which is to enable swagger using the swagger-springmvc implementation (https://github.com/martypitt/swagger-springmvc) and it works. The rest methods are exposed in the swagger ui.

One of your need is to offer swagger only during the development phase. My concern is related to the level of documentation that we want to offer. By default, the description of the method is generated based on the name of the method. Not ideal for me. The alternate solution is to add new annotations @ApiOperation for the description, @ApiErrors for the exception or error code etc.

So I don't think we will be able to offer this feature only in development.

What do you think? I will check the memory footprint and the additional libraries later this week

from generator-jhipster.

jdubois avatar jdubois commented on May 12, 2024

Yes I'm aware of those annotations: I guess it doesn't work in "prod" mode if the JAR are not available? That's what worries me with Swagger, but let's see the memory footprint first... From my understanding it's quite big, and that's my issue for production.

from generator-jhipster.

MathieuJ avatar MathieuJ commented on May 12, 2024

Hi (I'd like to work on hipster too, I'm looking at the subgenerators to
write a rest resource with swagger annotations subgenerator)
I dont' think the overhead is very high ; If I understand correctly, in dev
there are 2 parts in swagger : the part that generates the json of the api
of your project and the part that exposes the web page that use the json
api, and in that one it's just a static page that uses javascript and where
you enter the path of the api json to create the forms.

But in my mind, yes the generated services must use annotations, like this :

@get
@path("/")
@ApiOperation(value = "liste les ")
public static Result () {
return ok(Json.toJson(.find.all()));
}

@put
@path("/")
@ApiParamsImplicit(@ApiParamImplicit(value = "param Json a laisser blanc
pour le PUT Swagger", required = false, defaultValue = "{}", dataType =
"String", paramType = "body", name = "Defaut"))
@ApiOperation(value = "cree un ")
public static Result new(
@ApiParam(value = "nom", required = true) @QueryParam("nom") String
nom,
@ApiParam(value = "description", required = true)
@QueryParam("description") String description) {
new (nom, description).save();
return ok();
}

Also don't forget this useful tip that has caused me to scratch my head :
with swagger you can't write a put service without a body, so you have to
use the apiParamsImplicit (but maybe a put without a body is a bad practice)

Mathieu

2013/12/17 Julien Dubois [email protected]

Yes I'm aware of those annotations: I guess it doesn't work in "prod" mode
if the JAR are not available? That's what worries me with Swagger, but
let's see the memory footprint first... From my understanding it's quite
big, and that's my issue for production.


Reply to this email directly or view it on GitHubhttps://github.com//issues/38#issuecomment-30733833
.

from generator-jhipster.

NicolasGeraud avatar NicolasGeraud commented on May 12, 2024

Perhaps using enunciate with swagger-UI module could be a good deal ?

from generator-jhipster.

mteodori avatar mteodori commented on May 12, 2024

I am using the maven swagger plugin to avoid the inclusion of the scala runtime generating the docs at build time, would it be worth to do it in jhipster also?

from generator-jhipster.

jdubois avatar jdubois commented on May 12, 2024

@mteodori if we could get rid of Swagger inside JHipster, I would be really happy. This is really a big performance hit.

from generator-jhipster.

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.