You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect the action's path to be /_ah/api/someapi/v1/some. However, the path is /_ah/api/someapi/v1/some/some_index:
This issue exists in both endpoints framework 1 and 2.0.2.
Root Cause
Within the decorator function created by endpoints.api_config.method(), it performs a truthy check of the provided path, and defaults to the method's __name__ if it is falsey.
However, _MethodInfo.get_path() provides explicit handling of an empty string (which never happens due to @endpoints.method not allowing the empty string):
defget_path(self, api_info):
...
path=self.__pathor''ifpathandpath[0] =='/':
# Absolute path, ignoring any prefixes. Just strip off the leading /.path=path[1:]
else:
# Relative path.ifapi_info.path:
path='%s%s%s'% (api_info.path, '/'ifpathelse'', path)
# Verify that the path seems valid.forpartinpath.split('/'):
ifpartand'{'inpartand'}'inpart:
ifre.match('^{[^{}]+}$', part) isNone:
raiseapi_exceptions.ApiConfigurationError(
'Invalid path segment: %s (part of %s)'% (part, path))
returnpath
This can be worked around, but it requires not using the path argument to @api_collection.api_class() for specifying the path, in order to give each method decorator a non-empty string.
The text was updated successfully, but these errors were encountered:
aetherknight
changed the title
not possible to specify an "index" action for a resource
not possible to specify an "index" action for a resource with an empty sub-path
Feb 23, 2017
Given:
I would expect the action's path to be
/_ah/api/someapi/v1/some
. However, the path is/_ah/api/someapi/v1/some/some_index
:This issue exists in both endpoints framework 1 and 2.0.2.
Root Cause
Within the decorator function created by
endpoints.api_config.method()
, it performs a truthy check of the providedpath
, and defaults to the method's__name__
if it is falsey.However,
_MethodInfo.get_path()
provides explicit handling of an empty string (which never happens due to@endpoints.method not allowing the empty string
):This can be worked around, but it requires not using the
path
argument to@api_collection.api_class()
for specifying the path, in order to give eachmethod
decorator a non-empty string.The text was updated successfully, but these errors were encountered: