0

Does someone know the what mkSchemaDefinitions accomplishes and how it accomplishes it? Lars calls it boilerplate code, but now that I'm having an issue with it I have no idea how to fix it. I'll attach the error message along with my relevant code.

 error:
    • No instance for (Schema.ToSchema MintParams)
        arising from a use of ‘Playground.Schema.endpointsToSchemas’
    • In the expression:
        Playground.Schema.endpointsToSchemas
          @((.\/) (Endpoint "mint" MintParams) (Endpoint "sell" SellParams))
      In an equation for ‘schemas’:
          schemas
            = Playground.Schema.endpointsToSchemas
                @((.\/) (Endpoint "mint" MintParams) (Endpoint "sell" SellParams))
    |
180 | mkSchemaDefinitions ''RoyaltySchema
type RoyaltySchema =
            Endpoint "mint" MintParams
        .\/ Endpoint "sell" SellParams
mkSchemaDefinitions ''RoyaltySchema
mkKnownCurrencies []
data MintParams = MintParams
    { name :: !TokenName
    , addr :: !Address
    } deriving (Generic, FromJSON, ToJSON, Show)
1
  • You should answer your own question rather than simply commenting that you fixed it.
    – gRebel
    Commented Mar 15, 2022 at 3:23

1 Answer 1

1

I was able to fix this issue by adding ToSchema to the deriving statement

1
  • Would be good to add the actual statement change as code, not just describe it.
    – gRebel
    Commented Mar 18, 2022 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.