metaplex-foundation / sugar

Candy Machine Rust CLI.
Apache License 2.0
205 stars 116 forks source link

[Bug]: "assets/0.json: missing field `category` #246

Closed katopz closed 2 years ago

katopz commented 2 years ago

Issue description

Follow an instructions then try sugar validate and get an error

"assets/0.json: missing field `category`

Refer to metaplex doc there's no category

https://docs.metaplex.com/candy-machine-v2/preparing-assets#-metadata-0json

{
"name": "Number #0001",
"symbol": "NB",
"description": "Collection of 10 numbers on the blockchain. This is the number 1/10.",
"seller_fee_basis_points": 500,
"image": "0.png",
"attributes": [
{ "trait_type": "Layer-1", "value": "0" },
{ "trait_type": "Layer-2", "value": "0" },
{ "trait_type": "Layer-3", "value": "0" },
{ "trait_type": "Layer-4", "value": "1" }
],
"properties": {
"creators": [
{ "address": "N4f6zftYsuu4yT7icsjLwh4i6pB1zvvKbseHj2NmSQw", "share": 100 }
],
"files": [{ "uri": "0.png", "type": "image/png" }]
},
"collection": { "name": "numbers", "family": "numbers" }
}

But in sugar test case there is category

https://github.com/katopz/sugar/blob/04b334f2bb23605d95749e69d9c6fcd6fe7d9157/script/sugar-cli-test.sh

{
"name": "[$TIMESTAMP] Collection",
"symbol": "TEST",
"description": "Sugar CLI Collection",
"seller_fee_basis_points": 500,
"image": "collection.png",
"attributes": [{"trait_type": "Flavour", "value": "Sugar"}],
"properties": {
"files": [
{
"uri": "collection.png",
"type": "image/png"
}],
"category": "Sugar Test Collection"
}
}

Seem to be doc issue?

Relevant log output

{"v":0,"name":"sugar","msg":"Lend me some sugar, I am your neighbor.","level":30,"hostname":"fox","pid":20152,"time":"2022-06-30T09:35:30.275268Z","target":"sugar","line":106,"file":"src/main.rs"}
{"v":0,"name":"sugar","msg":"assets/0.json: missing field `category` at line 38 column 3","level":50,"hostname":"fox","pid":20152,"time":"2022-06-30T09:35:30.277253Z","target":"sugar_cli::validate::process","line":69,"file":"src/validate/process.rs"}
{"v":0,"name":"sugar","msg":"Deserialize errors: Mutex { data: [DeserializeError { path: \"assets/0.json\", error: Error(\"missing field `category`\", line: 38, column: 3) }], poisoned: false, .. }","level":50,"hostname":"fox","pid":20152,"time":"2022-06-30T09:35:30.277411Z","target":"sugar_cli::validate::process","line":110,"file":"src/validate/process.rs"}

Priority this issue should have

Medium (should be fixed soon)

stegaBOB commented 2 years ago

Our parsing currently refers to an older version of the JSON spec. For now, feel free to just run sugar upload and sugar deploy manually and skip the validate step.