cloudendpoints/endpoints-python

Spec generation basePath bug

Closed this issue · 1 comments

sahr commented

In v2, if the base path is set to root like so

# resolves to /api/
api_collection = endpoints.api(name='api', version='v1', base_path='/')

then this incorrectly produces a spec with the basePath to nothing ""

{
  "basePath": "/",
  "consumes": [
    "application/json"
  ],

when it should leave it as root "/"

@sahr This is kind annoying... for now I changed the line

'basePath': api_info.base_path.rstrip('/'),

to

'basePath': api_info.base_path.rstrip('/') if api_info.base_path != "/" else api_info.base_path

cheers