unitysvc-core 0.2.15__tar.gz → 0.2.16__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.
Files changed (41) hide show
  1. {unitysvc_core-0.2.15/src/unitysvc_core.egg-info → unitysvc_core-0.2.16}/PKG-INFO +1 -1
  2. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/pyproject.toml +1 -1
  3. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/validators.py +15 -0
  4. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16/src/unitysvc_core.egg-info}/PKG-INFO +1 -1
  5. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/tests/test_validator.py +30 -0
  6. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/LICENSE +0 -0
  7. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/README.md +0 -0
  8. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/setup.cfg +0 -0
  9. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/__init__.py +0 -0
  10. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/__init__.py +0 -0
  11. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/base.py +0 -0
  12. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/documents.py +0 -0
  13. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/listing_data.py +0 -0
  14. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/listing_v1.py +0 -0
  15. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/offering_data.py +0 -0
  16. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/offering_v1.py +0 -0
  17. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/pricing.py +0 -0
  18. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/promotion_data.py +0 -0
  19. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/provider_data.py +0 -0
  20. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/provider_v1.py +0 -0
  21. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/service.py +0 -0
  22. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/models/service_group_data.py +0 -0
  23. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/py.typed +0 -0
  24. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/schema/base.json +0 -0
  25. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/schema/listing_v1.json +0 -0
  26. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/schema/offering_v1.json +0 -0
  27. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/schema/promotion_v1.json +0 -0
  28. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/schema/provider_v1.json +0 -0
  29. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/schema/service_group_v1.json +0 -0
  30. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/utils.py +0 -0
  31. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core/validator.py +0 -0
  32. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core.egg-info/SOURCES.txt +0 -0
  33. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core.egg-info/dependency_links.txt +0 -0
  34. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core.egg-info/requires.txt +0 -0
  35. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/src/unitysvc_core.egg-info/top_level.txt +0 -0
  36. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/tests/test_access_interface_routing.py +0 -0
  37. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/tests/test_pricing.py +0 -0
  38. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/tests/test_service_group.py +0 -0
  39. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/tests/test_service_status.py +0 -0
  40. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/tests/test_utils.py +0 -0
  41. {unitysvc_core-0.2.15 → unitysvc_core-0.2.16}/tests/test_validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitysvc-core
3
- Version: 0.2.15
3
+ Version: 0.2.16
4
4
  Summary: Shared data models and validation helpers for UnitySVC packages
5
5
  Author-email: Bo Peng <bo.peng@unitysvc.com>
6
6
  Maintainer-email: Bo Peng <bo.peng@unitysvc.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "unitysvc-core"
7
- version = "0.2.15"
7
+ version = "0.2.16"
8
8
  description = "Shared data models and validation helpers for UnitySVC packages"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Bo Peng", email = "bo.peng@unitysvc.com" }]
@@ -317,7 +317,14 @@ def validate_description(description: str, entity_type: str = "service") -> str:
317
317
  return description
318
318
 
319
319
 
320
+ # Values accepted by ``service_options.default_visibility`` — the visibility the
321
+ # upload applies to the service. Mirrors the backend's ServiceVisibilityEnum;
322
+ # ``private`` is settable only from service data (the seller CLI's
323
+ # ``services set-visibility`` refuses it).
324
+ SUPPORTED_DEFAULT_VISIBILITIES: tuple[str, ...] = ("public", "unlisted", "private")
325
+
320
326
  SUPPORTED_SERVICE_OPTIONS: dict[str, type | tuple[type, ...]] = {
327
+ "default_visibility": str, # Visibility applied by upload: public | unlisted | private
321
328
  "enrollment": dict, # Per-enrollment config: {limit, limit_per_customer, limit_per_user}
322
329
  "routing_vars": dict, # Seller-managed operational variables for template resolution at request time
323
330
  "ops_testing_parameters": dict,
@@ -394,6 +401,14 @@ def validate_service_options(service_options: dict[str, Any] | None) -> list[str
394
401
  errors.append(f"service_options.{key} must be {type_name}, got {type(value).__name__}")
395
402
  continue
396
403
 
404
+ # Visibility is an allowlist, not just a string.
405
+ if key == "default_visibility" and value not in SUPPORTED_DEFAULT_VISIBILITIES:
406
+ errors.append(
407
+ f"service_options.default_visibility must be one of: "
408
+ f"{', '.join(SUPPORTED_DEFAULT_VISIBILITIES)}, got {value!r}"
409
+ )
410
+ continue
411
+
397
412
  # Validate the nested enrollment config (limit*).
398
413
  if key == "enrollment" and isinstance(value, dict):
399
414
  errors.extend(_validate_enrollment_option(value))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: unitysvc-core
3
- Version: 0.2.15
3
+ Version: 0.2.16
4
4
  Summary: Shared data models and validation helpers for UnitySVC packages
5
5
  Author-email: Bo Peng <bo.peng@unitysvc.com>
6
6
  Maintainer-email: Bo Peng <bo.peng@unitysvc.com>
@@ -580,6 +580,36 @@ class TestServiceOptionsValidation:
580
580
  errors = validator.validate_service_options_keys(data, "listing_v1")
581
581
  assert errors == []
582
582
 
583
+ @pytest.mark.parametrize("visibility", ["public", "unlisted", "private"])
584
+ def test_default_visibility_accepted(self, schema_dir, example_data_dir, visibility):
585
+ validator = DataValidator(example_data_dir, schema_dir)
586
+ data = {
587
+ "schema": "listing_v1",
588
+ "service_options": {"default_visibility": visibility},
589
+ }
590
+ errors = validator.validate_service_options_keys(data, "listing_v1")
591
+ assert errors == []
592
+
593
+ def test_default_visibility_rejects_unknown_value(self, schema_dir, example_data_dir):
594
+ validator = DataValidator(example_data_dir, schema_dir)
595
+ data = {
596
+ "schema": "listing_v1",
597
+ "service_options": {"default_visibility": "hidden"},
598
+ }
599
+ errors = validator.validate_service_options_keys(data, "listing_v1")
600
+ assert len(errors) == 1
601
+ assert "service_options.default_visibility must be one of" in errors[0]
602
+
603
+ def test_default_visibility_rejects_wrong_type(self, schema_dir, example_data_dir):
604
+ validator = DataValidator(example_data_dir, schema_dir)
605
+ data = {
606
+ "schema": "listing_v1",
607
+ "service_options": {"default_visibility": True},
608
+ }
609
+ errors = validator.validate_service_options_keys(data, "listing_v1")
610
+ assert len(errors) == 1
611
+ assert "service_options.default_visibility must be str" in errors[0]
612
+
583
613
  def test_unrecognized_key_produces_error(self, schema_dir, example_data_dir):
584
614
  validator = DataValidator(example_data_dir, schema_dir)
585
615
  data = {
File without changes
File without changes
File without changes