runapi-core 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {runapi_core-0.1.2 → runapi_core-0.1.3}/PKG-INFO +1 -1
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/contract_gen.py +16 -7
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/resource.py +6 -3
- runapi_core-0.1.3/src/runapi/core/version.py +1 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/tests/test_resource.py +18 -0
- runapi_core-0.1.2/src/runapi/core/version.py +0 -1
- {runapi_core-0.1.2 → runapi_core-0.1.3}/README.md +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/pyproject.toml +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/__init__.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/auth.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/config.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/constants.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/errors.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/files.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/http_client.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/models.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/multipart.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/options.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/polling.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/py.typed +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/src/runapi/core/response.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/tests/test_auth.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/tests/test_config.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/tests/test_errors.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/tests/test_files.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/tests/test_http_client.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/tests/test_models.py +0 -0
- {runapi_core-0.1.2 → runapi_core-0.1.3}/tests/test_polling.py +0 -0
|
@@ -478,10 +478,7 @@ CONTRACT = {
|
|
|
478
478
|
},
|
|
479
479
|
"imagen-4-fast": {
|
|
480
480
|
"aspect_ratio": {
|
|
481
|
-
"enum": ["1:1", "16:9", "9:16", "3:4", "4:3"]
|
|
482
|
-
},
|
|
483
|
-
"output_count": {
|
|
484
|
-
"enum": [1, 2, 3, 4]
|
|
481
|
+
"enum": ["1:1", "16:9", "9:16", "3:4", "4:3", "auto"]
|
|
485
482
|
}
|
|
486
483
|
},
|
|
487
484
|
"imagen-4-ultra": {
|
|
@@ -730,7 +727,7 @@ CONTRACT = {
|
|
|
730
727
|
}
|
|
731
728
|
},
|
|
732
729
|
"seedance/text-to-video": {
|
|
733
|
-
"models": ["seedance-1.5-pro", "seedance-2.0", "seedance-2.0-fast", "seedance-v1-lite", "seedance-v1-pro", "seedance-v1-pro-fast"],
|
|
730
|
+
"models": ["seedance-1.5-pro", "seedance-2-mini", "seedance-2.0", "seedance-2.0-fast", "seedance-v1-lite", "seedance-v1-pro", "seedance-v1-pro-fast"],
|
|
734
731
|
"fields_by_model": {
|
|
735
732
|
"seedance-1.5-pro": {
|
|
736
733
|
"aspect_ratio": {
|
|
@@ -740,12 +737,20 @@ CONTRACT = {
|
|
|
740
737
|
"enum": ["480p", "720p", "1080p"]
|
|
741
738
|
}
|
|
742
739
|
},
|
|
740
|
+
"seedance-2-mini": {
|
|
741
|
+
"aspect_ratio": {
|
|
742
|
+
"enum": ["1:1", "4:3", "3:4", "16:9", "9:16", "21:9", "auto"]
|
|
743
|
+
},
|
|
744
|
+
"output_resolution": {
|
|
745
|
+
"enum": ["480p", "720p"]
|
|
746
|
+
}
|
|
747
|
+
},
|
|
743
748
|
"seedance-2.0": {
|
|
744
749
|
"aspect_ratio": {
|
|
745
750
|
"enum": ["1:1", "4:3", "3:4", "16:9", "9:16", "21:9", "auto"]
|
|
746
751
|
},
|
|
747
752
|
"output_resolution": {
|
|
748
|
-
"enum": ["480p", "720p", "1080p"]
|
|
753
|
+
"enum": ["480p", "720p", "1080p", "4k"]
|
|
749
754
|
}
|
|
750
755
|
},
|
|
751
756
|
"seedance-2.0-fast": {
|
|
@@ -1167,7 +1172,11 @@ CONTRACT = {
|
|
|
1167
1172
|
"suno/replace-section": {
|
|
1168
1173
|
"models": [],
|
|
1169
1174
|
"fields_by_model": {
|
|
1170
|
-
"_": {
|
|
1175
|
+
"_": {
|
|
1176
|
+
"model": {
|
|
1177
|
+
"enum": ["suno-v4", "suno-v4.5", "suno-v4.5-all", "suno-v4.5-plus", "suno-v5", "suno-v5.5"]
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1171
1180
|
}
|
|
1172
1181
|
},
|
|
1173
1182
|
"suno/separate-audio-stems": {
|
|
@@ -66,10 +66,13 @@ class Resource:
|
|
|
66
66
|
def _validate_contract(self, schema: Dict[str, Any], params: Dict[str, Any]) -> None:
|
|
67
67
|
model = params.get("model")
|
|
68
68
|
models = schema.get("models", [])
|
|
69
|
-
if
|
|
70
|
-
|
|
69
|
+
if models:
|
|
70
|
+
if model not in models:
|
|
71
|
+
raise ValidationError(f"model must be one of: {', '.join(sorted(models))}")
|
|
72
|
+
fields = schema.get("fields_by_model", {}).get(model, {})
|
|
73
|
+
else:
|
|
74
|
+
fields = schema.get("fields_by_model", {}).get("_", {})
|
|
71
75
|
|
|
72
|
-
fields = schema.get("fields_by_model", {}).get(model, {})
|
|
73
76
|
for field, rules in fields.items():
|
|
74
77
|
self._validate_schema_field(params, field, rules)
|
|
75
78
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.3"
|
|
@@ -109,6 +109,24 @@ def test_validate_integer_still_enforces_range_for_valid_int():
|
|
|
109
109
|
assert _run_validate({"model": "m", "duration_int": 13}) == "duration_int must be between 4 and 12"
|
|
110
110
|
|
|
111
111
|
|
|
112
|
+
def test_validate_functional_action_uses_underscore_fields():
|
|
113
|
+
resource = SampleResource(FakeHttp())
|
|
114
|
+
schema = {
|
|
115
|
+
"models": [],
|
|
116
|
+
"fields_by_model": {
|
|
117
|
+
"_": {
|
|
118
|
+
"prompt": {"required": True},
|
|
119
|
+
"mode": {"enum": ["fast", "quality"]},
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
resource._validate_contract(schema, {"prompt": "hello", "mode": "fast"})
|
|
124
|
+
with pytest.raises(ValidationError, match="prompt is required"):
|
|
125
|
+
resource._validate_contract(schema, {"mode": "fast"})
|
|
126
|
+
with pytest.raises(ValidationError, match="mode must be one of: fast, quality"):
|
|
127
|
+
resource._validate_contract(schema, {"prompt": "hello", "mode": "slow"})
|
|
128
|
+
|
|
129
|
+
|
|
112
130
|
def test_validate_integer_rejects_bool_and_whole_float():
|
|
113
131
|
# bool is an int subclass but is not a valid integer value.
|
|
114
132
|
assert _run_validate({"model": "m", "tolerance": True}) == "tolerance must be an integer"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|