Skip to content

Commit c491c9e

Browse files
committed
Display: add compactMode: null; improve json schema
1 parent 094d736 commit c491c9e

2 files changed

Lines changed: 33 additions & 15 deletions

File tree

doc/json_schema.json

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,12 +2067,25 @@
20672067
},
20682068
"order": {
20692069
"description": "Set the order should be used when printing",
2070-
"enum": [
2071-
"none",
2072-
"asc",
2073-
"desc"
2070+
"oneOf": [
2071+
{
2072+
"const": null,
2073+
"description": "Use the default order"
2074+
},
2075+
{
2076+
"const": "none",
2077+
"description": "Use the detected order (kept for compatibility)"
2078+
},
2079+
{
2080+
"const": "asc",
2081+
"description": "Sort by display name in ascending order"
2082+
},
2083+
{
2084+
"const": "desc",
2085+
"description": "Sort by display name in descending order"
2086+
}
20742087
],
2075-
"default": "none"
2088+
"default": null
20762089
},
20772090
"key": {
20782091
"$ref": "#/$defs/key"

src/modules/display/display.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,22 @@ void ffParseDisplayJsonObject(FFDisplayOptions* options, yyjson_val* module)
257257

258258
if (unsafe_yyjson_equals_str(key, "order"))
259259
{
260-
int value;
261-
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
262-
{ "asc", FF_DISPLAY_ORDER_ASC },
263-
{ "desc", FF_DISPLAY_ORDER_DESC },
264-
{ "none", FF_DISPLAY_ORDER_NONE },
265-
{},
266-
});
267-
if (error)
268-
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
260+
if (yyjson_is_null(val))
261+
options->order = FF_DISPLAY_ORDER_NONE;
269262
else
270-
options->order = (FFDisplayOrder) value;
263+
{
264+
int value;
265+
const char* error = ffJsonConfigParseEnum(val, &value, (FFKeyValuePair[]) {
266+
{ "asc", FF_DISPLAY_ORDER_ASC },
267+
{ "desc", FF_DISPLAY_ORDER_DESC },
268+
{ "none", FF_DISPLAY_ORDER_NONE },
269+
{},
270+
});
271+
if (error)
272+
ffPrintError(FF_DISPLAY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Invalid %s value: %s", unsafe_yyjson_get_str(key), error);
273+
else
274+
options->order = (FFDisplayOrder) value;
275+
}
271276
continue;
272277
}
273278

0 commit comments

Comments
 (0)