Skip to content
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

[MAINTENANCE] Enforce consistent JSON schema through usage stats #4499

Merged
merged 5 commits into from
Mar 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 36 additions & 34 deletions great_expectations/core/usage_statistics/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@
CLISuiteInteractiveFlagCombinations,
)

SCHEMA: str = "http://json-schema.org/draft-04/schema#"

anonymized_string_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-string",
"type": "string",
"minLength": 32,
"maxLength": 32,
}

anonymized_datasource_name_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-datasource-name",
"definitions": {"anonymized_string": anonymized_string_schema},
"anyOf": [
Expand All @@ -33,7 +35,7 @@
}

anonymized_run_time_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-run-time",
"definitions": {"anonymized_string": anonymized_string_schema},
"anyOf": [
Expand All @@ -48,7 +50,7 @@
}

anonymized_class_info_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-class-info",
"definitions": {"anonymized_string": anonymized_string_schema},
"oneOf": [
Expand All @@ -68,7 +70,7 @@
}

anonymized_datasource_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-datasource",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand Down Expand Up @@ -111,7 +113,7 @@
}

anonymized_store_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-store",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -135,7 +137,7 @@
}

anonymized_action_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-action",
"definitions": {"anonymized_string": anonymized_string_schema},
"oneOf": [
Expand All @@ -153,7 +155,7 @@
}

anonymized_action_list_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-action-list",
"definitions": {"anonymized_action": anonymized_action_schema},
"type": "array",
Expand All @@ -162,7 +164,7 @@
}

anonymized_validation_operator_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-validation-operator",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -186,15 +188,15 @@
}

empty_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "empty-payload",
"type": "object",
"properties": {},
"additionalProperties": False,
}

anonymized_data_docs_site_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-data-docs-site",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -221,7 +223,7 @@
}

anonymized_expectation_suite_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-expectation-suite",
"definitions": {"anonymized_string": anonymized_string_schema},
"oneOf": [
Expand Down Expand Up @@ -259,7 +261,7 @@
}

anonymized_init_payload_schema = {
"$schema": "https://json-schema.org/schema#",
"$schema": SCHEMA,
Comment on lines -262 to +264
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This minor deviation was causing an issue and defaulting to the latest schema (which is version 8 or so?). This was caught during the War on Warnings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that JSONSchema doesn't love HTTPS in these keys for some reason - following the docs, I kept the HTTP consistent.

"title": "anonymized-init-payload",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand Down Expand Up @@ -316,7 +318,7 @@
}

anonymized_batch_request_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-batch-request",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand Down Expand Up @@ -409,7 +411,7 @@
}

anonymized_batch_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-batch",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand Down Expand Up @@ -442,7 +444,7 @@
}

anonymized_run_validation_operator_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-run-validation-operator-payload",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -462,7 +464,7 @@
}

anonymized_validation_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-validation",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -481,7 +483,7 @@
}

anonymized_validations_list_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-validations",
"definitions": {"anonymized_validation": anonymized_validation_schema},
"type": "array",
Expand All @@ -490,7 +492,7 @@
}

anonymized_save_or_edit_expectation_suite_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-save-or-edit-expectation-suite-payload",
"definitions": {"anonymized_string": anonymized_string_schema},
"type": "object",
Expand All @@ -504,7 +506,7 @@
}

anonymized_cli_suite_expectation_suite_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-cli-suite-expectation-suite-payload",
"definitions": {"anonymized_string": anonymized_string_schema},
"type": "object",
Expand All @@ -526,7 +528,7 @@
}

anonymized_cli_suite_new_expectation_suite_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-cli-suite-new-expectation-suite-payload",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -544,7 +546,7 @@
}

anonymized_cli_suite_edit_expectation_suite_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-cli-suite-edit-expectation-suite-payload",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -563,7 +565,7 @@
}

anonymized_cli_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-cli-payload",
"type": "object",
"properties": {
Expand All @@ -579,7 +581,7 @@
}

anonymized_cli_new_ds_choice_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-cli-new-ds-choice-payload",
"type": "object",
"properties": {
Expand All @@ -593,7 +595,7 @@


anonymized_datasource_sqlalchemy_connect_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-datasource-sqlalchemy-connect-payload",
"type": "object",
"properties": {
Expand All @@ -605,7 +607,7 @@
}

anonymized_test_yaml_config_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-test-yaml-config-payload",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand Down Expand Up @@ -644,7 +646,7 @@
}

anonymized_checkpoint_run_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-checkpoint-run-payload",
"definitions": {
"empty_payload": empty_payload_schema,
Expand Down Expand Up @@ -708,7 +710,7 @@
}

anonymized_legacy_profiler_build_suite_payload_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-legacy-profiler-build-suite-payload",
"type": "object",
"properties": {
Expand Down Expand Up @@ -751,7 +753,7 @@
}

anonymized_domain_builder_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-domain-builder",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -769,7 +771,7 @@
}

anonymized_parameter_builder_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-parameter-builder",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -788,7 +790,7 @@
}

anonymized_expectation_configuration_builder_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-expectation-configuration-builder",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand All @@ -806,7 +808,7 @@
}

anonymized_rule_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-rules",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand Down Expand Up @@ -840,7 +842,7 @@
}

anonymized_rule_based_profiler_run_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-rule-based-profiler-run-payload",
"definitions": {
"empty_payload": empty_payload_schema,
Expand Down Expand Up @@ -880,7 +882,7 @@
}

anonymized_usage_statistics_record_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$schema": SCHEMA,
"title": "anonymized-usage-statistics-record",
"definitions": {
"anonymized_string": anonymized_string_schema,
Expand Down