Principled code generation from OpenAPI specifications. https://guardrail.dev/
required=false,nullable=true
requires it
ObjectMapper
from the route class
@Inject
one into the class...)
required=true,nullable=false
properties when a default is present. like, i could see the argument that a client could actually leave that property out entirely, because the server should know about the default, and automatically fall back (so these sorts of properties automatically get 'demoted' to required=false,nullable=false
). but maybe you want to think of it as more of a "UX default": the server will barf if you don't include it, and the default there is mainly to make it so the user of the client doesn't have to explicitly fill in the property (because the client can do it for them).
At the risk of making the wrong gut decision here, but required=true,nullable=false
with a default should have the default injected by the server before the user sees it, regardless of presence in the actual wire encoding. If that means translating that into required=false,nullable=false
then so be it.
The expectation would then be that removing the default
from the spec would cause the generated code to change and a compiler error to be emitted.