Use optional operation.operation_id when generating client methods #22
stephenknoth
started this conversation in
Ideas
Replies: 1 comment 1 reply
|
@stephenknoth - Yes, I think that should be fine. It would write clients which are incompatible with previous versions, however—so would require a major version bump. I had used operationId for model class names in version 0.x, but ran into too many scenarios where that introduced conflicts—but for client methods I can't think of any likely issues so long as operationId is used correctly :-). |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@davebelais - Thoughts on using the optional
operationIdproperty when generating client methods as part ofoapi.client.Module.save(...)?In this method:
_iter_operation_method_declarationSomething like this..
Reason being - if you have a path like this:
/entrants_event.aspx?did={event_id}It can make for a pretty ugly looking method name:
get_entrants_event_aspx_did_event_idWhereas with the above substitution and openapi path definition:
you can a resulting method name like:
get_event_entrants. I think there could be other checks too, like if theoperationIdalready contained(get|post|delete)_etc to not include that as part of the method name so as to not repeat it.Also,
operationIdhas to be unique per the openapi 3.0.0 spec, so we'd need to keep track of which were already used when generating the sourceAll reactions