library.json with and without metadata object


The docs on this website describe the structure of library.json files. All required fields (title, machinename, runnable, and multiple version fields) are at the root of a single JSON object. However, there are also (older?) H5P files that contain a metadata object which, in turn, contains title and probably all of the other fields mentioned before. (edit: The last sentence is probably wrong)

I also have some JavaScript code here which is not part of any official H5P plug-in. With this code, H5P contents without the metadata object work fine, but at least one that has a metadata object doesn't (edit: Probably wrong as well). It's a newly created content based on the Interactive Book content type.

Does anyone know more about which changes where made, when that happened or maybe even which code updates are necessary to be able to display both H5P contents with and without metadata object in library.json files?


serettig's picture

Are you sure you mean library.json? Information about the concrete content is stored in h5p.json and library.json is only used for libraries.

While working on h5p-nodejs-library I created JSON schema files for library.json and h5p.json. You can check them out here: Our CI pipeline regularly checks the conformity of all H5P content types on the H5P Hub with this schema, so I can confirm that all up-to-date content types conform to the schema specified in there. It is possible that there are additional properties, though.

serettig's picture

One other thing come to my mind, after writing the first answer. Is it possible that the metadata object is not missing in library.json but in the integration object. I've encountered this issue with interactive book as well and this is the fix for it in h5p-nodejs-library:

As you can see, the integration object requires the metadata object and it must be generated by the "server" (or wherever your JS code generates the integration).

Thanks for that hint, at the time of writing I was sure to have seen multiple library.json files inside older contents, but looking at a sample of my files again I couldn't find a single one. I had to deal with broken files recently, maybe that's where I saw this key.

Thanks a lot for the GitGub link as well, that code might help with a content that's not running at the moment!