-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Formatting
I can't deal with code that isn't formatted anymore.
Tests
Get back to 100% code coverage (or as near to it as possible). There is currently a bunch of untested code.
Code style
There are many isa when we can use dispatch. Here's one example:
Lines 70 to 73 in 3c5bb85
| function Schema(spec) | |
| spec_obj = spec isa Object ? spec : Object{String, Any}(spec) | |
| return Schema{Any}(Any, spec_obj, nothing) | |
| end |
I don't know what the point of this part is
Lines 302 to 304 in 3c5bb85
| elseif T === Int || T === Int64 || T === Int32 || T === Int16 || T === Int8 || | |
| T === UInt || T === UInt64 || T === UInt32 || T === UInt16 || T === UInt8 || | |
| T <: Integer |
Surely it's just T <: Integer
Split schema validation and schema generation
There are really two separate things here. The current file is a bit confusing to me
The validation code
v2 has changed how we structure the validation code. I used to use dispatch to separate out each thing in the schema:
JSONSchema.jl/src/validation.jl
Lines 138 to 151 in 3e01774
| ### | |
| ### Core JSON Schema | |
| ### | |
| # 9.2.1.1 | |
| function _validate(x, schema, ::Val{:allOf}, val::AbstractVector, path::String) | |
| for v in val | |
| ret = _validate(x, v, path) | |
| if ret !== nothing | |
| return ret | |
| end | |
| end | |
| return | |
| end |
This made it easy to reason about what parts of the schema were covered and not. I think it's a shame to loose that.