Thrift v1.3.2 Thrift.Parser

This module provides functions for parsing .thrift files.

Summary

Functions

Parses a Thrift document and returns the schema that it represents

Parses a Thrift document and returns a component to the caller

Takes a path to a file and parses it, adding any includes to the parsed results

Types

path_element()
path_element() :: String.t | atom

Functions

parse(doc)
parse(String.t) :: %Thrift.Parser.Models.Schema{absolute_path: term, constants: term, enums: term, exceptions: term, includes: term, module: term, namespaces: term, services: term, structs: term, thrift_namespace: term, typedefs: term, unions: term}

Parses a Thrift document and returns the schema that it represents.

parse(doc, path)

Parses a Thrift document and returns a component to the caller.

The part of the Thrift document that’s returned is determined by the path parameter. It works a lot like the find_in function, which takes a map and can pull out nested pieces.

For example, this makes it easy to get to a service definition:

parse(doc, [:services, :MyService])

Will return the “MyService” service.

parse_file(file_path)
parse_file(Path.t) :: %Thrift.Parser.FileGroup{parsed_files: term, resolutions: term, schemas: term}

Takes a path to a file and parses it, adding any includes to the parsed results.