Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
918badaf
Commit
918badaf
authored
8 years ago
by
Megan Henning
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in download.json
parent
2a3cab8d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/schemas/input/download.json
+4
-4
4 additions, 4 deletions
api/schemas/input/download.json
api/validators.py
+6
-10
6 additions, 10 deletions
api/validators.py
with
10 additions
and
14 deletions
api/schemas/input/download.json
+
4
−
4
View file @
918badaf
{
"id"
:
"#"
,
"$schema"
:
"http://json-schema.org/draft-04/schema#"
,
"definitions"
:
{
"filterDefinition"
:
{
...
...
@@ -7,7 +6,8 @@
"properties"
:
{
"+"
:
{
"$ref"
:
"#/definitions/filterItems"
},
"-"
:
{
"$ref"
:
"#/definitions/filterItems"
}
}
},
"additionalProperties"
:
false
},
"filterItems"
:
{
"type"
:
"array"
,
...
...
@@ -48,8 +48,8 @@
"items"
:
{
"type"
:
"object"
,
"properties"
:
{
"tags"
:
{
"$ref"
:
"
download.json
#/definitions/filterDefinition"
},
"types"
:
{
"$ref"
:
"
download.json
#/definitions/filterDefinition"
}
"tags"
:
{
"$ref"
:
"#/definitions/filterDefinition"
},
"types"
:
{
"$ref"
:
"#/definitions/filterDefinition"
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
api/validators.py
+
6
−
10
View file @
918badaf
...
...
@@ -2,10 +2,6 @@ import copy
import
json
import
jsonschema
import
os
import
re
import
requests
from
jsonschema.compat
import
urlopen
,
urlsplit
from
.
import
config
...
...
@@ -36,14 +32,14 @@ def _validate_json(json_data, schema, resolver):
# We store the resolvers for each base_uri we use, so that we reuse the schemas cached by the resolvers.
resolvers
=
{}
def
_resolve_schema
(
schema_uri
):
base_uri
=
os
.
path
.
dirname
(
schema_uri
)
if
not
resolvers
.
get
(
base_uri
)
:
with
open
(
schema_uri
)
as
schema_file
:
def
_resolve_schema
(
schema_
file_
uri
):
if
not
resolvers
.
get
(
schema_
file_
uri
)
:
with
open
(
schema_file_uri
)
as
schema_file
:
base_uri
=
os
.
path
.
dirname
(
schema_file
_uri
)
schema
=
json
.
load
(
schema_file
)
resolver
=
jsonschema
.
RefResolver
(
'
file://
'
+
base_uri
+
'
/
'
,
schema
)
resolvers
[
bas
e_uri
]
=
(
schema
,
resolver
)
return
resolvers
[
bas
e_uri
]
resolvers
[
schema_fil
e_uri
]
=
(
schema
,
resolver
)
return
resolvers
[
schema_fil
e_uri
]
def
no_op
(
g
,
*
args
):
# pylint: disable=unused-argument
return
g
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment