I have been able to find a turnaround for exporting the schema using Node.js.
===========
To export your schema from a Directus instance using Node.js
Setup Node.js Project:
Create a new directory and initialize a Node.js project:mkdir directus-schema-export cd directus-schema-export npm init -y Install the required package:npm install cross-fetchCreate the Script:
Create a file, e.g., export-schema.js, and add the following code:
const fetch = require('cross-fetch'); // Replace with your actual Directus project URL and access token const SOURCE_URL = 'https://your-directus-instance.com'; // Your Directus URL const SOURCE_TOKEN = 'your-access-token'; // Your Directus access token async function exportSchema() { try { const response = await fetch(`${SOURCE_URL}/schema/snapshot?access_token=${SOURCE_TOKEN}`); if (!response.ok) { throw new Error(`Failed to fetch schema: ${response.statusText}`); } const { data } = await response.json(); console.log('Schema exported successfully:', data); return data; } catch (error) { console.error('Error exporting schema:', error.message); } } // Call the function exportSchema();Run the Script:
Execute the script using Node.js:node export-schema.js The schema will be logged to the console. You can redirect it to a file:node export-schema.js > schema.json