*Sets the schema to validate the request properties*

        Expectations are effective for following requests in the test suite,
        or until they are reset or updated by using expectation keywords again.
        On the test suite level (suite setup), they are best used for expecting
        the endpoint wide properties that are common regardless of the tested
        HTTP method, and on the test case level (test setup) to merge in
        the HTTP method specific properties.

        `Expect Request` is intented to be used with tests that have some of the
        request properties, e.g. body or query parameters, randomized ("fuzzing")
        for validating that the sent values are within the expected scope.

        If the keyword is used, following HTTP keywords will fail when
        their request properties are not valid against the expected schema.

        If the keyword is not used, a new schema is generated for each following
        request for its ``body`` and ``query`` properties. Use `Output Schema` to output it and use it as an input to this keyword.

        *Options*

        ``merge``: Merges the new schema with the current instead of replacing it

        *Examples*

        | `Expect Request` | ${CURDIR}/valid_payload.json | | # See `Output Schema` |
        | `Expect Request` | { "body": { "required": ["id"] } } | merge=true |

def expect_request(self, schema, merge=False):
        """*Sets the schema to validate the request properties*

        Expectations are effective for following requests in the test suite,
        or until they are reset or updated by using expectation keywords again.
        On the test suite level (suite setup), they are best used for expecting
        the endpoint wide properties that are common regardless of the tested
        HTTP method, and on the test case level (test setup) to merge in
        the HTTP method specific properties.

        `Expect Request` is intented to be used with tests that have some of the
        request properties, e.g. body or query parameters, randomized ("fuzzing")
        for validating that the sent values are within the expected scope.

        If the keyword is used, following HTTP keywords will fail when
        their request properties are not valid against the expected schema.

        If the keyword is not used, a new schema is generated for each following
        request for its ``body`` and ``query`` properties. Use `Output Schema` to output it and use it as an input to this keyword.

        *Options*

        ``merge``: Merges the new schema with the current instead of replacing it

        *Examples*

        | `Expect Request` | ${CURDIR}/valid_payload.json | | # See `Output Schema` |
        | `Expect Request` | { "body": { "required": ["id"] } } | merge=true |
        """
        schema = self._input_object(schema)
        if "properties" not in schema:
            schema = {"properties": schema}
        if self._input_boolean(merge):
            new_schema = SchemaBuilder(schema_uri=False)
            new_schema.add_schema(self.schema["properties"]["request"])
            new_schema.add_schema(schema)
            self.schema["properties"]["request"] = new_schema.to_schema()
        else:
            self.schema["properties"]["request"] = schema
        return self.schema["properties"]["request"]