Skip to content

Commit

Permalink
Merge branch 'master' into ktor-server-3.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbooms authored Nov 27, 2024
2 parents 219c780 + f4faf06 commit b87c0bf
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 8 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [Gradle w/ custom task](#gradle-w-custom-task)
* [Gradle w/ plugin](#gradle-w-plugin)
* [Maven](#maven)
* [Getting the Most from Fabrikt](#getting-the-most-from-fabrikt)
* [Configuration Options](#configuration-options)
* [Building Locally](#building-locally)
* [Publishing](#publishing)
Expand Down Expand Up @@ -166,6 +167,17 @@ fabrikt {

The [exec-maven-plugin](http://www.mojohaus.org/exec-maven-plugin/examples/example-exec-using-plugin-dependencies.html) is capable of downloading the Fabrikt library from Maven Central and executing its main method with defined arguments.

## Getting the Most from Fabrikt

### 1. Prefer components to inline schemas
While inline schemas are perfectly valid they are not supported by Fabrikt in all circumstances.
This is especially true for request bodies and non-trivial parameters. Instead, define your schemas in the
components section of the OpenAPI spec (`components.parameters` & `components.requestBodies`). [#20](https://github.com/cjbooms/fabrikt/issues/20), [#187](https://github.com/cjbooms/fabrikt/issues/187)

### 2. Use `oneOf` with discriminator for polymorphism
`oneOf` along with the flag `SEALED_INTERFACES_FOR_ONE_OF` will generate polymorphic models with sealed interfaces.
The `discriminator` property is used by Fabrikt to determine the subtypes to be generated.

## Configuration Options

This section documents the available CLI parameters for controlling what gets generated. This documentation is generated using: `./gradlew printCodeGenUsage`
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.dokka.gradle.DokkaTask

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.20" // Apply the Kotlin JVM plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "2.0.20"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("org.jetbrains.dokka") version "1.8.10"
id("com.palantir.git-version") version "3.0.0"
Expand Down Expand Up @@ -40,8 +40,8 @@ allprojects {

val jacksonVersion by extra { "2.15.1" }
val junitVersion by extra { "5.9.2" }
val kotlinxSerializationVersion by extra { "1.6.3" }
val ktorVersion by extra { "3.0.1" }
val kotlinxSerializationVersion by extra { "1.7.3" }
val kotlinxDateTimeVersion by extra { "0.6.1" }

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion end2end-tests/ktor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sourceSets {
}

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.20" // Apply the Kotlin JVM plugin to add support for Kotlin.
kotlin("jvm")
}

java {
Expand Down
2 changes: 1 addition & 1 deletion end2end-tests/models-jackson/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sourceSets {
}

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.20" // Apply the Kotlin JVM plugin to add support for Kotlin.
kotlin("jvm")
}

java {
Expand Down
4 changes: 2 additions & 2 deletions end2end-tests/models-kotlinx/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ sourceSets {
}

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.20" // Apply the Kotlin JVM plugin to add support for Kotlin.
kotlin("plugin.serialization") version "1.8.20"
kotlin("jvm")
kotlin("plugin.serialization") version "2.0.20"
}

java {
Expand Down
2 changes: 1 addition & 1 deletion end2end-tests/okhttp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sourceSets {
}

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.20" // Apply the Kotlin JVM plugin to add support for Kotlin.
kotlin("jvm")
}

java {
Expand Down
2 changes: 1 addition & 1 deletion end2end-tests/openfeign/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sourceSets {
}

plugins {
id("org.jetbrains.kotlin.jvm") version "1.8.20" // Apply the Kotlin JVM plugin to add support for Kotlin.
kotlin("jvm")
}

java {
Expand Down

0 comments on commit b87c0bf

Please sign in to comment.