-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add schema errors to cli json (#184)
* Add schema errors to cli json * Move constraints into a nested object * Map constraints in a > 2.1.0 friendly way * Bump version
- Loading branch information
Showing
4 changed files
with
51 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,6 +123,32 @@ Feature: CSVlint CLI | |
And the output should contain "1. Id: min_length. Row: 2,2. 5" | ||
And the output should contain "1. malformed_header. Row: 1. Bob,1234,[email protected]" | ||
|
||
Scenario: Schema errors with JSON | ||
Given I have a CSV with the following content: | ||
""" | ||
"Bob","1234","[email protected]" | ||
"Alice","5","[email protected]" | ||
""" | ||
And it is stored at the url "http://example.com/example1.csv" | ||
And I have a schema with the following content: | ||
""" | ||
{ | ||
"fields": [ | ||
{ "name": "Name", "constraints": { "required": true } }, | ||
{ "name": "Id", "constraints": { "required": true, "minLength": 3 } }, | ||
{ "name": "Email", "constraints": { "required": true } } | ||
] | ||
} | ||
""" | ||
And the schema is stored at the url "http://example.com/schema.json" | ||
When I run `csvlint http://example.com/example1.csv --schema http://example.com/schema.json --json` | ||
Then the output should contain JSON | ||
And the JSON should have a state of "invalid" | ||
And the JSON should have 1 error | ||
And error 1 should have the "type" "min_length" | ||
And error 1 should have the "header" "Id" | ||
And error 1 should have the constraint "min_length" "3" | ||
|
||
Scenario: Invalid schema | ||
Given I have a CSV with the following content: | ||
""" | ||
|
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Csvlint | ||
VERSION = "0.3.1" | ||
VERSION = "0.3.2" | ||
end |