def configure_replace(self, ns, definition):
        """
        Register a replace endpoint.

        The definition's func should be a replace function, which must:
        - accept kwargs for the request and path data
        - return the replaced item

        :param ns: the namespace
        :param definition: the endpoint definition

        """
        @self.add_route(ns.instance_path, Operation.Replace, ns)
        @request(definition.request_schema)
        @response(definition.response_schema)
        @wraps(definition.func)
        def replace(**path_data):
            headers = dict()
            request_data = load_request_data(definition.request_schema)
            # Replace/put should create a resource if not already present, but we do not
            # enforce these semantics at the HTTP layer. If `func` returns falsey, we
            # will raise a 404.
            response_data = require_response_data(definition.func(**merge_data(path_data, request_data)))
            definition.header_func(headers, response_data)
            response_format = self.negotiate_response_content(definition.response_formats)
            return dump_response_data(
                definition.response_schema,
                response_data,
                headers=headers,
                response_format=response_format,
            )

        replace.__doc__ = "Create or update a {} by id".format(ns.subject_name)
Register a replace endpoint.

        The definition's func should be a replace function, which must:
        - accept kwargs for the request and path data
        - return the replaced item

        :param ns: the namespace
        :param definition: the endpoint definition