Show a patch.

GET /api/patches/16954/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 16954,
    "url": "https://patchwork.libcamera.org/api/patches/16954/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16954/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20220803112937.30566-1-jacopo@jmondi.org>",
    "date": "2022-08-03T11:29:37",
    "name": "[libcamera-devel,v2] libcamera: yaml_parser: Return nullopt on error",
    "commit_ref": "2e77ccbb93a14a0c976bb3ca9d5dbbdc32a12847",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6d9752e4576a78ff09cc391bdf0e29ec03cfddb7",
    "submitter": {
        "id": 3,
        "url": "https://patchwork.libcamera.org/api/people/3/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo@jmondi.org"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16954/mbox/",
    "series": [
        {
            "id": 3369,
            "url": "https://patchwork.libcamera.org/api/series/3369/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3369",
            "date": "2022-08-03T11:29:37",
            "name": "[libcamera-devel,v2] libcamera: yaml_parser: Return nullopt on error",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3369/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16954/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16954/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6E930C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Aug 2022 11:29:45 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F291763310;\n\tWed,  3 Aug 2022 13:29:44 +0200 (CEST)",
            "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[IPv6:2001:4b98:dc4:8::225])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 60E94603E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Aug 2022 13:29:44 +0200 (CEST)",
            "(Authenticated sender: jacopo@jmondi.org)\n\tby mail.gandi.net (Postfix) with ESMTPSA id 3CE0F1C000E;\n\tWed,  3 Aug 2022 11:29:42 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659526185;\n\tbh=+25sZo3CHG8TGWXPT1zugAAONI1GzhZRWTOcwIdDHoY=;\n\th=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post:\n\tList-Help:List-Subscribe:From:Reply-To:From;\n\tb=oG0ZXMMXkn0NbKMrtykDTZ5GUozvEtnI/Lfnv+lyOKuVr/PRbKhXccKZr2u33LrtC\n\txLjaz3UlZJr0HoesKn3uAXGEPty2X+wCwx2xb0AE8jYkdhF3USzVoUP+wN04+EGB9N\n\tKHGHO2t9Xaz8ovBLqjLiw7t59re+sZyZlvFKAy5fg/7NLtjV6+3I1G/lt10LqZn0qi\n\tY6Ev41I5WSgFJxVlPyqpZHTelyEyQEweIQLWViI6puZDD413CiHRJN9RzZdtgA6WOC\n\t8ejlp6qp40Kn7rq8ap52U1jbFXcBTPfgwdVlWjXwJkwpG+4Py+zzD14yk8ZYZYYfOB\n\tn8f6PhH224OdA==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed,  3 Aug 2022 13:29:37 +0200",
        "Message-Id": "<20220803112937.30566-1-jacopo@jmondi.org>",
        "X-Mailer": "git-send-email 2.37.1",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2] libcamera: yaml_parser: Return nullopt\n\ton error",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "From": "Jacopo Mondi via libcamera-devel <libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Jacopo Mondi <jacopo@jmondi.org>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The YamlParser::getList<>() function returns an std::optional<> to allow\ncallers to identify cases where parsing the .yaml file failed from cases\nwhere the parsed list is just empty.\n\nThe current implementation returns an empty vector in case of parsing\nerrors, which evaluates to std::nullopt but it less explicit.\n\nChange this by returning std::nullopt in case of errors to make the\nintended behaviour more explicit.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n src/libcamera/yaml_parser.cpp | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\nindex 84cb57d6de83..c96e99e1317c 100644\n--- a/src/libcamera/yaml_parser.cpp\n+++ b/src/libcamera/yaml_parser.cpp\n@@ -319,7 +319,7 @@ template<typename T,\n std::optional<std::vector<T>> YamlObject::getList() const\n {\n \tif (type_ != Type::List)\n-\t\treturn {};\n+\t\treturn std::nullopt;\n \n \tstd::vector<T> values;\n \tvalues.reserve(list_.size());\n@@ -327,7 +327,7 @@ std::optional<std::vector<T>> YamlObject::getList() const\n \tfor (const YamlObject &entry : asList()) {\n \t\tconst auto value = entry.get<T>();\n \t\tif (!value)\n-\t\t\treturn {};\n+\t\t\treturn std::nullopt;\n \t\tvalues.emplace_back(*value);\n \t}\n \n",
    "prefixes": [
        "libcamera-devel",
        "v2"
    ]
}