Skip to content

Things to clean up in v2.0 #75

@odow

Description

@odow

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:

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

JSONSchema.jl/src/schema.jl

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:

###
### 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions