(cls)
| 217 | |
| 218 | @classmethod |
| 219 | def _primitive_rules(cls) -> Dict[str, "JsonSchemaConverter.BuiltinRule"]: |
| 220 | if cls.PRIMITIVE_RULES is None: |
| 221 | up_to_15_digits = cls._build_repetition("[0-9]", 0, 15) |
| 222 | cls.PRIMITIVE_RULES = { |
| 223 | "boolean": cls.BuiltinRule('("true" | "false") space', []), |
| 224 | "decimal-part": cls.BuiltinRule("[0-9] " + up_to_15_digits, []), |
| 225 | "integral-part": cls.BuiltinRule( |
| 226 | "[0-9] | [1-9] " + up_to_15_digits, |
| 227 | [], |
| 228 | ), |
| 229 | "number": cls.BuiltinRule( |
| 230 | '("-"? integral-part) ("." decimal-part)? ([eE] [-+]? integral-part)? space', |
| 231 | ["integral-part", "decimal-part"], |
| 232 | ), |
| 233 | "integer": cls.BuiltinRule('("-"? integral-part) space', ["integral-part"]), |
| 234 | "value": cls.BuiltinRule( |
| 235 | "object | array | string | number | boolean | null", |
| 236 | ["object", "array", "string", "number", "boolean", "null"], |
| 237 | ), |
| 238 | "object": cls.BuiltinRule( |
| 239 | '"{" space ( string ":" space value ("," space string ":" space value)* )? "}" space', |
| 240 | ["string", "value"], |
| 241 | ), |
| 242 | "array": cls.BuiltinRule( |
| 243 | '"[" space ( value ("," space value)* )? "]" space', |
| 244 | ["value"], |
| 245 | ), |
| 246 | "uuid": cls.BuiltinRule( |
| 247 | r'"\"" ' |
| 248 | + ' "-" '.join("[0-9a-fA-F]" * n for n in [8, 4, 4, 4, 12]) |
| 249 | + r' "\"" space', |
| 250 | [], |
| 251 | ), |
| 252 | "char": cls.BuiltinRule( |
| 253 | r'[^"\\] | "\\" (["\\/bfnrt] | "u" [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F])', |
| 254 | [], |
| 255 | ), |
| 256 | "string": cls.BuiltinRule(r'"\"" char* "\"" space', ["char"]), |
| 257 | "null": cls.BuiltinRule('"null" space', []), |
| 258 | } |
| 259 | return cls.PRIMITIVE_RULES |
| 260 | |
| 261 | @classmethod |
| 262 | def _string_format_rules(cls) -> Dict[str, "JsonSchemaConverter.BuiltinRule"]: |
no test coverage detected