Collects and returns case classes that extend the given type.
Collects and returns case classes that extend the given type.
A list of tuples. Each tuple contains the path, and class def
For a given type (optional including it's path) returns it's companion object
Extracts a package path from a json-schema $ref.
Extracts a package path from a json-schema $ref. Notes:
The name of the root class. Which is used to replace #/ references
The $ref element to path-erize.
Returns true if the given contains the given annotation
Wrap the given type in an List type
Wrap the given type in an Option type
Quasiquote doesn't support building trees of selects (i.e.
Quasiquote doesn't support building trees of selects (i.e. obj1.obj2.MyObj), so we do it here manually.
List of strings representing the paths.
e.g. obj1.obj2.myObj becomes: Select(Select(Ident(TermName("obj1")), TermName("obj2")), TermName("myObj"))
Builds on mkSelectPath, but treats last item is a Type rather than a TermName
Best attempt at producing a name from a Json blob.
Best attempt at producing a name from a Json blob. This is mostly used for enum, where the enum's can be any arbitrary Json structure. Mostly they are plain strings, in which case this is a no-op, but in the case where it's more complex then the property names from json structure are used to build a name. If the json object is a number then decimial points are stripped, and "n" is prefixed (i.e. 3.14 => n314).
Returns a string from a given type (with path) that somewhat uniquely identifies this type.
Returns a string from a given type (with path) that somewhat uniquely identifies this type. Can be useful for producing variable names. For example: a.b.C => ABC
The type to produce a term from.
Whether to use a type's path or not. If not then only C of a.b.C is used. Defaults to true.
Extracts argument values from a List[Tree] as is obtained from a quasiquote such as q"myFunc(..$params))".
Extracts argument values from a List[Tree] as is obtained from a quasiquote such as q"myFunc(..$params))". Supports named arguments, and default values.
A list of tuples containing each argument's name and default value. This must be the complete list of supported arguments.
A list of trees to as extracted by ..$params. If arguments are constants or option wrapped constants then their reified values are returned (i.e. Some(1)), if not then the AST chunk is returned.
A map of argument names and their extracted values (or their default value if not extracted)
Extract the select path as a List[String]
Returns the intersection set between two lists of trees (based on the tree's being equal in structure)
For a given companion object (optional including it's path) returns it's given type
Extract the select path (ending with a TypeName) as a List[String].
Extract the select path (ending with a TypeName) as a List[String]. Types with type parameters are concatenated to form a single string. For example: a.b.MyObj[A,B[C]] becomes List(a,b,MyObjABC)
Common utils for AST munging. Also includes a few helps for constructing type names/paths from json constructs.