-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DISCO-2325] Create JSON Schema Validation for Control Mechanism #93
[DISCO-2325] Create JSON Schema Validation for Control Mechanism #93
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some tiny things, but tyty for getting this done 🙂
.env.example
Outdated
DB_USER=postgres | ||
DB_HOST=localhost | ||
DB_PASS=postgres | ||
DJANGO_SETTINGS_MODULE=consvc_shepherd.settings | ||
OPENIDC_HEADER_PREFIX="accounts.google.com:" | ||
OPENIDC_HEADER="x-goog" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets move this out since it's included in your last PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! I may just match to what's on main
now and there shouldn't be any conflicts when merging.
# DS_Store files for macOS | ||
**/.DS_Store | ||
|
||
# VS Code configuration files | ||
.vscode/* | ||
!.vscode/launch.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
consvc_shepherd/admin.py
Outdated
@@ -22,7 +22,7 @@ def publish_snapshot(modeladmin, request, queryset): | |||
snapshot.launched_by = request.user | |||
snapshot.launched_date = timezone.now() | |||
content = json.dumps(snapshot.json_settings, indent=2) | |||
with open("./schema/shepherd.schema.json", "r") as f: | |||
with open("./schema/filter.schema.json", "r") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually can we rename it as adm_filter instead? sorry 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, wfm! 👍
schema/test_schema.py
Outdated
@@ -10,7 +10,7 @@ class JSONSchema(TestCase): | |||
|
|||
def test_schema(self): | |||
|
|||
with open("./schema/shepherd.schema.json", "r") as f: | |||
with open("./schema/filter.schema.json", "r") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here please and thank you
@@ -0,0 +1,56 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! We'll add tests when Shepherd is able to produce json!
References
JIRA: DISCO-2325
GitHub: #95
Description
The goal of this task is to create the new JSON Schema for the Allocations of Kevel and adM partner advertisements. The document allows the distribution of ads by percentage supplying a percentage from 0 - 100 between the two and their occurrence in the array/list defines the Contile tiles from left to right, or the 0th index up.
The schema has description values for each key which supply sufficient context for anyone viewing the ticket.
Note: this task is only to create the valid schema. Subsequent tickets will cover the validation process, tests and potentially defining a model for this data.
A lengthy regex has been supplied to validate the title label in the format:
SOV-<UTC datetime:YYYYMMDDHHMMSS>
. For readability, here are the capture groups and their restrictions as it's not super readable in the JSON. We want an accurate representation of actual correct datetimes, hence the need to define multiple capture groups that ensure Y, M, D, h, m, s values are correctSee JSON Schema docs on regex matching here