validation error in ProtoRPC

1

I'm getting some protorpc errors when I try to use endPoints.

My code:

class Application(EndpointsModel):

    _message_fields_schema = ('id', 'nome')

    criado = ndb.DateTimeProperty(auto_now_add=True)
    nome = ndb.StringProperty()
    regras = ndb.IntegerProperty(repeated=True)
    atualizado = ndb.DateTimeProperty(auto_now=True)
    dono = ndb.KeyProperty(kind='User')

@API.api_class(resource_nome="application")
class ApplicationApi(protorpc.remote.Service):

    @Application.method(http_method="GET", request_fields=('id',), name="get", path="app/{id}")
    def ApplicationGet(self, instance):
        if not instance.from_datastore:
            raise endpoints.NotFoundException("nao encontrado.")
        return instance

    @Application.query_method(http_method="GET", query_fields=('limite', 'ordem', 'token'), nome="lista", path="app")
    def ApplicationList(self, query):
        return query

When I call application.get (), it gives the error

ERROR    2018-07-04 09:30:16,199 test.py:366] Encountered unexpected error from ProtoRPC method implementation: TypeError (Can only copy from entities of the exact type Application. Received an instance of Application.)

What could be causing this?

    
asked by anonymous 04.07.2018 / 15:09

1 answer

2

I've had a similar error, you'll need to do a subclass of JsonModel(EndpointsModel)

    
04.07.2018 / 15:14