JuliaIO / JuliaIO/JSON.jl

lower(m::Module) throws in v0.21

Open
#415 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
360
Forks
113
Avg merge
5d 2h
Merged PRs (30d)
4

Description

In GenieFramework we rely on rendering a Module as its String value, which JSON v1 perfectly does. However, v0.21 does throw an error.

In this transition period from JSON3 to JSON we still support JSON 0.21, but we cannot lower Modules as String, because its lowering is hard-coded in Writer.jl

I propose a small patch to allow for specialization of lower(m::Module) without breaking existing behaviour.

lower(m::Module) = throw(ArgumentError("cannot serialize Module $m as JSON"))

to

abstract type DummyModule end
# chose a Union type to make it possible to extend lower for Modules
lower(m::Union{Module,DummyModule}) = throw(ArgumentError("cannot serialize Module $m as JSON"))

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in Writer.jl at the existing lower(m::Module) definition and review the proposed hh-module patch. Confirm that Module values can be specialized for JSON 0.21 while the existing ArgumentError remains the default behavior, then verify the compatibility case described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.