Maillol / aiohttp-pydantic

Aiohttp View that validates request body and query sting regarding the annotations declared in the View method

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

generate the OAS in json tips

bbartling opened this issue · comments

Any chance I could get some tips on how to do this?

Copy paste from this repo:
python -m aiohttp_pydantic.oas demo.main

demo would be the name of the python package that was installed locally, .main does that refer to main.py or __main__.py?

For my app in order to generate the OAS, do I need to install it like an entire python package locally?

For example, something like this tutorial Build Python Packages Without Publishing

demo.main is a module with app = Application(...) in this example, is in main.py.

You don't need to install your app, you can use PYTHONPATH environment variable.

PYTHONPATH=/path/to/dir/containing/your_package_python python -m aiohttp_pydantic  your_package_python.module.containing.app

Thanks for the response. Any chance you could give me another tip? So on my Linux Ubuntu machine if I do a pwd

/home/ben/Desktop/bacnet-restapi

And my aiohttp app is named aioapp.py Is this legit?

PYTHONPATH=/home/ben/Desktop/bacnet-restapi python3 -m aiohttp_pydantic /home/ben/Desktop/bacnet-restapi.aioapp.containing.app

This will return:
No module named aiohttp_pydantic.__main__; 'aiohttp_pydantic' is a package and cannot be directly executed

Thanks for any help!!!!

I actually think I got this to work. I think had to update the requests library for some reason but this seem to work OK:

PYTHONPATH=/home/ben/Desktop/bacnet-restapi python3 -m aiohttp_pydantic.oas aioapp --output testing.json

Thanks for the input and creations!