Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
JSON
Short JSON Schema
Commits
8db866fc
Commit
8db866fc
authored
Oct 18, 2019
by
Paul Warren
Browse files
Support for comments
parent
8b2f14cc
Pipeline
#106
canceled with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
shortjsonschema/expand.py
View file @
8db866fc
...
...
@@ -28,7 +28,7 @@ class Parser:
return
schema
def
eat_whitespace
(
self
):
self
.
get_token
(
r
'\s*'
)
self
.
get_token
(
r
'
(?m)\s*(--[^\r\n]*$)?
\s*'
)
def
parse_object
(
self
,
x
):
x
.
add_type
(
"object"
)
...
...
@@ -64,10 +64,10 @@ class Parser:
c
.
add_type
(
"string"
);
elif
self
.
get_token
(
'\#'
):
c
.
add_type
(
"number"
);
elif
self
.
get_token
(
'\%'
):
c
.
add_type
(
"boolean"
);
elif
self
.
get_token
(
'\^'
):
elif
self
.
get_token
(
'B'
):
c
.
add_type
(
"boolean"
);
elif
self
.
get_token
(
'\~'
):
c
.
add_type
(
"null"
);
elif
self
.
get_token
(
'\{'
):
self
.
parse_object
(
c
)
elif
self
.
get_token
(
'\['
):
...
...
shortjsonschema/tests/test_short_schema.py
View file @
8db866fc
...
...
@@ -33,7 +33,7 @@ def test_short_schema():
"input"
:
"""
{
thing?:{
subthing1?:$,
subthing1?:$,
-- with comment
subthing2:$,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment