The Golang Blocky AIP is a library that provides API Improvement Proposals. implementation for gRPC services.
It provides a simple set of tools to parse and validate the request and response messages.
The library provides a way to filter the request and response messages based on the Google AIP-160 specification.
The library provides a way to parse the filter string into an AST (specified in the EBNF Grammar)
github.com/blockysource/blocky-aip/filtering/ast
defines AST nodes, which can be used to traverse the AST.github.com/blockysource/blocky-aip/parser
- parses an input filtering string into a valid AST expression.
As an extension to the EBNF Grammar, parser has an ability to parse structures and arrays.
A structure is defined as:
- name - period separated list of structure name and field name, e.g.
foo.bar.baz
- fields: a list of field names, e.g.
foo.bar.baz
has fieldsfoo
,bar
,baz
- each field can be any valid comparable expression i.e.: member, function, struct or array.
- a structure fields definition is opened by the
{
and closed by the}
example: foo.bar.baz{foo: 1, bar: "bar", baz: func(), qux: [1, 2, 3]}
An array is defined as:
- opening bracket
[
- list of expressions separated by comma
,
- closing bracket
]
The library provides a way to filter the request and response messages based on the AST.
It maps the field names from provided protoreflect.MessageDescriptor
, parses the filter string into AST
and converts it into some simple form of expr.FilterExpr
.