Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 4.9% on proxy.golang.org
Top 5.8% dependent packages on proxy.golang.org
Top 1.5% dependent repos on proxy.golang.org
Top 5.6% forks on proxy.golang.org

proxy.golang.org : github.com/tallstoat/pbparser

Package pbparser is a library for parsing protocol buffer (".proto") files. It exposes two apis for parsing protocol buffer files. Both the apis return a ProtoFile datastructure and a non-nil Error if there is an issue. After the parsing operation, this library also validates any references to imported constructs i.e. any references to imported enums, messages etc in the file match the definitions in the imported modules. Clients should invoke the following apis :- The Parse() function expects the client code to provide a reader for the protobuf content and also a ImportModuleProvider which can be used to callback the client code for any imports in the protobuf content. If there are no imports, the client can choose to pass this as nil. The ParseFile() function is a utility function which expects the client code to provide only the path of the protobuf file. If there are any imports in the protobuf file, the parser will look for them in the same directory where the protobuf file resides. Clients should use the Parse() function if they are not comfortable with letting the pbparser library access the disk directly. This function should also be preferred if the imports in the protobuf file are accessible to the client code but the client code does not want to give pbparser direct access to them. In such cases, the client code has to construct a ImportModuleProvider instance and pass it to the library. This instance must know how to resolve a given "import" and provide a reader for it. On the other hand, Clients should use the ParseFile() function if all the imported files as well as the protobuf file are on disk relative to the directory in which the protobuf file resides and they are comfortable with letting the pbparser library access the disk directly. This datastructure represents parsed model of the given protobuf file. It includes the following information :- Each attribute in turn has a defined structure, which is explained in the godoc of the corresponding elements. This library consciously chooses to log no information on it's own. Any failures are communicated back to client code via the returned Error. In case of a parsing error, it returns an Error back to the client with a line and column number in the file on which the parsing error was encountered. In case of a post-parsing validation error, it returns an Error with enough information to identify the erroneous protobuf construct. Example code for the Parse() API Example code for the ParseFile() API

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/tallstoat/pbparser
Keywords: golang, parser, protobuf
License: MIT
Latest release: almost 5 years ago
First release: almost 7 years ago
Namespace: github.com/tallstoat
Dependent packages: 1
Dependent repositories: 13
Stars: 35 on GitHub
Forks: 14 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago

    Loading...
    Readme
    Loading...