All Projects → kokuwaio → micronaut-openapi-codegen

kokuwaio / micronaut-openapi-codegen

Licence: Apache-2.0 License
OpenAPI codegen for Micronaut

Programming Languages

java
68154 projects - #9 most used programming language
Mustache
554 projects

Projects that are alternatives of or similar to micronaut-openapi-codegen

Nswag
The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
Stars: ✭ 4,825 (+18457.69%)
Mutual labels:  openapi, codegen
Guardrail
Principled code generation from OpenAPI specifications
Stars: ✭ 396 (+1423.08%)
Mutual labels:  openapi, codegen
modelina
Library for generating data models based on inputs such as AsyncAPI, OpenAPI, or JSON Schema documents.
Stars: ✭ 55 (+111.54%)
Mutual labels:  openapi, codegen
ogen
OpenAPI v3 code generator for go
Stars: ✭ 436 (+1576.92%)
Mutual labels:  openapi, codegen
Swagger Node Codegen
An OpenAPI 3.x/Swagger 2 code generator for Node.js
Stars: ✭ 189 (+626.92%)
Mutual labels:  openapi, codegen
Swagger Axios Codegen
swagger client to use axios and typescript
Stars: ✭ 143 (+450%)
Mutual labels:  openapi, codegen
Openapi Typescript Codegen
NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification
Stars: ✭ 249 (+857.69%)
Mutual labels:  openapi, codegen
CreateAPI
Delightful code generator for OpenAPI specs
Stars: ✭ 176 (+576.92%)
Mutual labels:  openapi, codegen
Openapi Codegen
OpenAPI 3.0 CodeGen plus Node.js minus the Java and emojis
Stars: ✭ 224 (+761.54%)
Mutual labels:  openapi, codegen
sbt-guardrail
Principled code generation from OpenAPI specifications
Stars: ✭ 24 (-7.69%)
Mutual labels:  openapi, codegen
easybundler
A code generator for Android Bundles
Stars: ✭ 53 (+103.85%)
Mutual labels:  codegen
openapi
OpenAPI (fka Swagger) spec renderer for Sphinx.
Stars: ✭ 78 (+200%)
Mutual labels:  openapi
fhir-fuel.github.io
Place to prepare proposal to FHIR about JSON, JSON-Schema, Swagger/OpenAPI, JSON native databases and other JSON-frendly formats (yaml, edn, avro, protobuf etc) and technologies
Stars: ✭ 20 (-23.08%)
Mutual labels:  openapi
openapi-generator-for-spring
Open API v3 Generator for Spring Boot applications
Stars: ✭ 54 (+107.69%)
Mutual labels:  openapi
PostgREST-writeAPI
Translate your OpenAPI specification into a NGinx config-file to implement your PostgREST system
Stars: ✭ 31 (+19.23%)
Mutual labels:  openapi
openapi-lint-vscode
OpenAPI 2.0/3.0.x intellisense, validator, linter, converter and resolver extension for Visual Studio Code
Stars: ✭ 47 (+80.77%)
Mutual labels:  openapi
invest-openapi-go-sdk
No description or website provided.
Stars: ✭ 158 (+507.69%)
Mutual labels:  openapi
genqlient
a truly type-safe Go GraphQL client
Stars: ✭ 532 (+1946.15%)
Mutual labels:  codegen
les
Go directly from an event storming to a working API: Event Markdown / Markup validation & NodeJS CQRS/ES application builder.
Stars: ✭ 48 (+84.62%)
Mutual labels:  openapi
kompendium
Ktor OpenAPI Spec Generator
Stars: ✭ 46 (+76.92%)
Mutual labels:  openapi

Micronaut Codegen

WIP: rework for verions 3.x.

Features

  • generate api interfaces (see declarative client)
  • generate model objects with fluent and property accessors
  • generate interfaces for api tests based on method name and return code
  • generate client interfaces with micronaut clientId
  • add validation annotations

Config options

  • clientId: id for generated clients (if no client id is provided no interface will be generated)
  • introspected: add @io.micronaut.core.annotation.Introspected to models (default true)
  • dateTimeRelaxed: add type registrar for relaxed time converter (default true)
  • useBeanValidation: generate validation annotations (default true)
  • useGenericResponse: return generic container or specific model, e.g. Model vs. HttpResponse<Model> (default true)
  • useOptional: optional parameters are generated as java.util.Optional (default true)
  • useJavaxGenerated: add @javax.annotation.processing.Generated to all classes (default true)
  • useLombokGenerated: add @lombok.Generated to all classes (default false), useful for jacoco
  • jacksonDatabindNullable: add container JsonNullable to model objects that are nullable (default true)
  • supportAsync: use reactivex return types, see Reactive HTTP Request Processing
  • useReferencedSchemaAsDefault: use the referenced schema's type for instantiation of default values
  • visitable: generate visitor for subtypes with a discriminator (default true)
  • pagable: generate provider for pagable (default false)

Null handling and default values

Jackson Inclusions:

  • required=true & nullable=false: JsonInclude.ALWAYS
  • required=true & nullable=true: JsonInclude.ALWAYS
  • required=false & nullable=false: JsonInclude.NON_ABSENT
  • required=false & nullable=true: JsonInclude.NON_NULL

Container (array/map):

  • required=true & nullable=false: empty containers are set as default value
  • required=true & nullable=true: containers have no default value
  • required=false & nullable=false: containers have no default value
  • required=false & nullable=true: containers have no default value

If jacksonDatabindNullable=true is configured always JsonNullable.undefined() is set.

Do not forget to add the dependency to pom.xml:

<dependency>
 <groupId>org.openapitools</groupId>
 <artifactId>jackson-databind-nullable</artifactId>
 <version>0.2.1</version>
</dependency>

And register Jackson Module:

@Factory
public class ApplicationFactory {

 @Singleton
 JsonNullableModule jsonNullableModule() {
  return new JsonNullableModule();
 }
}

Not supported

  • no project (e.g. pom.xml) is generated, only interfaces to implement
  • no support for java <11

Build & Release

Test

Run single test:

mvn verify -Dinvoker.parallelThreads=1 -Dinvoker.streamLogs=true -Dinvoker.test=basic

Dependency updates

Display dependency updates:

mvn versions:display-property-updates -U

Update dependencies:

mvn versions:update-properties

Release locally

Run:

mvn release:prepare release:perform release:clean -B

cls && rm -rf target/it/test-api/target target/it/test-api/bin target/it/test-api/build.log target/it/test-api/target target/it/test-api-novalidation/bin target/it/test-api-novalidation/build.log && cp -r target/it/test-api src/it | mvn verify -DskipTests -Dinvoker.parallelThreads=1 -Dinvoker.streamLogs=true -Dinvoker.test=test-api

todo:

  • api security
  • async reactor / rx

bugs:

  • optional body

  • void with 404

  • api validation - annoation inheritance

  • optional body

  • void with 404

  • api validation - annoation inheritance

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