Skip to content

Commit

Permalink
Flatbuffers IDL based payload validation (#1576)
Browse files Browse the repository at this point in the history
* support WAMP payload validation via FlatBuffers IDL
* allow loading FlatBuffers from IO-bytes
* more type hints
  • Loading branch information
oberstet committed Jun 13, 2022
1 parent a8d5fb3 commit e90d38f
Show file tree
Hide file tree
Showing 30 changed files with 2,691 additions and 91 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ include autobahn/nvx/_utf8validator.c
recursive-include autobahn/wamp/gen/schema *
recursive-include autobahn/asset *
recursive-include autobahn/xbr/templates *
recursive-include autobahn/xbr/test/catalog/schema *
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ upload: clean
s3://fabric-deploy/autobahn/

# cleanup everything
clean: clean_docs
clean: clean_docs clean_catalog
-rm -f ./*.so
-rm -rf ./docs/build
-rm -rf ./.cache
Expand All @@ -67,6 +67,12 @@ clean: clean_docs
# Learn to love the shell! http://unix.stackexchange.com/a/115869/52500
-find . \( -name "*__pycache__" -type d \) -prune -exec rm -rf {} +

clean_catalog:
cd ./autobahn/xbr/test/catalog && make clean

rebuild_catalog:
cd ./autobahn/xbr/test/catalog && make distclean && make build

# publish to PyPI
publish: clean
AUTOBAHN_USE_NVX=0 python setup.py sdist
Expand Down Expand Up @@ -146,6 +152,10 @@ test_xbr_cli:
xbrnetwork get-actor
xbrnetwork get-actor --market=1388ddf6-fe36-4201-b1aa-cb7e36b4cfb3

test_xbr_schema:
USE_TWISTED=1 trial autobahn.xbr.test.schema
USE_ASYNCIO=1 pytest autobahn/xbr/test/schema

test_mnemonic:
# python -m pytest -rsx autobahn/xbr/test/test_mnemonic.py
USE_TWISTED=1 trial autobahn.xbr.test
Expand Down
2 changes: 1 addition & 1 deletion autobahn/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
#
###############################################################################

__version__ = '22.5.1'
__version__ = '22.6.1.dev1'

__build__ = '00000000-0000000'
10 changes: 8 additions & 2 deletions autobahn/wamp/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1632,10 +1632,16 @@ def _unsubscribe(self, subscription):
return txaio.create_future_success(scount)

@public
def call(self, procedure: str, *args: Optional[List[Any]], **kwargs: Optional[Dict[str, Any]]) -> \
Union[Any, CallResult]:
def call(self, procedure: str, *args, **kwargs) -> Union[Any, CallResult]:
"""
Implements :meth:`autobahn.wamp.interfaces.ICaller.call`
.. note::
Regarding type hints for ``*args`` and ``**kwargs``, doesn't work as we
can receive any Python types as list items or dict values, and because
of what is discussed here
https://adamj.eu/tech/2021/05/11/python-type-hints-args-and-kwargs/
"""
assert(type(procedure) == str)
assert(args is None or type(args) in (list, tuple))
Expand Down
1 change: 1 addition & 0 deletions autobahn/xbr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ def account_from_ethkey(ethkey: bytes) -> eth_account.account.Account:
'IBuyer',
'IDelegate',

'FbsRepository',
'FbsSchema',
'FbsService',
'FbsType',
Expand Down

0 comments on commit e90d38f

Please sign in to comment.