When this is merged, I have the code ready to have the ToSchema and ToParamSchema instances derived for free based on this code:
instance (KnownNat min, KnownNat max) => ToSchema (BoundedNat min max) where
declareNamedSchema _ =
pure . NamedSchema Nothing $
mempty
& #type ?~ OpenApiInteger
& #minimum ?~ fromIntegral (minBound @(BoundedNat min max)).unBoundedNat
& #maximum ?~ fromIntegral (maxBound @(BoundedNat min max)).unBoundedNat
instance (KnownNat min, KnownNat max) => ToParamSchema (BoundedNat min max) where
toParamSchema = toSchema
When this is merged, I have the code ready to have the
ToSchemaandToParamSchemainstances derived for free based on this code: