Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Unable to load a schema for URI : http://json-schema.org/draft-07/schema# #87

Open
bsanchezb opened this issue Jun 26, 2024 · 3 comments

Comments

@bsanchezb
Copy link

Hello,

Since version 0.11.0, there is a regression on loading a schema, containing a "$schema" header:

{
	"$schema": "http://json-schema.org/draft-07/schema#",
        ...
}

I receive the following exception:

java.lang.IllegalStateException: Unable to load a schema for URI : http://json-schema.org/draft-07/schema#
        at eu.europa.esig.jws.AbstractJWSUtils$ResourceSchemaClient.get(AbstractJWSUtils.java:369)
        at eu.europa.esig.jws.AbstractJWSUtils$ResourceSchemaClient.getParsed(AbstractJWSUtils.java:375)
        at com.github.erosb.jsonsKema.SchemaLoader.findVocabulariesInMetaSchema(SchemaLoader.kt:198)
        at com.github.erosb.jsonsKema.SchemaLoader.<init>(SchemaLoader.kt:190)
        at ...

java.lang.IllegalStateException: Unable to load a schema for URI : http://json-schema.org/draft-07/schema#
        at eu.europa.esig.jws.AbstractJWSUtils$ResourceSchemaClient.get(AbstractJWSUtils.java:369)
        at eu.europa.esig.jws.AbstractJWSUtils$ResourceSchemaClient.getParsed(AbstractJWSUtils.java:375)
        at com.github.erosb.jsonsKema.SchemaLoader.findVocabulariesInMetaSchema(SchemaLoader.kt:198)
        at com.github.erosb.jsonsKema.SchemaLoader.<init>(SchemaLoader.kt:190)

Is there a workaround for the issue or is it possible to fix in the new version?

Best regards,
Aleksandr

@erosb
Copy link
Owner

erosb commented Jun 26, 2024

Hello @bsanchezb , at the first glance: I strongly advise not using any draft-07 schema with this library, since this implements draft version 2020-12 (which isn't compatible with draft-07).

If you really need to validate draft-07 schemas, then you can either pre-register it, or maybe it works if you just remove the trailing # character.

edit: the predecessor of this library is quite battle-tested for draft-07, you may consider that.

@bsanchezb
Copy link
Author

Hello @erosb ,

Thank you for the answer. The https://github.com/everit-org/json-schema/ library has been deprecated, that is why we were forced to migrate to the current library.

Removing of # character from the schema itself is not possible, as we are using official json schemas provided within ETSI TS 119 182-1 standard for JAdES signatures. Any custom modifications within the schema are not advisable.

Nevertheless, the fix with registering the original draft-07 schema seems working! Thank you for the tip.

Best regards,
Aleksandr

@erosb
Copy link
Owner

erosb commented Nov 3, 2024

Hello @bsanchezb I tried to add a reproducer for this issue, but this test passes: 446a7d2

Is the issue still reproducible on your side? I looked into this class but I can't see anything in its current version that can cause this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants