adriangb / xpresso

A composable Python ASGI web framework
https://xpresso-api.dev/
MIT License
178 stars 4 forks source link

feat: generate operationId in OpenAPI #20

Closed adriangb closed 2 years ago

adriangb commented 2 years ago

A bit of digging here.

I see two use cases for automatically generating the operationId:

  1. For client generators. I don't think this is a good use case: an autogenerated name like function_name__path_path_param__get is not a good function name for a method in a client. And most clients will auto-generate method names anyway.
  2. For OpenAPI links. This is a valid use case. OpenaAPI links require an operationId to link between operations. So this is tied to #29. We could just generate operationIds when they're required by links, we could autogenerate them by default always or we could require that the user specify an operationId if they want to use OpenAPI links.