# Path: rest_framework_json_schema/exceptions.py
# class TypeConflict(Exception):
#     """
#     The type passed to this resource object is incorrect.
# 
#     https://jsonapi.org/format/#crud-creating-responses-409
#     """
# 
# class IncludeInvalid(Exception):
#     """
#     The relationship cannot be included.
# 
#     https://jsonapi.org/format/#fetching-includes
#     """
# 
# Path: rest_framework_json_schema/transforms.py
# class NullTransform(Transform):
#     """A transform that doesn't do anything."""
# 
#     def transform(self, name: str) -> str:
#         """Do nothing."""
#         return name
# 
# class Transform(ABC):
#     """Provide the base interface for transforms."""
# 
#     @abstractmethod
#     def transform(self, name: str) -> str:
#         """Return the transformed name."""
#         ...


from collections import OrderedDict
from typing import (
    Any,
    Optional,
    Dict,
    Sequence,
    Tuple,
    List,
    Callable,
    Union,
    Type,
    cast,
    Iterator,
    overload,
)
from django.urls import reverse
from rest_framework.request import Request
from .exceptions import TypeConflict, IncludeInvalid
from .transforms import NullTransform, Transform
        relationships, included = self.render_relationships(data, context)
        if relationships:
            result["relationships"] = relationships

        links = self.render_links(data, context)
        if links:
            result["links"] = links

        meta = self.render_meta(data, context)
        if meta:
            result["meta"] = meta
        return result, included

    def render_attributes(self, data: Dict, context: Context) -> ObjDataType:
        """Render model attributes to the output type."""
        attributes = self.filter_by_fields(self.attributes, context.fields, lambda x: x)
        return OrderedDict(
            (self.transformed_names[attr], self.from_data(data, attr))
            for attr in attributes
            if attr in data
        )

    def render_relationships(self, data: Dict, context: Context) -> RenderResultType:
        """Render model relationships to the output type, including included resources."""
        relationships: Dict[str, Dict] = OrderedDict()
        included = []
        # Validate that all top-level include keys are actually relationships
        rel_keys = {rel[0] for rel in self.relationships}
        for key in context.include:
            if key not in rel_keys:

# Path: rest_framework_json_schema/exceptions.py
# class TypeConflict(Exception):
#     """
#     The type passed to this resource object is incorrect.
# 
#     https://jsonapi.org/format/#crud-creating-responses-409
#     """
# 
# class IncludeInvalid(Exception):
#     """
#     The relationship cannot be included.
# 
#     https://jsonapi.org/format/#fetching-includes
#     """
# 
# Path: rest_framework_json_schema/transforms.py
# class NullTransform(Transform):
#     """A transform that doesn't do anything."""
# 
#     def transform(self, name: str) -> str:
#         """Do nothing."""
#         return name
# 
# class Transform(ABC):
#     """Provide the base interface for transforms."""
# 
#     @abstractmethod
#     def transform(self, name: str) -> str:
#         """Return the transformed name."""
#         ...


# Path: rest_framework_json_schema/schema.py
from collections import OrderedDict
from typing import (
    Any,
    Optional,
    Dict,
    Sequence,
    Tuple,
    List,
    Callable,
    Union,
    Type,
    cast,
    Iterator,
    overload,
)
from django.urls import reverse
from rest_framework.request import Request
from .exceptions import TypeConflict, IncludeInvalid
from .transforms import NullTransform, Transform

        relationships, included = self.render_relationships(data, context)
        if relationships:
            result["relationships"] = relationships

        links = self.render_links(data, context)
        if links:
            result["links"] = links

        meta = self.render_meta(data, context)
        if meta:
            result["meta"] = meta
        return result, included

    def render_attributes(self, data: Dict, context: Context) -> ObjDataType:
        """Render model attributes to the output type."""
        attributes = self.filter_by_fields(self.attributes, context.fields, lambda x: x)
        return OrderedDict(
            (self.transformed_names[attr], self.from_data(data, attr))
            for attr in attributes
            if attr in data
        )

    def render_relationships(self, data: Dict, context: Context) -> RenderResultType:
        """Render model relationships to the output type, including included resources."""
        relationships: Dict[str, Dict] = OrderedDict()
        included = []
        # Validate that all top-level include keys are actually relationships
        rel_keys = {rel[0] for rel in self.relationships}
        for key in context.include:
            if key not in rel_keys:

                raise IncludeInvalid("Invalid relationship to include: %s" % key)