Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1''' 

2Created on June 7, 2019 

3@author: Andrew Habib 

4''' 

5 

6import operator 

7from functools import reduce 

8 

9 

10Jnumeric = set(["integer", "number"]) 

11 

12Jtypes = Jnumeric.union(["string", "boolean", "null", "array", "object"]) 

13 

14JtypesToKeywords = { 

15 "string": ["minLength", "maxLength", "pattern"], 

16 "number": ["minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "multipleOf"], 

17 "integer": ["minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "multipleOf"], 

18 "boolean": [], 

19 "null": [], 

20 "array": ["minItems", "maxItems", "items", "additionalItems", "uniqueItems"], 

21 "object": ["properties", "additionalProperties", "required", "minProperties", "maxProperties", "dependencies", "patternProperties"] 

22} 

23 

24Jconnectors = set(["anyOf", "allOf", "oneOf", "not"]) 

25 

26Jcommonkw = Jconnectors.union(["enum", "type"]) 

27 

28JNonValidation = set(["$schema", "$id", "definitions", "title", "description", "format"]) 

29 

30Jkeywords = Jcommonkw.union(Jtypes, 

31 reduce(operator.add, JtypesToKeywords.values())).union(["$ref"]) 

32 # .union(JNonValidation) # conflicts with canonicalize_connectors 

33 

34JtypesToPyTypes = {"integer": int, "number": float, "string": str, 

35 "boolean": bool, "null": type(None), "array": list, "object": dict} 

36 

37PyTypesToJtypes = dict([(v, k) for k, v in JtypesToPyTypes.items()])