Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON3 and StructTypes compat for InterTypes #106

Merged
merged 1 commit into from
Feb 15, 2024
Merged

JSON3 and StructTypes compat for InterTypes #106

merged 1 commit into from
Feb 15, 2024

Conversation

olynch
Copy link
Collaborator

@olynch olynch commented Jan 25, 2024

Addresses #83.

REGRESSION: The full range of 64 bit integers is no longer supported.

@olynch olynch linked an issue Jan 25, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jan 25, 2024

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (f520029) 91.05% compared to head (733ab18) 91.62%.

Files Patch % Lines
src/intertypes/jsonschema.jl 87.93% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #106      +/-   ##
==========================================
+ Coverage   91.05%   91.62%   +0.56%     
==========================================
  Files          22       22              
  Lines        2136     1910     -226     
==========================================
- Hits         1945     1750     -195     
+ Misses        191      160      -31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@olynch
Copy link
Collaborator Author

olynch commented Feb 7, 2024

@jpfairbanks @fivegrant this is ready to review; let's get this merged.

"""
struct JSONTarget <: SerializationTarget end

# TODO: Should this be ::JSONTarget instead of ::Type{JSONTarget} so
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO I think we should probably keep it as is since it somewhat matches the other parts of source:

  • function default_parts_type(::Type{PT}) where PT <: PartsType
  • abstract type Default end
    struct DefaultVal{x} <: Default
    end
    default(::Type{DefaultVal{x}}) where {x} = x
    struct DefaultEmpty{T} <: Default
    end
    default(::Type{DefaultEmpty{T}}) where {T} = T()
  • Base.convert(::Type{T}, x::T) where {T>:Union{Nothing,AttrVar}} = x
    Base.convert(::Type{T}, x::T) where {T>:Union{Missing,AttrVar}} = x
    Base.convert(::Type{T}, x::T) where {T>:AttrVar} = x
    Base.convert(::Type{T}, x) where {T>:AttrVar} = convert(Base.typesplit(T, AttrVar), x)
    (extending a base function)

Copy link
Collaborator

Choose a reason for hiding this comment

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

A counterargument though is that the platform-specific options can be contained in the JSONTarget struct instead of extra keywords.

@olynch olynch merged commit da63e24 into main Feb 15, 2024
9 checks passed
@epatters epatters deleted the json3-compat branch February 15, 2024 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intertypes using JSON3 read and write functions
3 participants