-
Notifications
You must be signed in to change notification settings - Fork 9
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 #40 from zweidenker/add-mintiems-maxitems-to-array
Repaired string schema to test if string and added minItems, maxItems…
- Loading branch information
Showing
12 changed files
with
83 additions
and
2 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...hema-Core-Tests.package/JSONSchemaDefinitionTests.class/instance/testArrayWithMaxItems.st
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,12 @@ | ||
tests | ||
testArrayWithMaxItems | ||
| schema value | | ||
schema := JSONSchema fromString: '{ | ||
"type": "array", | ||
"items": {"type": "string"}, | ||
"maxItems": 2 | ||
}'. | ||
self | ||
shouldnt: [ value := schema validate: { 'bar' } ] | ||
raise: Error. | ||
|
12 changes: 12 additions & 0 deletions
12
...-Core-Tests.package/JSONSchemaDefinitionTests.class/instance/testArrayWithMaxItemsFail.st
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,12 @@ | ||
tests | ||
testArrayWithMaxItemsFail | ||
| schema value | | ||
schema := JSONSchema fromString: '{ | ||
"type": "array", | ||
"items": {"type": "string"}, | ||
"maxItems": 2 | ||
}'. | ||
self | ||
should: [ value := schema validate: { 'bar'. 'foo' . 'baz' } ] | ||
raise: Error. | ||
|
12 changes: 12 additions & 0 deletions
12
...hema-Core-Tests.package/JSONSchemaDefinitionTests.class/instance/testArrayWithMinItems.st
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,12 @@ | ||
tests | ||
testArrayWithMinItems | ||
| schema value | | ||
schema := JSONSchema fromString: '{ | ||
"type": "array", | ||
"items": {"type": "string"}, | ||
"minItems": 1 | ||
}'. | ||
self | ||
shouldnt: [ value := schema validate: { 'bar' } ] | ||
raise: Error. | ||
|
12 changes: 12 additions & 0 deletions
12
...-Core-Tests.package/JSONSchemaDefinitionTests.class/instance/testArrayWithMinItemsFail.st
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,12 @@ | ||
tests | ||
testArrayWithMinItemsFail | ||
| schema value | | ||
schema := JSONSchema fromString: '{ | ||
"type": "array", | ||
"items": {"type": "string"}, | ||
"minItems": 2 | ||
}'. | ||
self | ||
should: [ value := schema validate: { 'foo' } ] | ||
raise: Error. | ||
|
2 changes: 1 addition & 1 deletion
2
...s/instance/testReadArrayWithEmptyItems.st → ...lass/instance/testArrayWithNoItemsSpec.st
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
2 changes: 1 addition & 1 deletion
2
...instance/testReadNoTypeWithConstraints.st → ...ass/instance/testNoTypeWithConstraints.st
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
6 changes: 6 additions & 0 deletions
6
source/JSONSchema-Core.package/JSONFormatDate.class/class/validate..st
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,6 @@ | ||
services | ||
validate: aDate | ||
(aDate isKindOf: Date) ifFalse: [ | ||
JSONTypeError | ||
signal: aDate printString , ' is not a date' ] | ||
|
6 changes: 6 additions & 0 deletions
6
source/JSONSchema-Core.package/JSONFormatDateTime.class/class/validate..st
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,6 @@ | ||
services | ||
validate: aDate | ||
(aDate isKindOf: DateAndTime) ifFalse: [ | ||
JSONTypeError | ||
signal: aDate printString , ' is not a date' ] | ||
|
6 changes: 6 additions & 0 deletions
6
source/JSONSchema-Core.package/JSONFormatURI.class/class/validate..st
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,6 @@ | ||
services | ||
validate: aUrl | ||
(aUrl isKindOf: ZnUrl) ifFalse: [ | ||
JSONTypeError | ||
signal: aUrl printString , ' is not a URL' ] | ||
|
3 changes: 3 additions & 0 deletions
3
source/JSONSchema-Core.package/JSONSchemaReference.class/instance/printOn..st
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,3 @@ | ||
printing | ||
printOn: aStream | ||
aStream << 'Reference: '<< path asString |
6 changes: 6 additions & 0 deletions
6
source/JSONSchema-Core.package/JSONStringFormat.class/class/validate..st
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,6 @@ | ||
services | ||
validate: aString | ||
aString isString ifFalse: [ | ||
JSONTypeError | ||
signal: aString printString , ' is not a string' ] | ||
|
6 changes: 6 additions & 0 deletions
6
source/JSONSchema-Core.package/JSONStringFormat.class/class/validateString..st
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,6 @@ | ||
services | ||
validateString: aString | ||
aString isString ifFalse: [ | ||
JSONTypeError | ||
signal: aString printString , ' is not a string' ] | ||
|