node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

generator-spring-boot-application-from-swagger

generator-spring-boot-application-from-swagger

NPM version Build Status Dependency Status Coverage percentage

Yeoman spring boot mvc application generator from swagger api specification

Work in progress

  • Generate RestControllers
  • Generate RestControllers specs
  • Generate RestControllers integration specs
  • Generate model classes (pojos) in api module
  • Generate gradlew wrapper
  • Generate simple application.yml
  • Generate Application.java spring boot starter
  • More tests for generator code (coverage)
  • Migrate to yeoman-generator 1.x.x
  • Switch to es6
  • Yeoman arguments support
  • Kotlin support (poc)
  • Added (base) swagger support (by io.springfox)
  • Swagger documentation support for generated code (@ApiModel, @ApiOperation)
  • Ask for spring boot version
  • Add metrics support (@Timed)
  • Split generator to more actions

Installation

First, install Yeoman and generator-spring-boot-application-from-swagger using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-spring-boot-application-from-swagger

Then generate your new project:

yo spring-boot-application-from-swagger
 
? Enter default base package name: com.mobulum
? Enter base name of app: app
? Enter controller class suffix: Controller
? Path (or URL) to swagger document: https://raw.githubusercontent.com/mobulum/example-spring-boot-application-from-swagger/master/pet-store-swagger.json

Example of generated file structure based on defaults

├── api
│   ├── build.gradle
│   └── src
│       ├── integrationTest
│       │   └── groovy
│       │       └── com
│       │           └── mobulum
│       │               └── api
│       ├── main
│       │   ├── java
│       │   │   └── com
│       │   │       └── mobulum
│       │   │           └── api
│       │   │               └── model
│       │   │                   ├── Category.java
│       │   │                   ├── ErrorInfoResponse.java
│       │   │                   ├── Order.java
│       │   │                   ├── OrderStatus.java
│       │   │                   ├── Pet.java
│       │   │                   ├── PetStatus.java
│       │   │                   ├── Tag.java
│       │   │                   ├── UploadResponse.java
│       │   │                   └── User.java
│       │   └── resources
│       └── test
│           └── groovy
│               └── com
│                   └── mobulum
│                       └── api
├── build.gradle
├── gradle
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── service
│   ├── build.gradle
│   └── src
│       ├── integrationTest
│       │   └── groovy
│       │       └── com
│       │           └── mobulum
│       │               └── service
│       │                   ├── ApplicationIntegrationSpec.groovy
│       │                   └── rest
│       │                       └── controllers
│       │                           ├── AbstractRestControllerIntegrationSpec.groovy
│       │                           ├── V2PetControllerIntegrationSpec.groovy
│       │                           ├── V2StoreControllerIntegrationSpec.groovy
│       │                           └── V2UserControllerIntegrationSpec.groovy
│       ├── main
│       │   ├── java
│       │   │   └── com
│       │   │       └── mobulum
│       │   │           └── service
│       │   │               ├── Application.java
│       │   │               └── rest
│       │   │                   └── controllers
│       │   │                       ├── V2PetController.java
│       │   │                       ├── V2StoreController.java
│       │   │                       └── V2UserController.java
│       │   └── resources
│       │       └── application.yml
│       └── test
│           └── groovy
│               └── com
│                   └── mobulum
│                       └── service
│                           └── rest
│                               └── controllers
│                                   ├── V2PetControllerSpec.groovy
│                                   ├── V2StoreControllerSpec.groovy
│                                   └── V2UserControllerSpec.groovy
└── settings.gradle
 
45 directories, 31 files

Getting To Know Yeoman

  • Yeoman has a heart of gold.
  • Yeoman is a person with feelings and opinions, but is very easy to work with.
  • Yeoman can be too opinionated at times but is easily convinced not to be.
  • Feel free to learn more about Yeoman.

License

MIT © Zenedith