From: Adrian Vovk Date: Fri, 18 Oct 2024 22:11:47 +0000 (-0400) Subject: sysupdate: Use camelCase for JSON field names X-Git-Tag: v257-rc1~181 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f82a7c87d2fc649c6a5690aa1df35cb6a79f8425;p=thirdparty%2Fsystemd.git sysupdate: Use camelCase for JSON field names Seems like we missed some snake_case field names in previous reviews of systemd-sysupdate --- diff --git a/man/org.freedesktop.sysupdate1.xml b/man/org.freedesktop.sysupdate1.xml index 79f718f93c4..407057b2d8d 100644 --- a/man/org.freedesktop.sysupdate1.xml +++ b/man/org.freedesktop.sysupdate1.xml @@ -231,8 +231,8 @@ node /org/freedesktop/sysupdate1/target/host { - changelog_urls - A list of strings that contain user-presentable URLs to ChangeLogs associated with + changelogUrls + A list of strings that contain user-presentable URLs to change logs associated with this version. diff --git a/src/sysupdate/sysupdate.c b/src/sysupdate/sysupdate.c index 490466228d1..2105f134eb7 100644 --- a/src/sysupdate/sysupdate.c +++ b/src/sysupdate/sysupdate.c @@ -732,7 +732,7 @@ static int context_show_version(Context *c, const char *version) { SD_JSON_BUILD_PAIR_BOOLEAN("obsolete", FLAGS_SET(us->flags, UPDATE_OBSOLETE)), SD_JSON_BUILD_PAIR_BOOLEAN("protected", FLAGS_SET(us->flags, UPDATE_PROTECTED)), SD_JSON_BUILD_PAIR_BOOLEAN("incomplete", FLAGS_SET(us->flags, UPDATE_INCOMPLETE)), - SD_JSON_BUILD_PAIR_STRV("changelog_urls", changelog_urls), + SD_JSON_BUILD_PAIR_STRV("changelogUrls", changelog_urls), SD_JSON_BUILD_PAIR_VARIANT("contents", t_json)); if (r < 0) return log_error_errno(r, "Failed to create JSON: %m"); @@ -1083,7 +1083,7 @@ static int verb_list(int argc, char **argv, void *userdata) { r = sd_json_buildo(&json, SD_JSON_BUILD_PAIR_STRING("current", current), SD_JSON_BUILD_PAIR_STRV("all", versions), - SD_JSON_BUILD_PAIR_STRV("appstream_urls", appstream_urls)); + SD_JSON_BUILD_PAIR_STRV("appstreamUrls", appstream_urls)); if (r < 0) return log_error_errno(r, "Failed to create JSON: %m"); diff --git a/src/sysupdate/sysupdated.c b/src/sysupdate/sysupdated.c index 8709c60b78d..dc166ec40e6 100644 --- a/src/sysupdate/sysupdated.c +++ b/src/sysupdate/sysupdated.c @@ -1215,13 +1215,13 @@ static int target_get_appstream(Target *t, char ***ret) { if (r < 0) return log_error_errno(r, "Failed to run 'systemd-sysupdate list': %m"); - appstream_url_json = sd_json_variant_by_key(v, "appstream_urls"); + appstream_url_json = sd_json_variant_by_key(v, "appstreamUrls"); if (!appstream_url_json) - return log_sysupdate_bad_json(SYNTHETIC_ERRNO(EPROTO), "list", "Missing key 'appstream_urls'"); + return log_sysupdate_bad_json(SYNTHETIC_ERRNO(EPROTO), "list", "Missing key 'appstreamUrls'"); r = sd_json_variant_strv(appstream_url_json, ret); if (r < 0) - return log_sysupdate_bad_json(SYNTHETIC_ERRNO(EPROTO), "list", "Key 'appstream_urls' should be strv"); + return log_sysupdate_bad_json(SYNTHETIC_ERRNO(EPROTO), "list", "Key 'appstreamUrls' should be strv"); return 0; } diff --git a/src/sysupdate/updatectl.c b/src/sysupdate/updatectl.c index 216f37f9317..9b65bbb42a6 100644 --- a/src/sysupdate/updatectl.c +++ b/src/sysupdate/updatectl.c @@ -358,15 +358,15 @@ static int parse_describe(sd_bus_message *reply, Version *ret) { assert(sd_json_variant_is_object(json)); static const sd_json_dispatch_field dispatch_table[] = { - { "version", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(DescribeParams, v.version), 0 }, - { "newest", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, newest), 0 }, - { "available", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, available), 0 }, - { "installed", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, installed), 0 }, - { "obsolete", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, obsolete), 0 }, - { "protected", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, protected), 0 }, - { "incomplete", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, incomplete), 0 }, - { "changelog_urls", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(DescribeParams, v.changelog), 0 }, - { "contents", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_variant, offsetof(DescribeParams, contents_json), 0 }, + { "version", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(DescribeParams, v.version), 0 }, + { "newest", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, newest), 0 }, + { "available", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, available), 0 }, + { "installed", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, installed), 0 }, + { "obsolete", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, obsolete), 0 }, + { "protected", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, protected), 0 }, + { "incomplete", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, incomplete), 0 }, + { "changelogUrls", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(DescribeParams, v.changelog), 0 }, + { "contents", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_variant, offsetof(DescribeParams, contents_json), 0 }, {}, };