Fred Friis
05/20/2024, 7:22 PMFred Friis
05/20/2024, 7:22 PMAddress:
type: object
description: Represents the info related to a standardized address.
required:
- address1
- city
- state
- zipCode
properties:
address1:
type: string
description: The first line of the street address.
minLength: 1
maxLength: 255
it generates an object like this
data class Address (
/* The first line of the street address. */
@field:JsonProperty("address1")
val address1: kotlin.String, // note, no validation annotations
we then use it like this
@POST
@Path("/calculate-taxes")
@Consumes(MediaType.APPLICATION_JSON)
@ServiceMachineAuthorization(
scopes = ["orders-pricing.tax:calculate"],
scopeCheckType = ScopeCheckType.ANY_OF
)
fun calculateTaxes(@NotNull @Valid taxableOrder: TaxableOrder): Response { //has address object in it
...
}
but if I hit the endpoint with an address
{
address1: "string that is above 255 chars long"
}
DropWizard doesn't fail the request, it lets it through
= is there any way to make DropWizard and openapi object generators work as far as validation goes?kqr
05/22/2024, 7:11 AM