-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from E-xyza/1.1.2-bugfix-degeneracy-detection
1.1.2 bugfix degeneracy detection
- Loading branch information
Showing
5 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
defmodule ExonerateTest.Regression.NestedStringTypeTest do | ||
use ExUnit.Case, async: true | ||
require Exonerate | ||
|
||
# contributed by @ahacking (issue #78). This is due to | ||
# degeneracy testing across jumps in the schema not respecting | ||
# type being a single string instead of an array. | ||
|
||
Exonerate.function_from_string(:def, :validate_api, ~S""" | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "JSON validation failure", | ||
"type": "object", | ||
"id": "https://example.com/fail.json", | ||
"definitions": { | ||
"versionType": { | ||
"type": "string", | ||
"enum": [ "1.0", "1.1", "2.0" ] | ||
} | ||
}, | ||
"properties": { | ||
"version": { "$ref": "#/definitions/versionType" } | ||
}, | ||
"required": [ "version" ] | ||
} | ||
""") | ||
|
||
test "regression passes" do | ||
assert :ok = validate_api(%{"version" => "1.1"} ) | ||
end | ||
end |