From c38013fc5a46322b64819f64cffbc292ce8b0977 Mon Sep 17 00:00:00 2001 From: andreasjansson Date: Tue, 4 Nov 2025 16:15:21 +0100 Subject: [PATCH 1/6] Skip description requirement for deprecated inputs --- cog_safe_push/schema.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cog_safe_push/schema.py b/cog_safe_push/schema.py index 924a14d..0bcd722 100644 --- a/cog_safe_push/schema.py +++ b/cog_safe_push/schema.py @@ -13,6 +13,8 @@ def lint(model: Model, train: bool): schema = get_openapi_schema(model) properties = schema["components"]["schemas"][input_name]["properties"] for name, spec in properties.items(): + if spec.get("deprecated", False): + continue description = spec.get("description") if not description: errors.append(f"{name}: Missing description") From 9a9f9cacf598a9139cc8ebd9437f0f9d8193ad07 Mon Sep 17 00:00:00 2001 From: andreasjansson Date: Tue, 4 Nov 2025 16:15:26 +0100 Subject: [PATCH 2/6] Add test for deprecated inputs not requiring description --- test/test_schema.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_schema.py b/test/test_schema.py index 73ced9d..658f9ce 100644 --- a/test/test_schema.py +++ b/test/test_schema.py @@ -1,6 +1,7 @@ import pytest +from unittest.mock import Mock -from cog_safe_push.schema import IncompatibleSchemaError, check_backwards_compatible +from cog_safe_push.schema import IncompatibleSchemaError, check_backwards_compatible, lint def test_identical_schemas(): From 71891df96d24d68119d2b8729e296181e6c8a13c Mon Sep 17 00:00:00 2001 From: andreasjansson Date: Tue, 4 Nov 2025 16:15:42 +0100 Subject: [PATCH 3/6] Add test for deprecated inputs not requiring description --- test/test_schema.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/test_schema.py b/test/test_schema.py index 658f9ce..2bf05cd 100644 --- a/test/test_schema.py +++ b/test/test_schema.py @@ -194,3 +194,33 @@ def test_multiple_incompatibilities(): assert "Input choice is missing choices: 'C'" in error_message assert "Input new_required is new and is required" in error_message assert "Output has changed type" in error_message + + +def test_lint_deprecated_input_without_description(): + mock_model = Mock() + mock_model.versions.list.return_value = [ + Mock( + openapi_schema={ + "components": { + "schemas": { + "Input": { + "properties": { + "steps": { + "type": "integer", + "minimum": 1, + "maximum": 50, + "default": 25, + "deprecated": True, + }, + "prompt": { + "type": "string", + "description": "The prompt to use", + }, + } + } + } + } + } + ) + ] + lint(mock_model, train=False) From b41c94bcf9b52a020bde0921ebe3aee60355ac2f Mon Sep 17 00:00:00 2001 From: andreasjansson Date: Tue, 4 Nov 2025 16:15:53 +0100 Subject: [PATCH 4/6] Add test for non-deprecated inputs requiring description --- test/test_schema.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/test_schema.py b/test/test_schema.py index 2bf05cd..88b89a9 100644 --- a/test/test_schema.py +++ b/test/test_schema.py @@ -1,7 +1,12 @@ import pytest from unittest.mock import Mock -from cog_safe_push.schema import IncompatibleSchemaError, check_backwards_compatible, lint +from cog_safe_push.schema import ( + IncompatibleSchemaError, + SchemaLintError, + check_backwards_compatible, + lint, +) def test_identical_schemas(): From edf6435b32bfdd0063a07be96f343e2573f8fb04 Mon Sep 17 00:00:00 2001 From: andreasjansson Date: Tue, 4 Nov 2025 16:16:03 +0100 Subject: [PATCH 5/6] Add test for non-deprecated inputs requiring description --- test/test_schema.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/test_schema.py b/test/test_schema.py index 88b89a9..3455ad4 100644 --- a/test/test_schema.py +++ b/test/test_schema.py @@ -229,3 +229,29 @@ def test_lint_deprecated_input_without_description(): ) ] lint(mock_model, train=False) + + +def test_lint_non_deprecated_input_without_description(): + mock_model = Mock() + mock_model.versions.list.return_value = [ + Mock( + openapi_schema={ + "components": { + "schemas": { + "Input": { + "properties": { + "steps": { + "type": "integer", + "minimum": 1, + "maximum": 50, + "default": 25, + }, + } + } + } + } + } + ) + ] + with pytest.raises(SchemaLintError, match="steps: Missing description"): + lint(mock_model, train=False) From 9053f8d6bae328922bfbede62484b234aac42f90 Mon Sep 17 00:00:00 2001 From: andreasjansson Date: Tue, 4 Nov 2025 16:20:24 +0100 Subject: [PATCH 6/6] lint --- test/test_schema.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_schema.py b/test/test_schema.py index 3455ad4..037d645 100644 --- a/test/test_schema.py +++ b/test/test_schema.py @@ -1,6 +1,7 @@ -import pytest from unittest.mock import Mock +import pytest + from cog_safe_push.schema import ( IncompatibleSchemaError, SchemaLintError,