sort_keys=False in --save, closes #798

This commit is contained in:
Simon Willison 2025-02-27 16:51:43 -08:00
parent 98cccd294a
commit b1fe2e9857
2 changed files with 11 additions and 3 deletions

View file

@ -379,6 +379,7 @@ def prompt(
to_save,
indent=4,
default_flow_style=False,
sort_keys=False,
),
"utf-8",
)

View file

@ -97,10 +97,17 @@ def test_templates_list(templates_path, args):
{"system": "write python", "extract": True},
None,
),
# So should schemas
# So should schemas (and should not sort properties)
(
["--schema", '{"properties": {"name": {"type": "string"}}}'],
{"schema_object": {"properties": {"name": {"type": "string"}}}},
[
"--schema",
'{"properties": {"b": {"type": "string"}, "a": {"type": "string"}}}',
],
{
"schema_object": {
"properties": {"b": {"type": "string"}, "a": {"type": "string"}}
}
},
None,
),
),