YAML
You can export the data generated by schemas or any type of data to yaml format
const userSchema = chaca.schema({
id: schemas.id.uuid(),
username: schemas.internet.userName(),
image: { type: schemas.image.people(), posibleNull: 50 },
posts: {
type: schemas.id.uuid(),
isArray: {
min: 1,
max: 5,
},
},
})
await userSchema.generateAndExport({
filaName: 'data',
format: 'yaml',
location: 'folder',
})
For example, if we have this schema, we generate 5 documents and export them in yaml format, we will obtain the following result
- id: "1ba44697-1942-4a8e-b6ed-ae683a9ac615"
username: "Lily."
image: null
posts:
- "ca5018a8-bb27-42d7-9a25-1b6ea9c2c9a5"
- "16aec25c-2ba3-470c-9858-d4591b68690e"
- "2b490d7b-8c19-4ea9-ad76-08ab70dc0ad4"
- "5189e408-6a55-4909-9b46-658cda350d09"
- id: "78201cbc-c1c7-48b8-9b1a-0a595e32d6d1"
username: "Christopher953"
image: null
posts:
- "a3d5d5a5-5c4b-446d-96c5-7e77b3ccab58"
- "08d722be-b749-451e-8e6b-5806da425817"
- "18861905-a56a-41bd-a401-7e180ca10c1c"
- "5768cc24-7747-4580-b3b6-7c719e5a5678"
- id: "15c0271d-959c-47b9-92ce-b7bb9a3adde3"
username: "Carter."
image: "https://pixabay.com/get/gced34cca12f5b9cb12e765ebc87a3be51118a7437a87d4636caa28a26ae72d433b2554e104ca79735997400b3fa19634c943d6d63cf5b9e7be93b525d459d86e_1280.jpg"
posts:
- "dc114357-8c6a-4ce8-9a7e-c8385a62b241"
- "862d6810-220a-4344-b6e5-cee3a4c233c6"
- "455b0ca9-05c0-4ebb-aeca-9c3ac24c5dcd"
- id: "86600311-b79b-4ba1-b0d0-315e476b72a2"
username: "Camila624"
image: "https://pixabay.com/get/ga5fc92040433829a15be75c7534da2b53792de37ec6cdde8afd4aad9ce504e1bc044cc967abcd1ab24ed04ac106e1de5ed5fa1d888fb255c672aaf031ba4d8b6_1280.jpg"
posts:
- "6a0d7b4d-0697-4665-be2e-08c65a2e34ad"
- id: "843d55ac-d827-4e02-bd60-dbcd1e3e993a"
username: "Mia710"
image: "https://images.unsplash.com/photo-1539571696357-5a69c17a67c6?crop=entropy&cs=tinysrgb&fm=jpg&ixid=MnwzNTM2NjZ8MHwxfHNlYXJjaHw1fHxwZW9wbGV8ZW58MHx8fHwxNjY2OTcwODMw&ixlib=rb-4.0.3&q=80"
posts:
- "778a0891-e1ba-4b74-9c3e-b98e20ba5266"
- "a4a2d65c-b938-4e97-a9e1-51a281ebac15"