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 :-). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@davebelais - Thoughts on using the optional
operationId
property when generating client methods as part ofoapi.client.Module.save(...)
?In this method:
_iter_operation_method_declaration
Something 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_id
Whereas 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 theoperationId
already contained(get|post|delete)_
etc to not include that as part of the method name so as to not repeat it.Also,
operationId
has 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 sourceBeta Was this translation helpful? Give feedback.
All reactions