Closed spinx closed 5 years ago
Hi @spinx!
I'm getting this error when linting your schema:
~/foo > igluctl-0.6.0 lint com.test 20:00:52
Cannot read [com.test]: no valid JSON Schemas
Cannot parse [com.test/test_schema/jsonschema/1-0-0]: Unexpected character ('}' (code 125)): was expecting double-quote to start field name
at [Source: {
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Test.",
"self": {
"vendor": "com.test",
"name": "test_schema",
"format": "jsonschema",
"version": "1-0-0"
},
"type": "object",
"properties": {
"prop": {
"description": "Test prop",
"enum": ["test"]
},
},
"minProperties": 1,
"required": [
"prop"
],
"additionalProperties": false
}
; line: 18, column: 4]
TOTAL: 2 files corrupted
Also igluctl properly returns 1 exit code.
Do you mean that igluctl static push
will publish this schema onto the server instead of rejecting it?
@chuwy see this: https://github.com/spinx/igluctl-bug
Indeed, it seems that it works properly when I specify vendor or name:
igluctl-bug:master > igluctl-0.6.0 lint schemas/com.test.invalid/test_schema 20:33:10
Cannot read [schemas/com.test.invalid/test_schema]: no valid JSON Schemas
Cannot parse [schemas/com.test.invalid/test_schema/jsonschema/1-0-0]: Unexpected character ('}' (code 125)): was expecting double-quote to start field name
at [Source: {
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Test.",
"self": {
"vendor": "com.test.invalid",
"name": "test_schema",
"format": "jsonschema",
"version": "1-0-0"
},
"type": "object",
"properties": {
"prop": {
"description": "Test prop",
"enum": ["test"]
},
},
"minProperties": 1,
"required": [
"prop"
],
"additionalProperties": false
}; line: 18, column: 4]
TOTAL: 2 files corrupted
But ignores these schemas when I specify root of schemas:
igluctl-bug:master > igluctl-0.6.0 lint schemas 20:33:39
OK: com.test.valid/test_schema/jsonschema/1-0-0
OK: com.businessoffashion.app/article_save/jsonschema/1-0-0
OK: com.businessoffashion.app/banner_tap/jsonschema/1-0-0
OK: com.businessoffashion.app/banner_view/jsonschema/1-0-0
OK: com.businessoffashion.app/content_context/jsonschema/1-0-0
OK: com.businessoffashion.app/device_context/jsonschema/1-0-0
OK: com.businessoffashion.app/environment_context/jsonschema/1-0-0
OK: com.businessoffashion.app/error_shown/jsonschema/1-0-0
OK: com.businessoffashion.app/login/jsonschema/1-0-0
OK: com.businessoffashion.app/login_forgot_password/jsonschema/1-0-0
OK: com.businessoffashion.app/logout/jsonschema/1-0-0
OK: com.businessoffashion.app/notification_opened/jsonschema/1-0-0
OK: com.businessoffashion.app/notification_sent/jsonschema/1-0-0
OK: com.businessoffashion.app/screen_context/jsonschema/1-0-0
OK: com.businessoffashion.app/screen_view/jsonschema/1-0-0
OK: com.businessoffashion.app/share/jsonschema/1-0-0
TOTAL: 16 valid schemas
TOTAL: 0 schemas didn't pass validation
Thanks for the report!
varsion: igluctl 0.6.0 schema: gist
On line 16 in the schema there's a colon that shouldn't be there.
If you run
igluctl lint schemas/
from the project root, this file is ignored because it's not passing validation, and the lint passes incorrectly. On 0.5.0 this correctly results in an error, but in 0.6.0 it does nothing.Same thing happens for other validation errors.
This means invalid schemas are potentially deployed to our production via CI