From 307110ad2cf36dc622778d2d23c002c9d8541ecb Mon Sep 17 00:00:00 2001 From: ochafik Date: Sun, 10 Mar 2024 15:00:07 +0000 Subject: [PATCH] Update json-schema-to-grammar.py --- examples/json-schema-to-grammar.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/json-schema-to-grammar.py b/examples/json-schema-to-grammar.py index 8e6f980a3..b76aa5a34 100755 --- a/examples/json-schema-to-grammar.py +++ b/examples/json-schema-to-grammar.py @@ -394,14 +394,16 @@ def main(args_in = None): type=lambda s: s.split(','), help=''' comma-separated property names defining the order of precedence for object properties; - properties not specified here are given lower precedence than those that are, and are - sorted alphabetically + properties not specified here are given lower precedence than those that are, and + are kept in their original order from the schema. Required properties are always + given precedence over optional properties. ''' ) parser.add_argument('schema', help='file containing JSON schema ("-" for stdin)') args = parser.parse_args(args_in) - if (url := args.schema.startswith('https://')): + if args.schema.startswith('https://'): + url = args.schema import requests schema = requests.get(url).json() elif args.schema == '-':