Skip to content

Commit

Permalink
fix: Changing OCDS validations is prohibited
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Dec 15, 2024
1 parent 78724b2 commit 1d06353
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions extension_explorer/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from flask import url_for
from flask_babel import gettext, ngettext
from markdown_it import MarkdownIt
from ocdsextensionregistry.util import remove_nulls
from ocdskit.schema import get_schema_fields
from pygments import highlight
from pygments.formatters import HtmlFormatter
Expand Down Expand Up @@ -243,7 +244,10 @@ def get_schema_tables(extension_version, lang):
schema = _patch_schema(extension_version, 'en', include_test_dependencies=True)
sources = _get_sources(schema, lang)

for field in get_schema_fields(extension_version['schemas']['release-schema.json'][lang]):
patch = extension_version['schemas']['release-schema.json'][lang]
remove_nulls(patch)

for field in get_schema_fields(patch):
# If the field is removed.
if field.schema is None:
continue
Expand All @@ -258,7 +262,8 @@ def get_schema_tables(extension_version, lang):
tables[key]['source'] = sources[field.definition]

d = field.asdict(
sep='.', exclude=('name', 'deprecated', 'pointer', 'pattern', 'required', 'merge_by_id'),
sep='.',
exclude=('name', 'deprecated_self', 'deprecated', 'pointer', 'pattern', 'required', 'merge_by_id'),
)
with contextlib.suppress(jsonpointer.JsonPointerException):
_, d['url'] = _add_link_to_original_field(field, schema, sources)
Expand Down Expand Up @@ -460,7 +465,9 @@ def _patch_schema_recursive(schema, version, lang, *, include_test_dependencies=

for url in dependencies:
version = extension_versions_by_base_url[url[:-14]] # remove "extension.json"

patch = version['schemas']['release-schema.json'][lang]
remove_nulls(patch)

# Make it possible to determine the source of the definitions.
for name, definition in patch.get('definitions', {}).items():
Expand Down

0 comments on commit 1d06353

Please sign in to comment.