f5-common-python icon indicating copy to clipboard operation
f5-common-python copied to clipboard

Classes should follow naming convention

Open wojtek0806 opened this issue 8 years ago • 7 comments

There are quite a few classes that do not follow naming convention, i.e using plural or _s for collections and singular for resources:

e.g. policys_s, policys ==> policys_s, policy profiles_s, profiles ==> profiles_s, profile

There are a lot more examples, and we should refactor this to stay in line with what we set in our dev guide. This will break backwards compatibility.

wojtek0806 avatar Feb 06 '17 14:02 wojtek0806

@zancas @pjbreaux @caphrim007 @jasonrahm

wojtek0806 avatar Feb 09 '17 22:02 wojtek0806

After some thinking on the subject, i think the best approach is to follow naming pattern derived from json kind. This would mean as follows:

  1. If the the last part of json kind for a name of a resource is in plural, the sub-collection class name of that resource would have '_s' added. Then subsequently, the resource class name would be in plural. For example:
tm:security:firewall:rule-list:rules:rulesstate

Collection = RULES_S
Resource = RULES
  1. If the the last part of json kind for a name of a resource is in singular, the sub-collection class name of that resource would have 's' or '_s' added. However name of the class for resource would be in singular. For example:
tm:security:firewall:address-list:address-liststate

Collection = Address_Lists
Resource = Address_List

tm:asm:policies:policystate

Collection = Policies_s
Resource = Policy

@caphrim007 @jasonrahm @zancas @pjbreaux

Please let me know your thoughts, and if you agree, we need to put this inside developer documentation. I will start refactoring after we agree on the end format. This will break backwards compatibility in some cases.

wojtek0806 avatar Mar 20 '17 10:03 wojtek0806

We have to do this sooner than later in order to have this SDK remain consistent.

wojtek0806 avatar Mar 20 '17 10:03 wojtek0806

how is this any different that what is already there?

caphrim007 avatar Mar 27 '17 22:03 caphrim007

There are few places where it is inconsistent

wojtek0806 avatar Mar 27 '17 22:03 wojtek0806

closing due to lack of interest

wojtek0806 avatar Sep 01 '17 08:09 wojtek0806

re-opening. this still needs to be fixed. there is no lack of interest

caphrim007 avatar Sep 01 '17 14:09 caphrim007