All Projects → fralken → Sbt Swagger Codegen

fralken / Sbt Swagger Codegen

Licence: apache-2.0
sbt Plugin for Scala code generation for Swagger specs

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to Sbt Swagger Codegen

Go Tgbot
Golang telegram bot API wrapper, session-based router and middleware
Stars: ✭ 90 (-13.46%)
Mutual labels:  swagger
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-7.69%)
Mutual labels:  swagger
Swagger Github Pages
How to host Swagger API documentation with GitHub Pages
Stars: ✭ 102 (-1.92%)
Mutual labels:  swagger
Api Client Generator
Angular REST API client generator from Swagger YAML or JSON file with camel case settigs
Stars: ✭ 92 (-11.54%)
Mutual labels:  swagger
Swaggman
OpenAPI Spec SDK and Converter for OpenAPI 3.0 and 2.0 Specs to Postman 2.0 Collections. Example RingCentral spec included.
Stars: ✭ 94 (-9.62%)
Mutual labels:  swagger
Koa Oai Router
Koa Router, based on OpenAPI, Swagger and Json Schema.
Stars: ✭ 97 (-6.73%)
Mutual labels:  swagger
Openapi.net.odata
Generates OpenAPI document from OData CSDL
Stars: ✭ 90 (-13.46%)
Mutual labels:  swagger
Swagger Test
Specification-driven REST API testing
Stars: ✭ 102 (-1.92%)
Mutual labels:  swagger
Node Typescript Mongodb
node js typescript mongodb express generator yo
Stars: ✭ 96 (-7.69%)
Mutual labels:  swagger
Flyway Sbt
Flyway SBT plugin
Stars: ✭ 101 (-2.88%)
Mutual labels:  sbt-plugin
Swagger Scala Module
Swagger support for scala
Stars: ✭ 93 (-10.58%)
Mutual labels:  swagger
Swurg
Parse OpenAPI documents into Burp Suite for automating OpenAPI-based APIs security assessments (approved by PortSwigger for inclusion in their official BApp Store).
Stars: ✭ 94 (-9.62%)
Mutual labels:  swagger
Springboot Templates
springboot和dubbo、netty的集成,redis mongodb的nosql模板, kafka rocketmq rabbit的MQ模板, solr solrcloud elasticsearch查询引擎
Stars: ✭ 100 (-3.85%)
Mutual labels:  swagger
Testing Hapi
Hapi style guide compliant boilerplate (updated to v17!)
Stars: ✭ 90 (-13.46%)
Mutual labels:  swagger
Swagger Express Ts
Generate and serve swagger.json
Stars: ✭ 102 (-1.92%)
Mutual labels:  swagger
Scalac Profiling
Implementation of SCP-010.
Stars: ✭ 90 (-13.46%)
Mutual labels:  sbt-plugin
Kaizen Openapi Editor
Eclipse Editor for the Swagger-OpenAPI Description Language
Stars: ✭ 97 (-6.73%)
Mutual labels:  swagger
Hapi Starter Kit
Hapi.js based REST boilerplate which uses latest ES7/ES8 features (async/await) with code coverage and follows best pratices
Stars: ✭ 103 (-0.96%)
Mutual labels:  swagger
Swagger Combine
Combines multiple Swagger schemas into one dereferenced schema.
Stars: ✭ 102 (-1.92%)
Mutual labels:  swagger
Apifuzzer
Fuzz test your application using your OpenAPI or Swagger API definition without coding
Stars: ✭ 101 (-2.88%)
Mutual labels:  swagger

SBT Swagger Code Generator

Overview

Like the official swagger-codegen this project aims to generate Scala source code from Swagger 2.0 Specification compliant API descriptions. Moreover, you can do it directly within an sbt project.

Compatibility

This code generator is designed specifically for Swagger Spec Version 2.0. Moreover, it relies on Play! Framework 2.7 for Json marshalling/unmarshalling, server- and client-side code.

Install

Current release is 0.0.12

If you want to try the latest version on master, first clone this project and publishLocal it.

Enable it inside your project\plugins.sbt like this:

addSbtPlugin("eu.unicredit" % "sbt-swagger-codegen" % "0.1.0-SNAPSHOT")

Enable it in your build.sbt like this:

enablePlugins(SwaggerCodegenPlugin)

Quick start

For a super fast hands-on tutorial refer to the related examples and check out sbt-swagger-codegen-examples.

How it works

By default, the plugin will assume that you have put your yaml Swagger specification files under src/main/swagger.

If so, then you can just run swaggerModelCodeGen task and it will generate your models as case classes and Play Framework Formats for them (for json serialization).

Tasks

All available tasks from the plugin

  • swaggerModelCodeGen -> generated code for model classes
  • swaggerServerCodeGen -> generates Play Framework code
  • swaggerClientCodeGen -> generates client code using play-ws
  • swaggerClean -> cleans up already generated code

The swaggerModelCodeGen, swaggerServerCodeGen and swaggerClientCodeGen will run automatically when the swagger sources change.

Keys (and defaults)

These keys influence properties of the generated code itself:

  • swaggerSourcesDir -> "/src/main/swagger" (path where to search for swagger files)
  • swaggerCodeGenPackage -> "swagger.codegen" (package name of the generated sources)
  • swaggerModelFileSplitting -> "oneFilePerSource" (in model generation how to group classes in '.scala' files available options are "oneFilePerSource" "oneFilePerModel")
  • swaggerCodeProvidedPackage -> "com.yourcompany" (where you will provide business logic server method implementation)

These keys determine where generated files will be put:

  • swaggerModelCodeTargetDir -> "target/scala-2.1x/src_managed/src/main/swagger/model" (path where to put generated model files)
  • swaggerClientCodeTargetDir -> "target/scala-2.1x/src_managed/src/main/swagger/client" (path where to put generated client code files)
  • swaggerServerCodeTargetDir -> "target/scala-2.1x/src_managed/src/main/swagger/server" (path where to put generated server code files)

These keys can be used to determine what kind of code should be generated:

  • swaggerGenerateModel -> true (to be disabled if you do not want model classes to be generated automatically when swagger source code changes)
  • swaggerGenerateJsonRW -> true (if you want to generate json Format for your model case classes)
  • swaggerGenerateClient -> false (enable this if you want client code to ge generated automatically when swagger source code changes)
  • swaggerGenerateServer -> false (enable this if you want client code to ge generated automatically when swagger source code changes)

Moreover, you can extend this plugin by providing alternative implementations of the generators via:

  • swaggerModelCodeGenClass -> new eu.unicredit.swagger.generators.DefaultModelGenerator() (the class used to generate the model classes)
  • swaggerJsonCodeGenClass -> new eu.unicredit.swagger.generators.DefaultJsonGenerator() (the class used to generate the json marshaller/unmarshaller)
  • swaggerServerCodeGenClass -> new eu.unicredit.swagger.generators.DefaultServerGenerator() (the class used to generate the Server classes)
  • swaggerClientCodeGenClass -> new eu.unicredit.swagger.generators.DefaultClientGenerator() (the class used to generate the client classes)

Dependencies

Limitations

At the moment the project is developed to fulfill some internal projects needs, so do not expect it to cover all the corner cases of the Swagger Spec (i.e. some primitive types in body req or resp).

The road ahead

We are actively working with and on this project, trying to overcome any arising limitations and support all Swagger-spec properties we need. PRs are really welcome and please open an Issue if you find that something is not working.

Authors

Acknowledgements

Thanks to Daniel Wunsch (@dwunsch), @dvirf and Reto Habluetzel (@rethab) for their valuable contributions.

*** This is a work in progress and we are not done with it! ***

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].