From d02fe488e602834ff3854fe413d7fe5618843a53 Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Fri, 3 Oct 2025 05:07:43 -0600 Subject: [PATCH 1/2] Add compat/support for JSON 1.0 --- Project.toml | 2 +- src/activity/events.jl | 4 ++-- src/utils/GitHubType.jl | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 549869d..ddbdd94 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,7 @@ URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4" [compat] HTTP = "1.10.17" # Must be >= 1.10.17, see https://github.com/JuliaWeb/GitHub.jl/pull/225 URIs = "1.6" # Must be >= 1.6, see https://github.com/JuliaWeb/GitHub.jl/pull/225 -JSON = "0.19, 0.20, 0.21" +JSON = "0.19, 0.20, 0.21, 1" MbedTLS = "0.6, 0.7, 1" SodiumSeal = "0.1" julia = "1.6" diff --git a/src/activity/events.jl b/src/activity/events.jl index a790d20..49d2307 100644 --- a/src/activity/events.jl +++ b/src/activity/events.jl @@ -4,12 +4,12 @@ mutable struct WebhookEvent kind::String - payload::Dict + payload::AbstractDict repository::Repo sender::Owner end -function event_from_payload!(kind, data::Dict) +function event_from_payload!(kind, data::AbstractDict) if haskey(data, "repository") repository = Repo(data["repository"]) elseif kind == "membership" || diff --git a/src/utils/GitHubType.jl b/src/utils/GitHubType.jl index 4fcffef..a8a4e16 100644 --- a/src/utils/GitHubType.jl +++ b/src/utils/GitHubType.jl @@ -46,7 +46,7 @@ macro ghdef(expr) quote Base.@__doc__($(esc(expr))) ($(esc(T)))($params_ex) = ($(esc(T)))($(call_args...)) - $(esc(T))(data::Dict) = json2github($T, data) + $(esc(T))(data::AbstractDict) = json2github($T, data) end end @@ -87,7 +87,7 @@ function unwrap_union_types(T::Union) return T.a end -function extract_nullable(data::Dict, key, ::Type{T}) where {T} +function extract_nullable(data::AbstractDict, key, ::Type{T}) where {T} if haskey(data, key) val = data[key] if val !== nothing @@ -122,7 +122,7 @@ end # dictionary into the type `G` with the expectation that the fieldnames of # `G` are keys of `data`, and the corresponding values can be converted to the # given field types. -@generated function json2github(::Type{G}, data::Dict) where {G<:GitHubType} +@generated function json2github(::Type{G}, data::AbstractDict) where {G<:GitHubType} types = unwrap_union_types.(collect(G.types)) fields = fieldnames(G) args = Vector{Expr}(undef, length(fields)) @@ -156,7 +156,7 @@ function github2json(g::GitHubType) return results end -function github2json(data::Dict{K}) where {K} +function github2json(data::AbstractDict{K}) where {K} results = Dict{K,Any}() for (key, val) in data results[key] = github2json(val) From c972c6ca9e02ade0b723a69e97dd133ed80dfa86 Mon Sep 17 00:00:00 2001 From: Jacob Quinn Date: Fri, 3 Oct 2025 05:07:43 -0600 Subject: [PATCH 2/2] Add compat/support for JSON 1.0 --- src/issues/reviews.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/issues/reviews.jl b/src/issues/reviews.jl index 2d9c1a2..afa38a9 100644 --- a/src/issues/reviews.jl +++ b/src/issues/reviews.jl @@ -6,7 +6,7 @@ state::Union{String, Nothing} end -function Review(pr::PullRequest, data::Dict) +function Review(pr::PullRequest, data::AbstractDict) rev = Review(data) rev.pr = pr rev