Skip to content

Commit b801db6

Browse files
committed
Update
1 parent fc91c0b commit b801db6

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ CodecZlib = "~0.6, 0.7"
2828
DataStructures = "0.18"
2929
ForwardDiff = "0.5, 0.6, 0.7, 0.8, 0.9, 0.10"
3030
JSON = "~0.21"
31+
JSON3 = "1"
3132
JSONSchema = "1"
3233
LinearAlgebra = "<0.0.1, 1.6"
3334
MutableArithmetics = "1"

src/FileFormats/MOF/MOF.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
module MOF
88

99
import ..FileFormats
10-
import JSON
10+
import JSON3
1111
import MathOptInterface as MOI
1212

1313
"""

src/FileFormats/MOF/read.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function Base.read!(io::IO, model::Model)
1313
if !MOI.is_empty(model)
1414
error("Cannot read model from file as destination model is not empty.")
1515
end
16-
object = JSON.parse(io; dicttype = Dict{String,Any})
16+
object = JSON3.read(io, Dict{String,Any})
1717
file_version = _parse_mof_version(object["version"]::Dict{String,Any})
1818
if !(file_version in _SUPPORTED_VERSIONS)
1919
version = _SUPPORTED_VERSIONS[1]

src/FileFormats/MOF/write.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44
# Use of this source code is governed by an MIT-style license that can be found
55
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.
6-
using JSON3
76

87
"""
98
Base.write(io::IO, model::FileFormats.MOF.Model)
@@ -30,7 +29,7 @@ function Base.write(io::IO, model::Model)
3029
objective = objective,
3130
constraints = constraints,
3231
)
33-
Base.write(io, JSON3.write(object))
32+
JSON3.write(io, object)
3433
return
3534
end
3635

test/FileFormats/MOF/MOF.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ module TestMOF
88

99
using Test
1010

11-
import JSON
11+
import JSON3
1212
import JSONSchema
1313
import MathOptInterface as MOI
1414

1515
const MOF = MOI.FileFormats.MOF
1616

1717
const TEST_MOF_FILE = "test.mof.json"
1818

19-
const SCHEMA =
20-
JSONSchema.Schema(JSON.parsefile(MOI.FileFormats.MOF.SCHEMA_PATH))
19+
const SCHEMA = JSONSchema.Schema(
20+
open(MOI.FileFormats.MOF.SCHEMA_PATH, "r") do io
21+
return JSON3.read(io, Dict{String,Any})
22+
end,
23+
)
2124

2225
function runtests()
2326
for name in names(@__MODULE__, all = true)
@@ -39,7 +42,7 @@ function _validate(filename::String)
3942
"r",
4043
MOI.FileFormats.AutomaticCompression(),
4144
) do io
42-
object = JSON.parse(io)
45+
object = JSON3.read(io, Dict{String,Any})
4346
ret = JSONSchema.validate(SCHEMA, object)
4447
if ret !== nothing
4548
error(

0 commit comments

Comments
 (0)