openapi-generator/samples/server/petstore/kotlin-server-required-and-nullable-properties
koenlavooij 5e5832d982
Javalin fixes and validation (#20981)
* Fix for problems when a nullable parameter has a default value

When a default value is present the parameter is moved to non-nullable. This works because we could replace the null with a default value. This will actually set the default value.

* Adds (optional) validation to the beans.

Option to set: `useBeanValidation` to `true`. This will insert validation rules from the `jakarta.validation` package much like it does with the spring generator.

Aso sneaked in `JsonProperty` annotations in order to more formally adhere to the name in the spec as opposed to configuring ObjectMappers in order to translate names to match the spec.

* Update samples

* Fix for required headerParams
2025-03-30 00:58:48 +08:00
..
2025-02-28 13:48:36 +08:00

org.openapitools.server - Kotlin Server library for Nullable Required

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Generated by OpenAPI Generator 7.13.0-SNAPSHOT.

Build

First, create the gradle wrapper script:

gradle wrapper

Then, run:

./gradlew check assemble

This runs all tests and packages the library.

Running

The server builds as a fat jar with a main entrypoint. To start the service, run java -jar ./build/libs/kotlin-server.jar.

You may also run in docker:

docker build -t kotlin-server .
docker run -p 8080:8080 kotlin-server

Features/Implementation Notes

  • Supports JSON inputs/outputs, File inputs, and Form inputs (see ktor documentation for more info).
  • Supports collection formats for query parameters: csv, tsv, ssv, pipes.
  • Some Kotlin and Java types are fully qualified to avoid conflicts with types defined in OpenAPI definitions.

Documentation for API Endpoints

All URIs are relative to /api/v3

Class Method HTTP request Description
DefaultApi addPet POST /pet

Documentation for Models

Documentation for Authorization

Endpoints do not require authorization.