All Projects → guardrail-dev → sbt-guardrail

guardrail-dev / sbt-guardrail

Licence: MIT license
Principled code generation from OpenAPI specifications

Programming Languages

scala
5932 projects
shell
77523 projects

Projects that are alternatives of or similar to sbt-guardrail

Guardrail
Principled code generation from OpenAPI specifications
Stars: ✭ 396 (+1550%)
Mutual labels:  akka-http, dropwizard, openapi, codegen
Nswag
The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
Stars: ✭ 4,825 (+20004.17%)
Mutual labels:  openapi, codegen
Openapi Typescript Codegen
NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification
Stars: ✭ 249 (+937.5%)
Mutual labels:  openapi, codegen
Openapi Codegen
OpenAPI 3.0 CodeGen plus Node.js minus the Java and emojis
Stars: ✭ 224 (+833.33%)
Mutual labels:  openapi, codegen
micronaut-openapi-codegen
OpenAPI codegen for Micronaut
Stars: ✭ 26 (+8.33%)
Mutual labels:  openapi, codegen
modelina
Library for generating data models based on inputs such as AsyncAPI, OpenAPI, or JSON Schema documents.
Stars: ✭ 55 (+129.17%)
Mutual labels:  openapi, codegen
Swagger Node Codegen
An OpenAPI 3.x/Swagger 2 code generator for Node.js
Stars: ✭ 189 (+687.5%)
Mutual labels:  openapi, codegen
sbt-openapi-schema
Generate schema sources for Scala, Java and Elm from an openapi 3.0 spec.
Stars: ✭ 12 (-50%)
Mutual labels:  openapi, sbt-plugin
Tapir
tapir, or Typed API descRiptions
Stars: ✭ 677 (+2720.83%)
Mutual labels:  akka-http, openapi
Endpoints4s
Scala library to define HTTP-based communication protocols
Stars: ✭ 331 (+1279.17%)
Mutual labels:  akka-http, openapi
CreateAPI
Delightful code generator for OpenAPI specs
Stars: ✭ 176 (+633.33%)
Mutual labels:  openapi, codegen
ogen
OpenAPI v3 code generator for go
Stars: ✭ 436 (+1716.67%)
Mutual labels:  openapi, codegen
Swagger Axios Codegen
swagger client to use axios and typescript
Stars: ✭ 143 (+495.83%)
Mutual labels:  openapi, codegen
Hikaku
A library that tests if the implementation of a REST-API meets its specification.
Stars: ✭ 154 (+541.67%)
Mutual labels:  dropwizard, openapi
influencer-stats
Playground for measuring performance of functional programming tools in Scala. Gathers statistics about videos.
Stars: ✭ 24 (+0%)
Mutual labels:  akka-http, http4s
swakka
A Scala library for creating Swagger definitions in a type-safe fashion wth Akka-Http
Stars: ✭ 74 (+208.33%)
Mutual labels:  akka-http, openapi
slicebox
Microservice for safe sharing and easy access to medical images
Stars: ✭ 18 (-25%)
Mutual labels:  akka-http
dropwizard-swagger
a Dropwizard bundle that serves Swagger UI static content and loads Swagger endpoints.
Stars: ✭ 176 (+633.33%)
Mutual labels:  dropwizard
openapi-generator-go
An opinionated OpenAPI v3 code generator for Go. Use this to generate API models and router scaffolding.
Stars: ✭ 42 (+75%)
Mutual labels:  openapi
main
Mocks Server monorepo
Stars: ✭ 109 (+354.17%)
Mutual labels:  openapi

sbt-guardrail sbt-guardrail | Join the chat at https://gitter.im/guardrail-dev/guardrail

An SBT plugin for adding clients and servers generated by guardrail to your service.

Installation

Check out the docs

project/plugins.sbt

addSbtPlugin("dev.guardrail" % "sbt-guardrail" % "<Please use the latest available release!>")

build.sbt

/* Available arguments:
    specPath: java.io.File
    pkg: String
    dto: String
    framework: String
    modules: List[String]
    tracing: Boolean
    imports: List[String]
    encodeOptionalAs: Option[CodingConfig]
    decodeOptionalAs: Option[CodingConfig]
*/
guardrailTasks in Compile := List(
  ScalaClient(file("petstore.yaml")),
  ScalaClient(file("github.yaml"), pkg="com.example.clients.github"),
  ScalaClient(file("github.yaml"), pkg="com.example.clients.github", 
              encodeOptionalAs = codingOptional,
              decodeOptionalAs = codingRequiredNullable),
  ScalaServer(file("myserver.yaml"), pkg="com.example.server", tracing=true),
  ScalaModels(file("myserver.yaml"), pkg="com.example.models"),
  JavaClient(file("github.yaml"), pkg="com.example.clients.github")
  ...
)

Alternatively use the guardrailDiscoveredOpenApiFiles setting to automatically discover OpenAPI spec files under src/main/openapi or src/test/openapi (see the test for full example):

Compile / guardrailTasks := (Compile / guardrailDiscoveredOpenApiFiles).value.flatMap { openApiFile =>
  List(          
    ScalaClient(openApiFile.file, pkg = openApiFile.pkg, framework = "http4s"),
    ScalaServer(openApiFile.file, pkg = openApiFile.pkg, framework = "http4s")
  )
}
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].