From 1bf95b92d99bd76cfae980cdc9dd7f1e2bea4790 Mon Sep 17 00:00:00 2001 From: Vibaswan Date: Sun, 23 Jun 2024 09:43:48 +0000 Subject: [PATCH] modifying descriptions and correcting count and seed value --- openapiart/bundler.py | 24 ++++++++---------------- openapiart/tests/test_random_pattern.py | 2 -- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/openapiart/bundler.py b/openapiart/bundler.py index 67902ecc..fb92eb7a 100644 --- a/openapiart/bundler.py +++ b/openapiart/bundler.py @@ -1080,23 +1080,27 @@ def _generate_value_schema( "type": "object", "properties": { "min": { - "description": "The minimum value to be provided for the random range.", + "description": "The minimum possible value generated by the random value generator.", "type": type_name, "x-field-uid": random_auto_field.uid, }, "max": { - "description": "The maximum value to be provided for the random range.", + "description": "The maximum possible value generated by the random value generator.", "type": type_name, "x-field-uid": random_auto_field.uid, }, "seed": { - "description": "The seed value to be provided for the random number generation.", + "description": "The seed value to initialize the random value generator to a deterministic state.", "type": "integer", + "default": 1, + "format": "uint32", "x-field-uid": random_auto_field.uid, }, "count": { - "description": "The numbere of values to be genrated.", + "description": "The total number of values to be generated by the random value generator.", "type": "integer", + "default": 1, + "format": "uint32", "x-field-uid": random_auto_field.uid, }, }, @@ -1113,18 +1117,6 @@ def _generate_value_schema( fmt, property_name="max", ) - self._apply_common_x_field_pattern_properties( - random_schema["properties"]["seed"], - xpattern, - pattern_fmt, - property_name="seed", - ) - self._apply_common_x_field_pattern_properties( - random_schema["properties"]["count"], - xpattern, - pattern_fmt, - property_name="count", - ) self._content["components"]["schemas"][ random_pattern_name diff --git a/openapiart/tests/test_random_pattern.py b/openapiart/tests/test_random_pattern.py index f0c6a823..8e04deee 100644 --- a/openapiart/tests/test_random_pattern.py +++ b/openapiart/tests/test_random_pattern.py @@ -22,12 +22,10 @@ def test_random_pattern_integer_format(default_config): assert rnd._TYPES.get("count").get("format") == "uint32" assert rnd._TYPES.get("count").get("type") == int - assert rnd._TYPES.get("count").get("maximum") == 255 assert rnd._DEFAULTS.get("count") == 1 assert rnd._TYPES.get("seed").get("format") == "uint32" assert rnd._TYPES.get("seed").get("type") == int - assert rnd._TYPES.get("seed").get("maximum") == 255 assert rnd._DEFAULTS.get("seed") == 1 data = default_config.serialize("dict")