Skip to content

Commit 2c17795

Browse files
authored
Merge pull request #10 from JulianvDoorn/fix-schema-generation-for-array-types
Fix parsing of array types
2 parents 308fb07 + 733954d commit 2c17795

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JSONSchemaGenerator"
22
uuid = "b10a6b5e-eaef-4b72-b159-8e5005e98e8e"
33
authors = ["matthijscox <[email protected]> and contributors"]
4-
version = "0.3.0"
4+
version = "0.3.1"
55

66
[deps]
77
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

src/JSONSchemaGenerator.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function schema(
9696
reference_types = reference_types,
9797
dict_type = dict_type,
9898
)
99-
d = _generate_json_object(schema_type, settings)
99+
d = _generate_json_type_def(schema_type, settings)
100100
return d
101101
end
102102

test/runtests.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,18 @@ end
332332
@test_throws Exception bad_combo_schema2 = JSONSchemaGenerator.schema(TestTypes.BadBooleanCombinationSchema2)
333333
end
334334
end
335+
336+
@testset "Vector{T} Regression Test" begin
337+
@testset "Int" begin
338+
int_array_schema = JSONSchemaGenerator.schema(Vector{Int})
339+
@test int_array_schema["type"] == "array"
340+
@test int_array_schema["items"]["type"] == "integer"
341+
end
342+
343+
@testset "Nested" begin
344+
nested_array_schema = JSONSchemaGenerator.schema(Vector{Vector{Int}})
345+
@test nested_array_schema["type"] == "array"
346+
@test nested_array_schema["items"]["type"] == "array"
347+
@test nested_array_schema["items"]["items"]["type"] == "integer"
348+
end
349+
end

0 commit comments

Comments
 (0)