I have a resource with a Route that instead of returning the own schema, should return the schema of another ModelResource. I'll explain with some code that is purely a demo but should give the idea:
class UserResource(ModelResource):
class Meta:
model = User
class AuthResource(Resource):
class Meta:
name = 'auth'
@Route.PUT
@jwt_required
def link_facebook_account(self, fb_user_token: fields.String()) -> fields.Inline('user'):
user = User.query.get(get_jwt_identity())
link_fb_account(user, fb_user_token)
return user
Since the link_facebook_account annotates the user resource as its output value, I'm expecting that the /auth/schema endpoint should describe the targetSchema for the link-facebook-account link like this:
"targetSchema": { "$ref": "/api/v1/user/schema" }
But what I have is:
"targetSchema": { "$ref": "/api/v1/auth/schema" }
So the targetSchema refers to the own schema of AuthResource and not to the UserResource schema. Anyway calling the endpoint produces the correct result returning the serialized user object.
I have a resource with a Route that instead of returning the own schema, should return the schema of another ModelResource. I'll explain with some code that is purely a demo but should give the idea:
Since the
link_facebook_account
annotates theuser
resource as its output value, I'm expecting that the /auth/schema endpoint should describe thetargetSchema
for thelink-facebook-account
link like this:"targetSchema": { "$ref": "/api/v1/user/schema" }
But what I have is:
"targetSchema": { "$ref": "/api/v1/auth/schema" }
So the targetSchema refers to the own schema of AuthResource and not to the UserResource schema. Anyway calling the endpoint produces the correct result returning the serialized user object.