• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

Spring_Swagger  RSS feed

 
Ranch Hand
Posts: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • 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: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • 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: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • 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: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • 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: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • 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: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • 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: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

 
Angus Ferguson
Ranch Hand
Posts: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • 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: 1319
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • 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?
 
Let nothing stop you! Not even this tiny ad:
global solutions you can do at home or in your backyard
https://www.kickstarter.com/projects/paulwheaton/better-world-boo
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!