Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Explore if it possible to have the OTC client generate prettier function names #6

Closed
devraj opened this issue Jul 30, 2022 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@devraj
Copy link
Member

devraj commented Jul 30, 2022

Readability counts, and while we understand that there are limitations when it comes to code generation, we should explore if there are ways to configure the server API so the client side generates more readable names.

OTC client already uses names spaces which breaks things down, however the method names could read better

@devraj
Copy link
Member Author

devraj commented Jul 30, 2022

It is possible to override the names of the generated functions by providing an operation_id flag to the router endpoints. For the sake of readability this is highly encouraged.

Read FastAPI params to see how this configured.

We should provide guidelines in this lab around how to name operations specially with the knowledge that OTC is able to use namespaces which are grouped by tags, which highlights the need for using tags in a more systematic manner.

@devraj devraj added the documentation Improvements or additions to documentation label Aug 4, 2022
@devraj
Copy link
Member Author

devraj commented Aug 11, 2022

Review this section of the FastAPI docs to help autogenerate these names
https://fastapi.tiangolo.com/es/advanced/generate-clients/#custom-generate-unique-id-function

at the moment we are doing it by manually providing an operation_id

@devraj devraj self-assigned this Sep 15, 2022
devraj added a commit to anomaly/lab-python-server that referenced this issue Oct 14, 2022
our web client has a ticket where we require the operation_id of the openapi spec to be human
readable, this is inline with cameCasing and snake_casing depending on the server or client
anomaly/lab-web-client#6

the attempt is to greatly improve code readability which in turn makes documentation a lot
more readable. initially we were assigning the operation_id manually but have nice moved
to using what's references in the fastapi docs
https://bit.ly/3rXeAvH

this does imply that the function names have to well written by developers
devraj added a commit to anomaly/lab-python-server that referenced this issue Oct 14, 2022
following on from ee3e954 this updates the documentation
for generating operation_ids for the openapi spec, originally lodged as an issue here
anomaly/lab-web-client#6
@devraj devraj closed this as completed Oct 14, 2022
devraj added a commit to anomaly/lab-python-server that referenced this issue Oct 28, 2022
originally implemented as part of the ticket to make names better
anomaly/lab-web-client#6

this is a cleanup of the manual operation_id assigned to the methods
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant