Display: add compactMode: null; improve json schema

This commit is contained in:
李通洲
2025-08-03 09:31:38 +08:00
parent 094d736d38
commit c491c9e8fc
2 changed files with 33 additions and 15 deletions
+18 -5
View File
@@ -2067,12 +2067,25 @@
},
"order": {
"description": "Set the order should be used when printing",
"enum": [
"none",
"asc",
"desc"
"oneOf": [
{
"const": null,
"description": "Use the default order"
},
{
"const": "none",
"description": "Use the detected order (kept for compatibility)"
},
{
"const": "asc",
"description": "Sort by display name in ascending order"
},
{
"const": "desc",
"description": "Sort by display name in descending order"
}
],
"default": "none"
"default": null
},
"key": {
"$ref": "#/$defs/key"
+15 -10
View File
@@ -257,17 +257,22 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
if (unsafe_yyjson_equals_str(key, "order"))
{
int value;
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
{ "asc", FF_DISPLAY_ORDER_ASC },
{ "desc", FF_DISPLAY_ORDER_DESC },
{ "none", FF_DISPLAY_ORDER_NONE },
{},
});
if (error)
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
if (yyjson_is_null(val))
options->order = FF_DISPLAY_ORDER_NONE;
else
options->order = (FFDisplayOrder) value;
{
int value;
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
{ "asc", FF_DISPLAY_ORDER_ASC },
{ "desc", FF_DISPLAY_ORDER_DESC },
{ "none", FF_DISPLAY_ORDER_NONE },
{},
});
if (error)
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
else
options->order = (FFDisplayOrder) value;
}
continue;
}