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
Custom documented classmethod to execute advanced GET #7
Comments
I implemented a new decorator: jsonapi_rpc.
? I am going to keep the |
OK, I will try this out. Thanks. |
An example is implemented here: https://github.com/thomaxxl/safrs/blob/master/examples/demo_relationship.py |
solved |
Hi my i am using Flask-Python for rest api creation, I cannot change the structure. Following Are my class and method declaration. class EmployeeInfo(SAFRSBase,db.Model): @classmethod
I want only methods created by me in the swaggerUI. |
Hi, can you open a new issue for new problems please? @classmethod
@jsonapi_rpc(http_methods=['POST','GET'])
def get_dept_info(cls):
return {1:1} |
Hi my i am using Flask-Python for rest api creation, I cannot change the structure. Following Are my class and method declaration. class EmployeeInfo(SAFRSBase,db.Model): @classmethod
I want only methods created by me in the swaggerUI. |
Hi, Can you check if it works for you? |
@thomaxxl thank you for the quick reply i will try this solution, though i have some questions
|
|
@thomaxxl i tried those things but i have one main question to ask I only want Methods that are exposed externally i don't want any automatically generated api endpoint i want following structure is it possible to get the same directly or do we need to change the code a bit. |
Hi, you'd have to modify the _api.Api class for that: so, if you add a return directly after ...
# Expose the methods first
self.expose_methods(url_prefix, tags=tags)
return # << Add the return here
... Safrs is mainly designed to provide crud operations though, so I'm not sure if this is the right framework for what you're trying to do. |
Hello,
we created a custom documented (class)method to do advanced search on a table. Our code:
The result is a generated POST endpoint, but we would like to see a GET, since we are getting data.
The search items could be passed as URL arguments instead of in the body. Also, because we have a POST, we can't show an example value in the swagger UI.
Example curl:
Linked issue: #6
Can you provide a better method? Are we doing it right?
The text was updated successfully, but these errors were encountered: