Referencing libraries in library.json if used in semantics.json

serettig's picture
Forums: 

Hi,

I'm wondering whether you should add a reference to library.json (in preloadedDependencies) to a library that is used in semantics.json. My content type, like many others, allows the content creator to add images or videos. I've seen that content types like H5P.Blanks uses H5P.Image 1.0 and H5P.Video 1.3 in semantics.json but never references them in library.json. This can load to possible situations in which the H5P.Image/Video library might not be present on a h5p installation and thus the content type can't be used as it was designed.

So, wouldn't it be better to add H5P.Image/Video to the list, or is there anything that speaks against this?

fnoks's picture

Hi,

You are correct. The dependencies inside semantics.json are dynamic, i.e based on the content created. The dependencies in library.json are always included. If you think Image and Video always should be present, it is OK if you add them to both semantics.json and library.json.

The thought behind this architecture is that when distributing content, we don't want to add a lot of unused libraries. Especially for the compound content types containing a lot of content types. On the other side, this might be confusing for some users.

serettig's picture

Thanks for you answer, the reasoning is clearer to me now!