ChappIO / directus-extension-models

Generate TypeScript types from your directus schema for custom extension development
26 stars 4 forks source link

Failed to get the type for videos_publisher.item. Setting to "never". #4

Closed badrange closed 1 year ago

badrange commented 1 year ago

I just installed the module and ran npx directus models snapshot model_snapshot.ts I got this output for different fields in multiple collections, they are all for M2A fields.

We're using directus 9.24.0.

== Missing Field == Failed to get the type for morning_reviews_content.item. Setting to "never". Please report this error: https://github.com/ChappIO/directus-extension-models/issues.

Stack Trace: TypeError: Cannot read properties of undefined (reading 'collection') at t (/home/bernt/p/client-fi-inderes-2.0/userData/node_modules/directus-extension-models/dist/index.js:1:5936) at a (/home/bernt/p/client-fi-inderes-2.0/userData/node_modules/directus-extension-models/dist/index.js:1:6178) at l (/home/bernt/p/client-fi-inderes-2.0/userData/node_modules/directus-extension-models/dist/index.js:1:7146) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Command. (/home/bernt/p/client-fi-inderes-2.0/userData/node_modules/directus-extension-models/dist/index.js:1:8795) at async Command.parseAsync (/home/bernt/p/client-fi-inderes-2.0/userData/node_modules/commander/lib/command.js:935:5)

Model generation will still continue, no worries.

arturoguzmanp commented 1 year ago

I can report the same issue using the latest Directus.

ChappIO commented 1 year ago

Thanks for your reports. I hadn't noticed this issue because I don't use M2A relations in my projects.

I took a quick look and it seems like the solution is a bit more complicated as the relation information isn't quite readily available.

I will try and see if I can find a fix for this this weekend.

ChappIO commented 1 year ago

Nevermind, I found a solution. I'm going to run some tests

ChappIO commented 1 year ago

Fix seems to work. I have released it as version 2.5.1.

badrange commented 1 year ago

Thank you! Will try out the latest release!