Skip to content

Add instances for new Servant.API.Range type #106

@kutyel

Description

@kutyel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions