Skip to content
Snippets Groups Projects
Commit e05aeef4 authored by Swen Vermeul's avatar Swen Vermeul
Browse files

added parents_or_children to get_type_for_entity

parent 2579befe
No related branches found
No related tags found
No related merge requests found
......@@ -461,12 +461,12 @@ def get_fetchoption_for_entity(entity):
except KeyError as e:
return {}
def get_type_for_entity(entity, action):
def get_type_for_entity(entity, action, parents_or_children=''):
if action not in "create update delete search".split():
raise ValueError('unknown action: {}'.format(action))
definition = openbis_definitions(entity)
if action in definition:
if action in definition and not parents_or_children:
return definition[action]
else:
# try to guess type, according to the naming scheme
......@@ -478,10 +478,16 @@ def get_type_for_entity(entity, action):
"search": "SearchCriteria",
}
return {
"@type": "as.dto.{}.{}.{}{}"
.format(entity.lower(), action, cap_entity, noun[action])
}
if parents_or_children:
return {
"@type": "as.dto.{}.{}.{}{}{}"
.format(entity.lower(), action, cap_entity, parents_or_children, noun[action])
}
else:
return {
"@type": "as.dto.{}.{}.{}{}"
.format(entity.lower(), action, cap_entity, noun[action])
}
def get_method_for_entity(entity, action):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment