santhosh-tekuri / jsonschema

JSONSchema (draft 2020-12, draft 2019-09, draft-7, draft-6, draft-4) Validation using Go
Apache License 2.0
957 stars 98 forks source link

Can not install v5.2.0 #112

Closed reitzig closed 1 year ago

reitzig commented 1 year ago

This command used to work before:

go install github.com/santhosh-tekuri/jsonschema/v5/cmd/jv@v5.1.1

From diffing the docs, I see that it should now be:

go install github.com/santhosh-tekuri/jsonschema/cmd/jv@v5.2.0

Not only does that now require Git (why?), but it also doesn't work:

go: github.com/santhosh-tekuri/jsonschema/cmd/jv@v5.2.0: github.com/santhosh-tekuri/jsonschema/cmd/jv@v5.2.0: invalid version: unknown revision cmd/jv/v5.2.0

What's the correct command to use now?

FWIW, I don't want to use latest since I pin versions and have Renovate bump them explicitly.

reitzig commented 1 year ago

Ah:

 # go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest
go: downloading github.com/santhosh-tekuri/jsonschema/cmd/jv v0.3.1
go: downloading github.com/santhosh-tekuri/jsonschema v1.2.4
go: downloading github.com/santhosh-tekuri/jsonschema/v5 v5.1.1
go: downloading gopkg.in/yaml.v2 v2.4.0

Seems like something wasn't bumped correctly. Is the problem that santhosh-tekuri/jsonschema:cmd/jv/go.mod still contains

require (
    github.com/santhosh-tekuri/jsonschema/v5 v5.1.1
)
santhosh-tekuri commented 1 year ago

yes. you are correct. corrected it.

now you can install it using one of the following commands:

$ go install github.com/santhosh-tekuri/jsonschema/cmd/jv@v0.4.0
$ go install github.com/santhosh-tekuri/jsonschema/cmd/jv@latest

note: the go.mod version of jv is v0.4.0 where as jsonschema is v5.2.0

both are independent go modules

reitzig commented 1 year ago

I see, thanks for clarifying and fixing the issue at hand!

go install github.com/santhosh-tekuri/jsonschema/cmd/jv@v0.4.0

does indeed work as expected.

That said, if you'll permit a follow-up: since the GitHub Releases use the versions of jsonschema, how can I configure Renovate/Dependabot so they can determine the current version of jv? :thinking:

santhosh-tekuri commented 1 year ago

I am not familiar with the tools you mentioned.

I have made GitHub release for jv https://github.com/santhosh-tekuri/jsonschema/releases/tag/cmd%2Fjv%2Fv0.4.0 let me know if that helps

santhosh-tekuri commented 1 year ago

may be using gomod package-manager could work for you:

https://gist.github.com/magnetikonline/6f215db058e327905bce66c37f92426c

reitzig commented 1 year ago

Not sure how I can; maybe. My context is not a Go project but a Dockerfile:

FROM golang:alpine AS build

# renovate: datasource=github-releases depName=santhosh-tekuri/jsonschema versioning=semver
ENV JV_VERSION="0.3.1"
RUN go install github.com/santhosh-tekuri/jsonschema/cmd/jv@v${JV_VERSION}

# snipped

Together with this packageRule für Renovate, I got it to work:

{
  "packageRules" : [
    {
      "matchDatasources": ["github-releases"],
      "matchPackageNames" : ["santhosh-tekuri/jsonschema"],
      "extractVersion": "^cmd/jv/v(?<version>\\d+\\.\\d+\\.\\d+)"
    }
  ]
}

So as long as you keep adding releases according to that naming convention, I'll get automatic updates. Thank you! 🙏

santhosh-tekuri commented 1 year ago

If you are just interested in cli version, you may like boon cli

this is port of this library to rust language.