blocky-aip

module
v0.0.0-...-c824f4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2024 License: Apache-2.0

README

The Golang Blocky AIP implementation

GoDoc Go Report Card Build Status codecov License

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.

Filtering

The library provides a way to filter the request and response messages based on the Google AIP-160 specification.

Abstract Syntax Tree (AST)

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 fields foo, 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 ]
Proto Filtering

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.

Directories

Path Synopsis
Package expr contain expression types that can be used to handle AIP based requests.
Package expr contain expression types that can be used to handle AIP based requests.
Package fieldmask provides API utilities for working with field masks.
Package fieldmask provides API utilities for working with field masks.
Package filtering provides a parser for the AIP-160 filtering language, that matches protocol buffer messages based on the protoreflection and blocky api annotations.
Package filtering provides a parser for the AIP-160 filtering language, that matches protocol buffer messages based on the protoreflection and blocky api annotations.
ast
Package ast provides Abstract Syntax Tree (AST) for filtering expressions that satisfies Google's AIP-160 (https://google.aip.dev/160).
Package ast provides Abstract Syntax Tree (AST) for filtering expressions that satisfies Google's AIP-160 (https://google.aip.dev/160).
parser
Package parser provides AIP-160 compliant parser for filtering expressions.
Package parser provides AIP-160 compliant parser for filtering expressions.
internal
Package names provides AIP resource generic name, which allows to extract the resource name parts from the resource name.
Package names provides AIP resource generic name, which allows to extract the resource name parts from the resource name.
Package pagination provides a simple pagination helpers that can be used for API pagination purposes.
Package pagination provides a simple pagination helpers that can be used for API pagination purposes.
Package scanner provides AIP-160 compliant scanner for filtering expressions.
Package scanner provides AIP-160 compliant scanner for filtering expressions.
Package token provides the definitions of the tokens used within the AIP proto context.
Package token provides the definitions of the tokens used within the AIP proto context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL