def generate_primitive_strategy()

in src/rpdk/core/contract/resource_generator.py [0:0]


    def generate_primitive_strategy(self, schema):
        json_type = schema.get("type", "object")

        if "const" in schema:
            strategy = just(schema["const"])
        elif "enum" in schema:
            strategies = [just(item) for item in schema["enum"]]
            strategy = one_of(*strategies)
        elif json_type == "integer":
            strategy = self.generate_integer_strategy(schema)
        elif json_type == "number":
            strategy = self.generate_float_strategy(schema)
        elif json_type == "boolean":
            strategy = booleans()
        elif json_type == "string":
            strategy = self.generate_string_strategy(schema)
        elif json_type == "array":
            strategy = self.generate_array_strategy(schema)
        else:
            strategy = self.generate_object_strategy(schema)
        return strategy