-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api endpoint generator #494
base: master
Are you sure you want to change the base?
Conversation
…I spec using a Jinja2 template
…resent or the endpoints have /api common base point
…le generated by the endpoint generator script
…point generator script
…er object to accommodate the generated Endpoint file
… to the framework
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivahari While validating the open api spec for ACC model, I saw the script stopped parsing after it hit the error. Probably we can show an error for the failed endpoint and continue parsing for the next endpoint
- The json/data params to be passed to the requests method is generated from the request body | ||
- A Python dictionary collecting all these values is generated | ||
- Tge generated Python dictionary is redered on a Jinja2 template | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in "The"
@@ -0,0 +1,100 @@ | |||
""" | |||
What does this module do?: | |||
- It creates an Endpoint file with a class from the OpenAPI spec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need ":" here?
class NameGenerator(): | ||
"Base class for generating names" | ||
|
||
def __init__(self, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have 2 lines after class definition to keep it consistent
|
||
# pylint: disable=too-many-branches, too-complex | ||
def parse_request_body(self, request_body: specification.RequestBody) -> tuple[str, list, str]: | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shivahari : The codacy check is failing due to this pylint issue
Added API Auto Generation capability to the framework. This new change will help generate
*_endpoint.py
modules from anOpenAPI v3.0
spec. This partially automates creating API Automation test.Run
python api_auto_generator/endpoint_module_generator.py --help
to getHelp
on how to run the generator script.Changes include:
api_auto_generator
to house:make_request
to makeHTTP
requestsrequirements.txt
file to add required modules