Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Casks/jsonschema.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
cask "jsonschema" do
version "14.14.2"

arch arm: "arm64", intel: "x86_64"

version "14.14.2"
sha256 arm: "ae73b90e79a7e587f05d722de502b31eeb701b072e2563c38d717388a5c6e785",
intel: "dc6b99a44a1e9d002e7c534cec452fe351ae63791dfdd65e147a327c64974d51"

url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-darwin-#{arch}.zip"
name "JSON Schema CLI"
desc "The CLI for working with JSON Schema"
desc "CLI for working with JSON Schema"
homepage "https://github.com/sourcemeta/jsonschema"

deprecate! date: "2026-03-11", because: "now a formula; run: brew uninstall --cask sourcemeta/apps/jsonschema"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is the only real relevant change. The rest of changes in this file are just noise?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its trying to provide some comments about what is happening and to hopefully lead the user to the right next step if they encounter a problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I mean the rest of the edits in this file are blank lines getting added, the version field getting re-ordered, etc?


binary "jsonschema-#{version}-darwin-#{arch}/bin/jsonschema"
bash_completion "jsonschema-#{version}-darwin-#{arch}/share/bash-completion/completions/jsonschema"
zsh_completion "jsonschema-#{version}-darwin-#{arch}/share/zsh/site-functions/_jsonschema"

postflight do
system_command "xattr", args: ["-c", "#{staged_path}/jsonschema-#{version}-darwin-#{arch}/bin/jsonschema"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need this on the formula on macOS, otherwise the systen complains the binary is not code signed

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im definitely mac clueless.

# As a test
system_command "#{staged_path}/jsonschema-#{version}-darwin-#{arch}/bin/jsonschema"

puts ""
puts "Tip: Try the Sourcemeta Studio VS Code extension for an enhanced experience!"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also keep this little note?

puts " Open in VS Code: vscode:extension/sourcemeta.sourcemeta-studio"
Expand Down
58 changes: 58 additions & 0 deletions Formula/jsonschema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
class Jsonschema < Formula
desc "CLI for working with JSON Schema"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
desc "CLI for working with JSON Schema"
desc "The CLI for working with JSON Schema"

Just to match the old one?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random consistency edit...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency with what? Is this a Homebrew convention?

homepage "https://github.com/sourcemeta/jsonschema"
version "14.14.2"
license "AGPL-3.0-only"

on_macos do
on_arm do
url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-darwin-arm64.zip"
sha256 "ae73b90e79a7e587f05d722de502b31eeb701b072e2563c38d717388a5c6e785"
end

on_intel do
url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-darwin-x86_64.zip"
sha256 "dc6b99a44a1e9d002e7c534cec452fe351ae63791dfdd65e147a327c64974d51"
end
end

on_linux do
on_arm do
url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-linux-arm64.zip"
sha256 "cb8fd293ead5bb68be931d23b81c8d2278d047defb91b27e2d2892704211c198"
end

on_intel do
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW note that we offer a musl x86 binary. Is there a way to correctly use it on musl systems? Not a blocker, as its more of a bonus thing, but I wonder if it is possible

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im honestly not sure how you specify a musl variant in brew. Brew itself would have to have dependencies on musl libraries being available I think, either that or the OS itself needs to ensure they are there.

url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-linux-x86_64.zip"
sha256 "6473ee098c77d93afa15f4237c6e0fd2ce6cf3105d00ddb097cad1cf8b2f368e"
end
end

# jsonschema was previously distributed as a cask. Note: conflicts_with cask:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the conflicts_with line is obvious enough that we can remove this whole comment?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment was to highlight this distinction between brew documentation and reality. You would think conflicts_with would have an impact during upgrade/etc, but its been my observation that it is only relevant for brew audit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think let's remove the comment. The conflicts_with line, even for a casual reader, is readable enough?

# is cosmetic metadata for brew audit only — it does not raise an error at
# runtime. The post_install block below is the actual runtime warning.
conflicts_with cask: "jsonschema", because: "both install a `jsonschema` binary"

def install
# Homebrew auto-chdirs into the single top-level directory of the zip,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment can go away too

# so bin/ and share/ are directly accessible here.
bin.install "bin/jsonschema"
bash_completion.install "share/bash-completion/completions/jsonschema"
zsh_completion.install "share/zsh/site-functions/_jsonschema"
end

def post_install
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the xattr -c for macOS in this part?

caskroom = HOMEBREW_CASKROOM/"jsonschema"
return unless caskroom.exist?

opoo <<~EOS
A Cask installation of jsonschema was detected at #{caskroom}.
The cask has been superseded by this formula. To complete migration, run:
brew uninstall --cask sourcemeta/apps/jsonschema
EOS
end

Comment thread
cavanaug marked this conversation as resolved.
test do
system bin/"jsonschema", "--version"
end
end
Loading