Yes, you have to sure that the api classes are properly imported, but if there was a problem with this you'd be getting some runtime exception rather than an empty discovery document.
The problem I can see is you're creating the api server with the an_api
object which you use to decorate your actual API classes. You should do the following instead:
an_api = endpoints.api(name='library', version='v1.0')
@an_api.api_class(resource_name='shelves')
class Shelves(remote.Service):
...
@an_api.api_class(resource_name='books', path='books')
class Books(remote.Service):
...
endpoints.api_server([Shelves, Books])
To then go from this to a multi-module API, you'll easily run into a circular dependency situation (something that Python cannot deal with). You then need a common module where you define an_api
; a set of API modules that implement a part of the API, all of which import
the common module; and then you'll need a main module that calls endpoints.api_server
.
A note: in the Python world it's not uncommon for a single module (file) to be quite long indeed and have very many classes in it; this may seem very odd coming from Java or well-structured PHP.