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

Update JsonSchema.Net dependency #5

Closed
laurynasr opened this issue Jun 27, 2024 · 3 comments · Fixed by #6
Closed

Update JsonSchema.Net dependency #5

laurynasr opened this issue Jun 27, 2024 · 3 comments · Fixed by #6

Comments

@laurynasr
Copy link
Contributor

laurynasr commented Jun 27, 2024

I tried updating Graeae to use current version of JsonSchema.Net in my fork but hit a brick wall when trying to make the tests run. Apparently the previous hack to register draft4 as one of the supported meta-schemas no longer works and I can't figure out a way how to do that in the current version of JsonSchema.Net.

Setup failed for test fixture Graeae.Models.Tests.TestEnvironment
Json.Schema.JsonSchemaException : Custom meta-schema `$schema` keywords must eventually resolve to a meta-schema for a supported specification version.
StackTrace:    at Json.Schema.SchemaRegistry.DetermineSpecVersion(JsonSchema schema, SchemaRegistry registry)
   at Json.Schema.SchemaRegistry.Scan(Uri baseUri, JsonSchema document)
   at Json.Schema.SchemaRegistry.RegisterSchema(Uri uri, IBaseDocument document)
   at Json.Schema.SchemaRegistry.Register(Uri uri, IBaseDocument document)
   at Json.Schema.SchemaRegistry.Register(IBaseDocument document)
   at Json.Schema.JsonSchema.Evaluate(JsonNode root, EvaluationOptions options)
   at Graeae.Models.SchemaDraft4.Draft4Support.InitializeDraft4Schema() in D:\src\Graeae\Graeae.Models\SchemaDraft4\Draft4Support.cs:line 175
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Graeae.Models.SchemaDraft4.Draft4Support.get_Draft4MetaSchema() in D:\src\Graeae\Graeae.Models\SchemaDraft4\Draft4Support.cs:line 31
   at Graeae.Models.SchemaDraft4.Draft4Support.Enable() in D:\src\Graeae\Graeae.Models\SchemaDraft4\Draft4Support.cs:line 190
   at Graeae.Models.Tests.TestEnvironment.Setup() in D:\src\Graeae\Graeae.Models.Tests\TestEnvironment.cs:line 11

Also, this kind of change probably deserves a major version bump, but as the current major version is still 0 -- should it become 1.0.0 or 0.3.0?

Any guidance would be very appreciated.

Thanks

@gregsdennis
Copy link
Owner

gregsdennis commented Jun 27, 2024

Thanks for the report. Nothing has changed in that area of code. I'll have to investigate.

Also, this kind of change probably deserves a major version bump, but as the current major version is still 0 -- should it become 1.0.0 or 0.3.0?

Since this is a 0.x (alpha/beta?) version, it's not technically governed by SemVer. I believe the common practice, and the one that I follow, is that for 0.x versions, the numbers shift down one. So for 0.2.x, the 2 is treated as "major" and there's just not a patch version. A breaking change would bump to 0.3.0.

@gregsdennis
Copy link
Owner

Yeah, it looks like the hack was lost with the refactor to move the schema scanning to SchemaRegistry. I'll have to add that back in.

@gregsdennis
Copy link
Owner

@laurynasr that was a strange one to track down.

I ended up also supporting Native AOT with this release, and I found a problem in JsonPointer.Net's package where it seemed to be missing two methods. Not sure how that hasn't come up elsewhere since JsonSchema.Net is DEFINITELY using those methods.

Anyway, the new version should work for you.

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

Successfully merging a pull request may close this issue.

2 participants