Closed
Description
I'm using php-json-schema to validate the responses of my server endpoints.
I'm testing it locally and i can't seem to find a way to reference another schma with definitions.
My endpoint schema validator has the following:
"tasks": { "$ref": "definitions.json#/taskDefinition"},
The other file called definitions.json has the following:
{
"taskDefinition": {
"type": "array"
}
}
It always returns an error:
file_get_contents(definitions.json): failed to open stream: No such file or directory
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/RemoteRef/BasicFetcher.php:14
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/RefResolver.php:195
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Schema.php:698
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Schema.php:1139
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Wrapper.php:46
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Schema.php:863
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Schema.php:1139
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Schema.php:831
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Schema.php:1139
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Schema.php:176
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Wrapper.php:58
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Structure/ClassStructureTrait.php:60
/home/ralves/projects/php-project/vendor/swaggest/json-schema/src/Schema.php:137
/home/ralves/projects/php-project/tests/api/AuthenticatedCest.php:77
/home/ralves/projects/php-project/tests/api/CoreCest.php:12
/tmp/ide-codeception.php:494
I tried using id: "file://"
, and a bunch of other things but didn't found a way to make it work.
I changed the code of the BasicFetcher.php
so that the $url
is the absolute path of the definitions.json
file and it worked, but clearly it's not a solution for this problem.
PS: Searching on google for similar problem got me on this issue of another project
Metadata
Metadata
Assignees
Labels
No labels