Skip to content

Conversation

Pgarrett
Copy link
Collaborator

API Specs with anyOf, oneOf and allOf now generate DTOs. For each of them, the resulting DTO is a merge of all the options in the spec

@Pgarrett Pgarrett marked this pull request as ready for review August 27, 2025 11:32
@Pgarrett Pgarrett requested a review from arcuri82 August 27, 2025 11:32
}
else -> {
throw IllegalStateException("Gene $primaryGene is not supported for DTO payloads")
val primaryGene = (it as BodyParam).primaryGene()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if the body is optional, and the primary gene is a wrapper OptionalGene?

is ObjectGene -> calculateDtoFromObject(gene, actionName)
is ArrayGene<*> -> calculateDtoFromArray(gene, actionName)
else -> {
throw IllegalStateException("Gene $gene is not supported for DTO payloads")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some more info to help debugging if it happens, eg put the actionName somewhere in this error message

if (template is ObjectGene) {
calculateDtoFromObject(template, actionName)
} else {
log.debug("Arrays of non custom objects are not collected as DTOs")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use a unique warn? LoggingUtil.uniqueWarn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants