onflow / freshmint

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validate metadata input against schema

psiemens opened this issue · comments

Freshmint should return helpful errors to the user when they pass metadata values that do not match the defined schema, specifically:

  • A metadata object that is missing one or more fields
  • A metadata object that includes values that do not match the specified field types (e.g. passing a non-integer value for Int)

Right now, incorrect metadata usually causes errors like this when forming the FCL transaction:

Type Error: Expected String for type String

The CLI panics when the CSV file provided to fresh mint does not contain header names that match the schema in freshmint.yaml:

? Create NFTs using data from editions.csv? Yes

⠋ Checking for duplicate NFTs ...
TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at Function.from (node:buffer:323:9)