{"record":{"id":"8c2aa4f0a69faf06","repo":"usebruno/bruno","slug":"the-collection-has-an-invalid-schema-err-messag-8c2aa4","errorCode":null,"errorMessage":"The Collection has an invalid schema: ${err.message}","messagePattern":"The Collection has an invalid schema: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-converters/src/wsdl/wsdl-to-bruno.js","lineNumber":20,"sourceCode":"const generateUID = () => {\n  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n  let result = '';\n  for (let i = 0; i < 21; i++) {\n    result += chars.charAt(Math.floor(Math.random() * chars.length));\n  }\n  return result;\n};\n\nimport { get, each } from 'lodash';\nimport { collectionSchema } from '@usebruno/schema';\n\n// --- Inlined from src/common/index.js ---\nexport const validateSchema = (collection = {}) => {\n  try {\n    collectionSchema.validateSync(collection);\n    return collection;\n  } catch (err) {\n    throw new Error('The Collection has an invalid schema: ' + err.message);\n  }\n};\n\nexport const transformItemsInCollection = (collection) => {\n  const transformItems = (items = []) => {\n    each(items, (item) => {\n      if (['http', 'graphql'].includes(item.type)) {\n        item.type = `${item.type}-request`;\n        if (item.request.query) {\n          item.request.params = item.request.query.map((queryItem) => ({\n            ...queryItem,\n            type: 'query',\n            uid: queryItem.uid || generateUID()\n          }));\n        }\n        delete item.request.query;\n        let multipartFormData = get(item, 'request.body.multipartForm');\n        if (multipartFormData) {","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-converters/src/wsdl/wsdl-to-bruno.js#L2-L38","documentation":"Thrown by validateSchema (inlined in wsdl-to-bruno.js from src/common) when collectionSchema.validateSync rejects the produced Bruno collection. This is a Yup schema validation: the WSDL→Bruno translation produced a collection whose shape does not match @usebruno/schema's collectionSchema. The original Yup error message (field path + rule) is appended.","triggerScenarios":"A WSDL whose translation yields a collection missing required fields (uid, name, items), with items of wrong type, or carrying fields the schema marks as unknown/noUnknown. Common after a @usebruno/schema version change that tightened rules.","commonSituations":"Schema/bruno-oauth or items[].type mismatches; WSDL parser emitting a request type the schema doesn't allow; outdated @usebruno/schema; extra fields from parseWSDLCollection that the strict schema rejects.","solutions":["Read the appended err.message — Yup reports the exact failing path (e.g. 'items[0].request must be defined').","Ensure wsdlToBruno and @usebruno/schema are at compatible versions (check the package's dependency range).","Inspect the pre-validation `hydratedCollection` (log it before line 20) to find the malformed node."],"exampleFix":"// before\nconst validated = validateSchema(hydrated);\n\n// after — log the offender\ntry {\n  return validateSchema(hydrated);\n} catch (e) {\n  console.error('schema reject on collection:', JSON.stringify(hydrated, null, 2));\n  throw e;\n}","handlingStrategy":"validation","validationCode":"import { collectionSchema } from '@usebruno/schema';\nconst precheck = (col) => {\n  try { collectionSchema.validateSync(col); return true; }\n  catch (e) { console.warn('schema precheck:', e.message); return false; }\n};","typeGuard":"const hasRequiredCollectionFields = (c) =>\n  !!c && typeof c.name === 'string' && Array.isArray(c.items) && !!c.uid;","tryCatchPattern":"try {\n  return validateSchema(col);\n} catch (e) {\n  console.error('offending collection:', JSON.stringify(col, null, 2));\n  throw e;\n}","preventionTips":["Keep @usebruno/schema and bruno-converters at compatible versions.","Log the hydrated collection before validation to locate the malformed node.","Read the Yup message — it reports the exact failing path."],"tags":["wsdl","schema-validation","yup","bruno-converters","import"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}