Try to compile the schema using -r at launch of a Biovalidator server:
$ node biovalidator -r "schema_test/test.json"
2024-06-24T16:29:42.041Z [info] Custom keywords successfully added. Number of custom keywords: 5
2024-06-24T16:29:42.042Z [info] Compiling local schema from: schema_test/test.json
2024-06-24T16:29:42.048Z [info] Adding compiled local schema to cache: https://raw.githubusercontent.com/EbiEga/ega-metadata-schema/main/schemas/test.json
2024-06-24T16:29:42.090Z [info] ---------------------------------------------
2024-06-24T16:29:42.090Z [info] ------------ ELIXIR biovalidator ------------
2024-06-24T16:29:42.091Z [info] ---------------------------------------------
2024-06-24T16:29:42.091Z [info] Started server on port 3020 with base URL /
2024-06-24T16:29:42.091Z [info] Server available at http://localhost:3020/
2024-06-24T16:29:42.091Z [info] PID file is available at /mnt/c/Users/mcasado/Documents/GitHub/biovalidator/src/server.pid
2024-06-24T16:29:42.092Z [info] Writing logs to: /mnt/c/Users/mcasado/Documents/GitHub/biovalidator/src/logs/
Create a simple JSON document as follows. Notice how the referenced $id is the same as the one in the schema file.
$ curl --data @test_doc.json -H "Content-Type: application/json" -X POST "http://localhost:3020/validate"
Observe the logs from Biovalidator, displaying a warning about an empty schema $id and that it won't be cached.
2024-06-24T16:29:48.622Z [warn] Compiling schema with empty schema $id. Schema will not be cached.
2024-06-24T16:29:48.646Z [info] Returning referenced schema from cache: https://raw.githubusercontent.com/EbiEga/ega-metadata-schema/main/schemas/test.json
2024-06-24T16:29:48.649Z [info] New validation request: Processed successfully in 28ms.
The schema's $id should be identified without a warning. It is retrieved successfully from cache and used for validation, but the warning seems misleading.
Bug summary
Biovalidator complains about an empty
$id
in a local schema with a proper$id
Technical details
main
v16.13.0
v8.6.0
To reproduce
$id
field as follows:-r
at launch of a Biovalidator server:$id
is the same as the one in the schema file.$id
and that it won't be cached.Observed behaviour
Biovalidator complains about an empty schema
$id
. Error message sources from: https://github.com/elixir-europe/biovalidator/blob/d8fd80517f1df7621a3b7a4d0deada2a8ed4a186/src/core/biovalidator-core.js#L145Expected behaviour
The schema's
$id
should be identified without a warning. It is retrieved successfully from cache and used for validation, but the warning seems misleading.Additional context
No response