Error: Class 'Opis\JsonSchema\Validator' not found in Drupal\opigno_scorm\Controller\OpignoScormController->scormCommit() (line 84 of /code/web/modules/contrib/opigno_scorm/src/Controller/OpignoScormController.php)

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

cornifex created an issue. See original summary.

cornifex’s picture

Status: Active » Needs review
StatusFileSize
new349 bytes

Patch adds the library to the project's composer.json file.

Zuiev’s picture

Hey cornifex, thanks for the patch. Unfortunatelly it doesn't work for me and I'm still getting the error.

Thanks.

saurabh-2k17’s picture

Hey @Zuiev

You can directly require the dependency like composer require opis/json-schema

Thanks

Liam McDermott made their first commit to this issue’s fork.

liam mcdermott’s picture

Version: 3.0.2 » 3.0.3

I created an MR that adds the dependency, and tested it.

Hey cornifex, thanks for the patch. Unfortunatelly it doesn't work for me and I'm still getting the error.

This would be due to patches being applied after composer has resolved dependencies, because of this, adding new dependencies in patches doesn't work.

Instead, if you add this to your project's `composer.json` as the first item under `repositories`:

        {
            "type": "vcs",
            "url": "git@git.drupal.org:issue/opigno_scorm-3281986.git"
        },

And put this under your `composer.json`'s `require` section:

        "drupal/opigno_scorm": "dev-3281986-json-schema-dep-missing",

And run `composer update`, it should fix the issue. Or you can add it as a direct dependency, like saurabh-2k17 suggested, but that won't help test the fix for this issue. If the above works for anyone else, please come and mark this as 'Reviewed and tested by the community'.

To reproduce this issue, install Opigno SCORM without any of the other Opigno modules, add a SCORM field to some content type, then add content of that type and upload a SCORM file, load that content in the browser, then open the browser console and interact with the loaded SCORM content. When moving between steps this error should be shown in the console (it's a JS http request).

kurttrowbridge’s picture

Assigned: cornifex » Unassigned
Status: Needs review » Reviewed & tested by the community

Hi! I followed the instructions in #7 while also excluding this module from the standard Drupal repository (see snippet below), and that installed the dependencies successfully and fixed the errors. Marking RTBC. Thanks!

    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8",
            "exclude": [
                "drupal/opigno_scorm"
            ]
        },
        ...
        {
            "type": "vcs",
            "url": "git@git.drupal.org:issue/opigno_scorm-3281986.git"
        }
    ],
jepster_’s picture

I do also confirm that the changes from the MR do work for my project.

You must be careful, that you really install the ^2.3 version and not just the latest version. Because the latest version of opis/json-schema cannot be auto-loaded via composer.