-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve support for generating aggregated inlined objects (#264)
Fabrikt now supports inlined definitions of aggregated objects > 1. For example: ``` Dog: type: object properties: walker: allOf: - $ref: "#/components/schemas/Person" - $ref: "#/components/schemas/Company" ``` Support is preserved for the special case where the aggregation is over a single schema. Highlighted by the API supplied in Issue #262
- Loading branch information
Showing
5 changed files
with
62 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/test/resources/examples/inlinedAggregatedObjects/models/Models.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package examples.inlinedAggregatedObjects.models | ||
|
||
import com.fasterxml.jackson.`annotation`.JsonProperty | ||
import javax.validation.Valid | ||
import javax.validation.constraints.NotNull | ||
import kotlin.String | ||
|
||
public data class Company( | ||
@param:JsonProperty("companyName") | ||
@get:JsonProperty("companyName") | ||
@get:NotNull | ||
public val companyName: String, | ||
) | ||
|
||
public data class Dog( | ||
@param:JsonProperty("owner") | ||
@get:JsonProperty("owner") | ||
@get:Valid | ||
public val owner: Person? = null, | ||
@param:JsonProperty("walker") | ||
@get:JsonProperty("walker") | ||
@get:Valid | ||
public val walker: DogWalker? = null, | ||
) | ||
|
||
public data class DogWalker( | ||
@param:JsonProperty("name") | ||
@get:JsonProperty("name") | ||
@get:NotNull | ||
public val name: String, | ||
@param:JsonProperty("companyName") | ||
@get:JsonProperty("companyName") | ||
@get:NotNull | ||
public val companyName: String, | ||
) | ||
|
||
public data class Person( | ||
@param:JsonProperty("name") | ||
@get:JsonProperty("name") | ||
@get:NotNull | ||
public val name: String, | ||
) |
24 changes: 0 additions & 24 deletions
24
src/test/resources/examples/singleAllOfProperty/models/Models.kt
This file was deleted.
Oops, something went wrong.