• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Spring_Swagger

 
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I am learning how to integrate Swagger with Spring Boot. I have read the "whole" internet but there are some gaps in my code.

On the one hand, I use SpringFox annotations and it generates a Swagger UI I can use in the browser.

Then I use an application.yaml file which includes  this code I customized form an internet example:


Here is when I get lost, I have read about Swagger "contracts". It looks like if it would suggest to generate the Swagger output by reading the .yaml file?
 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay the previous .yaml was pretty incomplete. Now I have a proper one for make post, get etc..
The thing now is that the codegen doesnt reach the file and doesnt generate any interfaces...
 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After place the swagger-codegen-cli.jar in the root project folder. It generates the output with the command

 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally by using  the next command



I get a bunch of classes, Gradle files, documentation, but what I am searching for  the interfaces of the classes in the package.name.

Can someone see waht I am missing?
 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this YAML file it is specified where objects are generated but how interfaces could specified there?

 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This http://ridingthecrest.com/blog/2017/03/07/hello-apiary-swagger.html brings some of light
 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When located in the project folder the next command is not found

 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lets say that in the tree project structure I have 3 file supporting swagger. It doesnt find any. In Maven there is also code for Swagger dependencies.

 
Angus Ferguson
Ranch Hand
Posts: 1402
3
Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay it has beed all fixed just by customizing the pom.xml.

There another issue which looks a bit complex I think.

I have a Spring Boot controller implementing an interface. Okay, so on the other hand by using Maven and Swagger I am generating sources  based in a .YAML file.

The thing is that it generates propery the interface automatically but with the generated controller it only writes the  @Controller and signature without implementation. Also, in the swagger-ignore file it is not reference to avoid implementing them.



I would like :

1) Generate the controller once myself and dont override it but only when I modify the .YAML so it automatically recognizes the changes.

2) Generate it always taking way the old one an replacing it?

Is someone who has experience with this cases?
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic