tom
tom5mo ago

Post request validation: "Unsupported type: array"

Hi, I'm trying to validate a post request body, this the the validation: [ { field: 'title', required: true, type: 'string' }, { field: 'valueA', required: true, type: 'number' }, { field: 'valueB', required: true, type: 'number' }, { field: 'valueC', required: true, type: 'number' }, { field: 'valueD', required: true, type: 'number' }, { field: 'valueE', required: true, type: 'number' }, { field: 'isOptionA', required: true, type: 'boolean' }, { field: 'isOptionB', required: true, type: 'boolean' }, { field: 'tags', required: true, type: 'array', items: { type: 'string' } } ] Am I doing something wrong or.. ?
5 Replies
Henry Moses
Henry Moses5mo ago
Can you send me the request your trying to validate?
tom
tom5mo ago
Hey, thanks for the response. Do you need the entire request or just the body of the request? I'm starting my flow with Firebase Auth Request and this is the body { "body": { "carbsPer100": 12.31, "proteinPer100": 12.31, "kcalPer100": 123, "allergens": [ "🟢 None", "🥛 Milk", "🥚 Eggs", "🥜 Peanuts" ], "isLactoseFree": true, "sugarPer100": 23.12, "fatsPer100": 12.31, "name": "tere", "isGlutenFree": true }, "user": { "auth_time": 1717526011, "uid": "xxx", "user_id": "xxx", "firebase": { "identities": { "email": [ "xxx" ] }, "sign_in_provider": "password" }, "iat": 1717591312, "sub": "tz5qhbSP3Qh6DZe0eoR54bvjwMw2", "name": "Tom", "exp": 1717594912, "email": "tom9@test.com", "email_verified": false, "iss": "https://securetoken.google.com/mpt-bo", "aud": "mpt-bo" } }
tom
tom5mo ago
I'm getting the same results for other array validations too, also tried the validation generated by the buildShip AI, still the same result. I think it means you can't validate arrays?
No description
Gaurav Chadha
Gaurav Chadha5mo ago
Hi @tom, this is not a valid JSON Object, it an array, due to which it will fail in teh Object validation node. The `Object validation node expects a valid JOSN object.
tom
tom5mo ago
Hi, thanks. Are you referring to the request body or what I use to validate it against? Okay, I think I get it now. Thanks for the support @Gaurav Chadha . Do you have any recommendations to validate the array? I love BuildShip, I got it solved, thank you for your help, we can consider this issue closed (the issue here wasn't BuildShip's buy my ignorance 😄 )