Skip to content

Commit 95b8a4c

Browse files
authored
fix summary method (#36)
* fix summary method Fix missing param in `summary` method. Minor refactor of `reduce_to_ms_precision` method. * bump patch version
1 parent 8831e8e commit 95b8a4c

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ uuid = "d5e62ea6-ddf3-4d43-8e4c-ad5e6c8bfd7d"
33
keywords = ["Swagger", "OpenAPI", "REST"]
44
license = "MIT"
55
desc = "OpenAPI server and client helper for Julia"
6-
authors = ["Tanmay Mohapatra <[email protected]>", "JuliaHub"]
7-
version = "0.1.10"
6+
authors = ["JuliaHub Inc."]
7+
version = "0.1.11"
88

99
[deps]
1010
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/client.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ convert(::Type{T}, v) where {T<:AnyOfAPIModel} = T(v)
532532

533533
show(io::IO, model::T) where {T<:UnionAPIModel} = print(io, JSON.json(model.value, 2))
534534
show(io::IO, model::T) where {T<:APIModel} = print(io, JSON.json(model, 2))
535-
summary(model::T) where {T<:APIModel} = print(io, T)
535+
summary(io::IO, model::T) where {T<:APIModel} = print(io, T)
536536

537537
"""
538538
is_longpoll_timeout(ex::Exception)

src/datetime.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ const rxdatetime =
2323
r"([0-9]{4}-[0-9]{2}-[0-9]{2}[T\s][0-9]{2}:[0-9]{2}:[0-9]{2}(?:\.[0-9]{1,3})?)[0-9]*([+\-Z][:\.0-9]*)?"
2424
function reduce_to_ms_precision(datetimestr::String)
2525
matches = match(rxdatetime, datetimestr)
26-
if matches === nothing
27-
return datetimestr
28-
elseif !isnothing(matches.captures[2])
29-
return matches.captures[1] * matches.captures[2]
30-
else
31-
return String(matches.captures[1])
32-
end
26+
isnothing(matches) && return datetimestr
27+
28+
c1 = matches.captures[1]
29+
isnothing(c1) && return datetimestr
30+
31+
c2 = matches.captures[2]
32+
return isnothing(c2) ? String(c1) : c1 * c2
3333
end
3434

3535
str2zoneddatetime(bytes::Vector{UInt8}) = str2zoneddatetime(String(bytes))

0 commit comments

Comments
 (0)