fabien0102 / openapi-codegen

A tool for generating code base on an OpenAPI schema.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Suggestion] Make a dictionary of all operations with response, operationId, path, variables

sneko opened this issue · comments

Hi @fabien0102 ,

My use case: allow mocking easily while being type-safe.

I do see the QueryOperation type with the union but it misses the response type in each object. I can tweak with TypeScript to get for example ApiCategoriesGetCollectionVariables from QueryOperation, then remove the suffix and add as suffix Response but it's a bit annoying (but still doable).

On the other side, I'm stuck because for mutations there is no such union type, so it's impossible to infer operationId/path since they are used as hard values inside their fetch method.

Having them centralized and normalized would help extending the default generation.

Thank you,