class TestSchema(JSONAPISchema): class Meta: type_ = 'foo' id = fields.Str() rel = JSONAPIRelationship(schema=OtherSchema, include_resource_linkage=False, type_='bar')
class TestSchema(JSONAPISchema): class Meta: type_ = 'foo' id = fields.Str() rel = JSONAPIRelationship(id_attribute='rel_id', schema=OtherSchema, include_resource_linkage=True, type_='bar')
class TestSchema(JSONAPISchema): class Meta: type_ = 'foo' id = fields.Str() rel = JSONAPIRelationship( id_attribute='rel_id', schema=OtherSchema, type_='bar', )
class TSchema(JSONAPISchema): id = fields.Str(dump_only=True) name = fields.Str() rel_many = JSONAPIRelationship(schema='TRelatedSchema', type_='test-related-resource', many=True) class Meta: type_ = 'test-resource'
class TSchema(JSONAPISchema): id = fields.Str(dump_only=True) name = fields.Str() rel = JSONAPIRelationship( schema='TRelatedSchema', type_='test-related-resource', include_resource_linkage=True, ) class Meta: type_ = 'test-resource'
class UserSchema(JSONAPISchema): id = fields.Str(dump_only=True) username = fields.Str(required=True) organization = JSONAPIRelationship( type_='organizations', schema='OrganizationSchema', include_resource_linkage=True, required=True, ) class Meta: type_ = 'users' self_route = 'users:get' self_route_kwargs = {'id': '<id>'} self_route_many = 'users:get_all'
class FooSchema(JSONAPISchema): id = fields.Str() rel = JSONAPIRelationship( schema='OtherSchema', include_resource_linkage=True, type_='others', related_route='others:get', related_route_kwargs={'id': '<rel_id>'}, id_attribute='rel_id', ) class Meta: type_ = 'foo' self_route = 'foo:get' self_route_kwargs = {'id': '<id>'} self_route_many = 'foo:get_all'
class FooSchema(JSONAPISchema): id = fields.Str() rel = JSONAPIRelationship( schema='OtherSchema', type_='others', self_route='', related_resource='OtherResource', related_route='foo:rel', related_route_kwargs={'id': '<id>'}, id_attribute='rel_id', ) class Meta: type_ = 'foo' self_route = 'foo:get' self_route_kwargs = {'id': '<id>'} self_route_many = 'foo:get_many'
class UserSchema(JSONAPISchema): id = fields.Str(dump_only=True) username = fields.Str(required=True) organization = JSONAPIRelationship( type_='organizations', schema='OrganizationSchema', id_attribute='organization_id', required=True, related_route='users:organization', related_route_kwargs={'id': '<id>'}, related_resource='OrganizationsResource', ) class Meta: type_ = 'users' strict = True self_route = 'users:get' self_route_kwargs = {'id': '<id>'} self_route_many = 'users:get_many'
class TSchema(JSONAPISchema): id = fields.Str(dump_only=True) name = fields.Str() rel = JSONAPIRelationship( schema='TRelatedSchema', type_='test-related-resource', self_route='test-resource:relationship-rel', self_route_kwargs={'id': '<id>'}, related_resource='TRelatedResource', related_route='test-resource:rel', related_route_kwargs={'id': '<id>'}, many=True, ) class Meta: type_ = 'test-resource' self_route = 'test-resource:get' self_route_kwargs = {'id': '<id>'} self_route_many = 'test-resource:get_many'
class TeamSchema(JSONAPISchema): id = fields.Str(dump_only=True) name = fields.Str(required=True) users = JSONAPIRelationship( type_='users', schema='UserSchema', many=True, required=True, self_route='teams:relationships-users', self_route_kwargs={'parent_id': '<id>'}, related_resource='UsersResource', related_route='teams:users', related_route_kwargs={'id': '<id>'}, ) class Meta: type_ = 'teams' self_route = 'teams:get' self_route_kwargs = {'id': '<id>'} self_route_many = 'teams:get_many'
class TestSchema(JSONAPISchema): class Meta: type_ = 'foo' id = fields.Str() rel = JSONAPIRelationship(schema=OtherSchema, type_='bar')