image-spec icon indicating copy to clipboard operation
image-spec copied to clipboard

Update 2 dependencies

Open mtrmac opened this issue 11 months ago • 3 comments

github.com/santhosh-tekuri/jsonschema/v5 is about 2 years old, github.com/russross/blackfriday more than 4 years old. Keeping up will only get harder as the users stay behind.

Note a possible downside: The v6 of the JSON schema parser imports golang.org/x/text to support localized error messages, and that is +17570 of a dependency.

Warning: I am not an expert in either of the packages, I was looking for the most similar new APIs. (I did manually verify that the markdown parsing produces the same code examples.)

mtrmac avatar Mar 14 '25 01:03 mtrmac

As we just discussed in the OCI weekly meeting, Go version updates always make me nervous, especially with how many people import github.com/opencontainers/image-spec just for our struct/const definitions (which have essentially no Go version requirement and probably work all the way back to like Go 1.0 or earlier).

One idea we discussed was perhaps moving these deps/constraints to a new go.mod under schema (ie, create schema/go.mod) -- this would effectively create a new github.com/opencontainers/image-spec/schema "module", but the imports would all be exactly the same and go mod tidy should just DTRT for fixing consumers. :thinking:

(Doing that would resolve my concerns pretty well, since the schema validation code has more valid reasons for enforcing a specific Go version than the struct/const definitions do.)

tianon avatar Mar 20 '25 17:03 tianon

For a preview, this is what splitting out a …/schema module would look like.

Note the process in https://go.dev/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository : the next release of this repository would have to add tags, and a new inter-module dependency. I couldn’t test all of that directly, that would remain a lingering disk for the next release.

mtrmac avatar May 16 '25 21:05 mtrmac

Updated to newly test that the spec repo is consumable by Go 1.18, and to use go.work instead of replace.

mtrmac avatar May 20 '25 21:05 mtrmac

Rebased, PTAL.

mtrmac avatar Jul 04 '25 15:07 mtrmac