GithubHelp home page GithubHelp logo

brandonschmitt / micronaut-openapi-codegen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kokuwaio/micronaut-openapi-codegen

0.0 0.0 0.0 302 KB

OpenAPI codegen for Micronaut

License: Apache License 2.0

Java 70.79% Mustache 29.21%

micronaut-openapi-codegen's Introduction

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), usefull 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

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

micronaut-openapi-codegen's People

Contributors

sschnabe avatar actions-user avatar krasv avatar mscheibler avatar wistefan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.