mobulum / npm-yo-generator-spring-boot-application-from-swagger

npm-yo-generator-spring-boot-application-from-swagger
MIT License
0 stars 2 forks source link

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

Installation

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

Using yarn (recommended):

$ yarn global add yo
$ yarn global add generator-spring-boot-application-from-swagger

Using npm:

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

Usage

$ yo spring-boot-application-from-swagger --help

Usage:
  yo spring-boot-application-from-swagger:app [options]

Options:
  -h,   --help                     # Print the generator's options and usage
        --skip-cache               # Do not remember prompt answers                        Default: false
        --skip-install             # Do not automatically install dependencies             Default: false
        --use-cli-defaults         # Use default values if not provided (will not prompt)
        --run-gradle-build         # Run build gradle on generated project
        --base-package-name        # Enter default base package name:                      Default: com.mobulum
        --base-name                # Enter base name of app:                               Default: app
        --controller-class-suffix  # Enter controller class suffix:                        Default: Controller
        --api-path                 # Path (or URL) to swagger document:                    Default: https://raw.githubusercontent.com/mobulum/example-spring-boot-application-from-swagger/master/pet-store-swagger.json

Generate your (new) project

In default (questions) mode

$ 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

Passing values to command line

$ yo spring-boot-application-from-swagger \
  --base-package-name=com.example \
  --base-name=apps \
  --controller-class-suffix=Ctrl \
  --api-path=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

License

MIT © mobulum.com