Skip to content

Commit 05144ef

Browse files
quinnjDilumAluthge
andauthored
Add compat/support for JSON 1.0 (#235)
* Add compat/support for JSON 1.0 * Add compat/support for JSON 1.0 --------- Co-authored-by: Dilum Aluthge <[email protected]>
1 parent 942e814 commit 05144ef

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
1515
[compat]
1616
HTTP = "1.10.17" # Must be >= 1.10.17, see https://github.com/JuliaWeb/GitHub.jl/pull/225
1717
URIs = "1.6" # Must be >= 1.6, see https://github.com/JuliaWeb/GitHub.jl/pull/225
18-
JSON = "0.19, 0.20, 0.21"
18+
JSON = "0.19, 0.20, 0.21, 1"
1919
MbedTLS = "0.6, 0.7, 1"
2020
SodiumSeal = "0.1"
2121
julia = "1.6"

src/activity/events.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
mutable struct WebhookEvent
66
kind::String
7-
payload::Dict
7+
payload::AbstractDict
88
repository::Repo
99
sender::Owner
1010
end
1111

12-
function event_from_payload!(kind, data::Dict)
12+
function event_from_payload!(kind, data::AbstractDict)
1313
if haskey(data, "repository")
1414
repository = Repo(data["repository"])
1515
elseif kind == "membership" ||

src/issues/reviews.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
state::Union{String, Nothing}
77
end
88

9-
function Review(pr::PullRequest, data::Dict)
9+
function Review(pr::PullRequest, data::AbstractDict)
1010
rev = Review(data)
1111
rev.pr = pr
1212
rev

src/utils/GitHubType.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ macro ghdef(expr)
4646
quote
4747
Base.@__doc__($(esc(expr)))
4848
($(esc(T)))($params_ex) = ($(esc(T)))($(call_args...))
49-
$(esc(T))(data::Dict) = json2github($T, data)
49+
$(esc(T))(data::AbstractDict) = json2github($T, data)
5050
end
5151
end
5252

@@ -87,7 +87,7 @@ function unwrap_union_types(T::Union)
8787
return T.a
8888
end
8989

90-
function extract_nullable(data::Dict, key, ::Type{T}) where {T}
90+
function extract_nullable(data::AbstractDict, key, ::Type{T}) where {T}
9191
if haskey(data, key)
9292
val = data[key]
9393
if val !== nothing
@@ -122,7 +122,7 @@ end
122122
# dictionary into the type `G` with the expectation that the fieldnames of
123123
# `G` are keys of `data`, and the corresponding values can be converted to the
124124
# given field types.
125-
@generated function json2github(::Type{G}, data::Dict) where {G<:GitHubType}
125+
@generated function json2github(::Type{G}, data::AbstractDict) where {G<:GitHubType}
126126
types = unwrap_union_types.(collect(G.types))
127127
fields = fieldnames(G)
128128
args = Vector{Expr}(undef, length(fields))
@@ -156,7 +156,7 @@ function github2json(g::GitHubType)
156156
return results
157157
end
158158

159-
function github2json(data::Dict{K}) where {K}
159+
function github2json(data::AbstractDict{K}) where {K}
160160
results = Dict{K,Any}()
161161
for (key, val) in data
162162
results[key] = github2json(val)

0 commit comments

Comments
 (0)