restish icon indicating copy to clipboard operation
restish copied to clipboard

Commands from operationId

Open ServerlessArchitect opened this issue 2 years ago • 3 comments

Restish generates convenient command names such as "messaging-email-address-status-get".

However, our OpenAPI spec defines operationId for all the operations. Is it possible to have Restish use those instead?

ServerlessArchitect avatar Jun 14 '22 14:06 ServerlessArchitect

@ServerlessArchitect the name should be getting set from the operation ID, via this code: https://github.com/danielgtaylor/restish/blob/main/openapi/openapi.go#L214

Do you have a short example which exhibits the incorrect behavior that I could debug?

Edit: is the problem the normalization of kebab-casing for the command-line? Are you saying you'd rather have it use the operationId without any sort of modification? If so, I'd consider an option for that but my preference for a default is to normalize so all the different APIs and operations are standardized.

danielgtaylor avatar Jun 20 '22 02:06 danielgtaylor

@danielgtaylor Sorry I've taken so long to reply!

Edit: is the problem the normalization of kebab-casing for the command-line? Are you saying you'd rather have it use the operationId without any sort of modification?

That's right, but I think I'd misunderstood how it worked. I thought it was based on the URLs. Just to confirm, are you saying the command names are still based on my operationIds, just normalised?

ServerlessArchitect avatar Jul 01 '22 14:07 ServerlessArchitect

@ServerlessArchitect

Just to confirm, are you saying the command names are still based on my operationIds, just normalised?

Yes, it is based on the operationId if present. It is also possible to override it via x-cli-name.

danielgtaylor avatar Jul 01 '22 20:07 danielgtaylor