Skip to content

Commit ce0de5c

Browse files
authored
Merge pull request #308 from python-jsonschema/remove-old-disable-formats
Remove the deprecated disable-format flag
2 parents 32bb260 + 0280ed5 commit ce0de5c

File tree

4 files changed

+4
-32
lines changed

4 files changed

+4
-32
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Unreleased
1313
default. (:issue:`302`)
1414
- The ``--format-regex disabled`` option has been removed. Users should use
1515
``--disable-formats regex`` if they wish to disable regex format checking.
16+
- The deprecated ``--disable-format`` flag has been removed. Users should use
17+
``--disable-formats "*"`` if they wish to disable all format checking.
1618

1719
0.25.0
1820
------

docs/usage.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,6 @@ that any validation for formats be applied.
136136
``check-jsonschema`` supports checking several ``"format"``\s by default. The
137137
following options can be used to control this behavior.
138138

139-
``--disable-format``
140-
~~~~~~~~~~~~~~~~~~~~
141-
142-
.. warning::
143-
144-
This option is deprecated. Use ``--disable-formats "*"`` instead.
145-
146-
Disable all format checks.
147-
148139
``--disable-formats``
149140
~~~~~~~~~~~~~~~~~~~~~
150141

src/check_jsonschema/cli/main_command.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from ..transforms import TRANSFORM_LIBRARY
2121
from .param_types import CommaDelimitedList
2222
from .parse_result import ParseResult, SchemaLoadingMode
23-
from .warnings import deprecation_warning_callback
2423

2524
BUILTIN_SCHEMA_NAMES = [f"vendor.{k}" for k in SCHEMA_CATALOG.keys()] + [
2625
f"custom.{k}" for k in CUSTOM_SCHEMA_NAMES
@@ -127,17 +126,6 @@ def pretty_helptext_list(values: list[str] | tuple[str, ...]) -> str:
127126
"Defaults to the last slash-delimited part of the URI."
128127
),
129128
)
130-
@click.option(
131-
"--disable-format",
132-
is_flag=True,
133-
help="{deprecated} Disable all format checks in the schema.",
134-
callback=deprecation_warning_callback(
135-
"--disable-format",
136-
is_flag=True,
137-
append_message="Users should now pass '--disable-formats \"*\"' for "
138-
"the same functionality.",
139-
),
140-
)
141129
@click.option(
142130
"--disable-formats",
143131
multiple=True,
@@ -223,7 +211,6 @@ def main(
223211
check_metaschema: bool,
224212
no_cache: bool,
225213
cache_filename: str | None,
226-
disable_format: bool,
227214
disable_formats: tuple[list[str], ...],
228215
format_regex: str,
229216
default_filetype: str,
@@ -244,10 +231,11 @@ def main(
244231
normalized_disable_formats: tuple[str, ...] = tuple(
245232
f for sublist in disable_formats for f in sublist
246233
)
247-
if disable_format or "*" in normalized_disable_formats:
234+
if "*" in normalized_disable_formats:
248235
args.disable_all_formats = True
249236
else:
250237
args.disable_formats = normalized_disable_formats
238+
251239
args.format_regex = RegexVariantName(format_regex)
252240
args.disable_cache = no_cache
253241
args.default_filetype = default_filetype

tests/unit/test_cli_parse.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,12 +258,3 @@ def test_disable_all_formats(runner, mock_parse_result, addargs):
258258
+ addargs,
259259
)
260260
assert mock_parse_result.disable_all_formats is True
261-
262-
263-
def test_disable_format_deprecated_flag(runner, mock_parse_result):
264-
# this should be an override, with or without other args
265-
with pytest.warns(UserWarning, match="'--disable-format' is deprecated"):
266-
runner.invoke(
267-
cli_main, ["--schemafile", "schema.json", "foo.json", "--disable-format"]
268-
)
269-
assert mock_parse_result.disable_all_formats is True

0 commit comments

Comments
 (0)