Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
text-generation-inference
Commits
f15e808d
Unverified
Commit
f15e808d
authored
Jul 29, 2024
by
drbh
Committed by
GitHub
Jul 29, 2024
Browse files
fix: reject grammars without properties (#2309)
parent
922732b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
router/src/validation.rs
router/src/validation.rs
+8
-0
No files found.
router/src/validation.rs
View file @
f15e808d
...
...
@@ -353,6 +353,14 @@ impl Validation {
.compile
(
&
json
)
.map_err
(|
e
|
ValidationError
::
InvalidGrammar
(
e
.to_string
()))
?
;
// The schema can be valid but lack properties.
// We need properties for the grammar to be successfully parsed in Python.
// Therefore, we must check and throw an error if properties are missing.
json
.get
(
"properties"
)
.ok_or
(
ValidationError
::
InvalidGrammar
(
"Grammar must have a 'properties' field"
.to_string
(),
))
?
;
// Serialize json to string
ValidGrammar
::
Json
(
serde_json
::
to_string
(
&
json
)
...
...
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