All Projects → lagom → sbt-lagom-descriptor-generator

lagom / sbt-lagom-descriptor-generator

Licence: Apache-2.0 license
Lagom API code generator

Programming Languages

scala
5932 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to sbt-lagom-descriptor-generator

lagom-openapi
OpenAPI/Swagger module for Lagom
Stars: ✭ 34 (+47.83%)
Mutual labels:  openapi, lagom
loopback-next
LoopBack makes it easy to build modern API applications that require complex integrations.
Stars: ✭ 4,412 (+19082.61%)
Mutual labels:  openapi
MinimalApi
ASP.NET Core 7.0 - Minimal API Example - Todo API implementation using ASP.NET Core Minimal API, Entity Framework Core, Token authentication, Versioning, Unit Testing, Integration Testing and Open API.
Stars: ✭ 156 (+578.26%)
Mutual labels:  openapi
arcus.webapi
Web API development with Microsoft Azure in a breeze.
Stars: ✭ 19 (-17.39%)
Mutual labels:  openapi
OpenAPI-Viewer
OpenApi viewer Implemented using Vue
Stars: ✭ 93 (+304.35%)
Mutual labels:  openapi
reedelk-runtime
Reedelk Runtime Platform Community Edition
Stars: ✭ 25 (+8.7%)
Mutual labels:  openapi
specifications-ITS-REST
openEHR REST API Specifications
Stars: ✭ 20 (-13.04%)
Mutual labels:  openapi
php-pesa
Open payment integration toolkit for PHP
Stars: ✭ 26 (+13.04%)
Mutual labels:  openapi
openapi-definitions
OpenAPI Definitions
Stars: ✭ 30 (+30.43%)
Mutual labels:  openapi
aliyun-openapi-sdk-net-core
aliyun open api sdk for .net core 2.0
Stars: ✭ 17 (-26.09%)
Mutual labels:  openapi
nest-rest-typeorm-boilerplate
🍱 backend with nest (typescript), typeorm, and authentication
Stars: ✭ 142 (+517.39%)
Mutual labels:  openapi
flink-client
Java library for managing Apache Flink via the Monitoring REST API
Stars: ✭ 48 (+108.7%)
Mutual labels:  openapi
cube
Common LISP Kubernetes Client
Stars: ✭ 33 (+43.48%)
Mutual labels:  openapi
aws2openapi
Amazon Web Services API description to OpenAPI 3.0 definition
Stars: ✭ 45 (+95.65%)
Mutual labels:  openapi
daf-dataportal-backend
Backend per il nuovo frontend (in sviluppo) di dati.gov.it
Stars: ✭ 17 (-26.09%)
Mutual labels:  openapi
portman
Port OpenAPI Specs to Postman Collections, inject test suite and run via Newman 👨🏽‍🚀
Stars: ✭ 530 (+2204.35%)
Mutual labels:  openapi
tinyspec
Simple syntax for describing REST APIs
Stars: ✭ 95 (+313.04%)
Mutual labels:  openapi
awesome-integration
A curated list of awesome system integration software and resources.
Stars: ✭ 117 (+408.7%)
Mutual labels:  openapi
yaml-include
Valid, modular YAML documents with js-yaml. Seriously.
Stars: ✭ 39 (+69.57%)
Mutual labels:  openapi
openapi-viewer
Browse and test a REST API described with the OpenAPI 3.0 Specification
Stars: ✭ 85 (+269.57%)
Mutual labels:  openapi

Build Status

sbt-lagom-descriptor-generator

An sbt plugin to generate Lagom Service Descriptor code (and related entities) provided a Swagger/OpenAPI specification.

Usage

Include the plugin dependency on your project/plugins.sbt file:

addSbtPlugin("com.lightbend.lagom" % "lagom-descriptor-generator-sbt-plugin" % "0.0.2")

and enable the plugin on your project in build.sbt:

lazy val ``service-api = (project in file("service-api"))
  .enablePlugins(LagomJava && LagomOpenApiPlugin)
  .settings(
    libraryDependencies ++=
      Seq(
        lagomJavadslApi
      )
  )

The plugin will trigger the Java or Scala code generation depending on the dependencies included in your code.

Project Status

DISCLAIMER Currently the build job in Travis fails. Solve #20 to fix that.

This plugin is not ready for production. It currently works in most happy scenarios when given one or many JSON or YAML OpenAPI V2 specification files. There is a minimal set of scripted tests (1, 2, 3) demonstrating the basic functionality available.

Project Structure

This project provides an sbt plugin that will generate the Lagom Service Descriptor given a 3rd party API specification. It works by detecting the dependency of the project on Lagom and also the Java vs Scala API. Once the plugin is activated it will locate all 3rd party specification files and proceed with the code genreations.

  • lagom-descriptor-generator-sbt-plugin: the code for the sbt plugin. This project also contains the scripted tests.

  • runner/: an entry point to all valid combinations of specs and generated formats. See for example how the actual sbt plugin code uses the LagomGenerators. runner/ also includes integration tests which run faster than scripted.

  • spec-parsers/: contains each of the 3rd party specicication parsers. Implementors of a new format should create a project in this directory providing an implementation of Parser[T].

  • lagom-renderers/: given an intermediate representation of an API and the models used in it these generate LagomJava and LagomScala code.

  • generator-api/: all modelling required for the generator. The key part is generate() which is a function of type InputStream => Spec => Service => Service => Output. That is a 4 step tranformation: going through the specification file to the 3rd party specification representation, then the intermediate representation (API and models) and finally the Output which represents the filenames and code contents before persisting into actual files. The intermediate step Service => Service is meant to allow users to inject transformations over the intermediate representation (e.g. to map JSON Schema's dateTime to org.joda.time.Instant instead of java.time.Instant). See other potential applications of this transformation on the issues list.

Supported Specs

OpenAPI V2 placing JSON or YAML OpenAPI V2 files in a project's src/main/openapi will generate the required code to represent that spec using Lagom code. See the scripted tests for an example.

Supporting new spec formats would require:

  • a new project on spec-parsers/ providing an implementation of Parser[T]
  • convenience methods for java and scala code generation on LagomGenerators
  • a comprehensive test set (unit tests on parsing, integration tests in runner/ and scripted tests demonstrating the complete run of the parser in an sbt project on the lagom-descriptor-generator-sbt-plugin project)

Contributions & Maintainers

This project does not have contributors, it only has maintainers—frequent and infrequent—and everyone helps out. This repo loves new maintainers as well as old maintainers. :-) The Lagom core team keeps an eye on the project to assure its overall coherence but does not fully support this sbt plugin.

Contributions are very welcome, see CONTRIBUTING.md or skim existing tickets to see where you could help out.

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].