swagger jax-rs post json body as string

73 views
Skip to first unread message

Patrick Verboom

unread,
Jan 18, 2017, 4:37:04 AM1/18/17
to Swagger
hi,

I am currently using swagger 1.5.4 with the swagger-maven-plugin to generate my api docu from my jax-rs services. It is all working fine and the docu is being generated.
I have problems with the corner cases where swagger is unable to determine the model from the request/response. In my particular case I use MongoDB.
I use the org.bson.Document as a response and in requests I take the body as a string, validate it and convert it into a org.bson.Document.
I would like to add json examples and the json schema definition to the swagger documentation.
Is this possible and when yes how?

Kind regards,
Patrick

Ron Ratovsky

unread,
Jan 18, 2017, 3:03:10 PM1/18/17
to swagger-sw...@googlegroups.com

You can do that in various ways, all controlled by the annotations (adding types, manipulating them, adding examples).

However, you can’t do most with 1.5.4 (it’s an old version) and swagger-maven-plugin may not support all these new options (whereas swagger-core does).

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Patrick Verboom

unread,
Jan 19, 2017, 10:41:12 AM1/19/17
to Swagger
I have upgraded the dependencies to the latest version. I have been trying hard to get it running with swagger-maven-plugin and I didn't get it working for this use case.

What would be the best way to create static html ouput from this kind of JAX-RS/swagger annotated project?

On Wednesday, January 18, 2017 at 9:03:10 PM UTC+1, Ron wrote:

You can do that in various ways, all controlled by the annotations (adding types, manipulating them, adding examples).

However, you can’t do most with 1.5.4 (it’s an old version) and swagger-maven-plugin may not support all these new options (whereas swagger-core does).

 

 

 

hi,



I am currently using swagger 1.5.4 with the swagger-maven-plugin to generate my api docu from my jax-rs services. It is all working fine and the docu is being generated.
I have problems with the corner cases where swagger is unable to determine the model from the request/response. In my particular case I use MongoDB.
I use the org.bson.Document as a response and in requests I take the body as a string, validate it and convert it into a org.bson.Document.
I would like to add json examples and the json schema definition to the swagger documentation.
Is this possible and when yes how?

Kind regards,
Patrick

--
You received this message because you are subscribed to the Google Groups "Swagger" group.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ron Ratovsky

unread,
Jan 19, 2017, 3:15:34 PM1/19/17
to swagger-sw...@googlegroups.com

There are multiple ways of creating static documentation.

However, the basic difference between using swagger-core directly and swagger-maven-plugin is that the former generates the spec at runtime and the latter at build time, and I don’t know which one suits your needs.

It’s possible that swagger-maven-plugin is not updated to the latest version of swagger-core and doesn’t support the new annotations, but that’s a community project that we don’t manage.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--

You received this message because you are subscribed to the Google Groups "Swagger" group.

To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

Patrick Verboom

unread,
Jan 20, 2017, 3:41:41 AM1/20/17
to Swagger
What suits my needs is that I want to generate static html pages from an existing JAX-RS application with swagger annotations. I want the tool to analyze my source code and create static html pages.
The swagger-maven-plugin is working as long as I have an annotated model. In this case I don't have an anotated model I send or receive a MongoDB org.bson Document. Currently the documentation generated with swagger-maven-plugin is missing information on how the content comming from or send to the rest service looks. I would like to enrich this documentation with a json schema so it is clear to the user what should be send or received.

If there are multiple ways of creating static documentation than would you be so kind to give me an inside on one of them. If there is a better approuch than using swagger-maven-plugin than I am willing to use that. For example can I let the swagger-core run over my source code and let it generate the static html pages? or can it run over my source code to generate the swagger.json and than I can use the swagger2markup-maven-plugin to generate the asciidoc? Can I use swagger2markup-maven-plugin to analyze my source instead of expecting to use an existing swagger.json.




calde...@yahoo.com

unread,
Jan 20, 2017, 2:37:59 PM1/20/17
to swagger-sw...@googlegroups.com

--------------------------------------------
On Fri, 1/20/17, Patrick Verboom <p.ve...@ayeq-benu.com> wrote:

Subject: Re: swagger jax-rs post json body as string
To: "Swagger" <swagger-sw...@googlegroups.com>
Date: Friday, January 20, 2017, 10:41 AM
--

You received this message because you are subscribed to the
Google Groups "Swagger" group.

To unsubscribe from this group and stop receiving emails
from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
ite de modernizare punandu:se in lumina foarte clar raportul dintre national

tony tam

unread,
Jan 20, 2017, 3:47:18 PM1/20/17
to Swagger
I don't think what you're asking for is really possible

frazierj...@yahoo.com

unread,
Jan 21, 2017, 3:39:09 AM1/21/17
to swagger-sw...@googlegroups.com

--------------------------------------------
On Fri, 1/20/17, tony tam <feh...@gmail.com> wrote:

Subject: Re: swagger jax-rs post json body as string
To: "Swagger" <swagger-sw...@googlegroups.com>
Date: Friday, January 20, 2017, 10:47 PM
--

You received this message because you are subscribed to the
Google Groups "Swagger" group.

To unsubscribe from this group and stop receiving emails
from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
1 mai - Tratatul de pace de la Pretoria pune capat razboiului intre Anglia si bun - Tratat naval intre Japonia si Anglia29 mart 11 apr - Legea bancilor populare satesti si a Casei lor Centrale Disensiuni in Partidul National Liberal

frazierj...@yahoo.com

unread,
Jan 21, 2017, 9:33:06 PM1/21/17
to swagger-sw...@googlegroups.com

--------------------------------------------
On Sat, 1/21/17, frazierjanice629 via Swagger <swagger-sw...@googlegroups.com> wrote:

Subject: Re: swagger jax-rs post json body as string
To: swagger-sw...@googlegroups.com
Date: Saturday, January 21, 2017, 10:36 AM
n iarna 1801 1802 trupele pasei de Vidin Pasvan Oglu prada Oltenia. Craiova este arsa Manaf Ibrahim aghiotantul pasei amintite distruge Tg. Jiu. Panica provocata in randurile populatiei locale este cvasigenerala. insusi M hai sutu aflat la a treia domnie in tara Romaneasca ultima in anii 1801-1802 paraseste tronul. Ca urmare timp de cateva luni domnul Moldovei Alexandru sutu 1801-1802 indeplineste si functia de caimacam pentru principatul de la sud de Milcov. in aceasta perioada numeroase familii de mari boieri de la miazazi de Carpati - Brancoveanu Campineanu Dudescu Ghica Obedeanu stirbei s.a. - trecusera muntii refugiindu-se la Sibiu si Brasov. Din ultimul centru urban mentionat reprezentantii lor se adreseaza lui Napoleon Bonaparte solicitand protectie impotriva talhariilor turcesti .
Reply all
Reply to author
Forward
0 new messages