# 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/schema.py
# class Context:
# class BaseLinkedObject:
# class ResourceObject(BaseLinkedObject):
# class ResourceIdObject(BaseLinkedObject):
# class RelationshipObject(BaseLinkedObject):
# class LinkObject:
# class UrlLink(LinkObject):
#     def __init__(
#         self,
#         request: Request,
#         include: Optional[Dict] = None,
#         fields: Optional[Dict] = None,
#     ) -> None:
#     def render_links(self, data: ObjDataType, context: Context) -> OrderedDict:
#     def render_meta(self, data: Any, context: Context) -> Optional[Dict]:
#     def __init__(self, **kwargs: Any) -> None:
#         def _normalize_rel(rel: RelOptType) -> RelType:
#     def parse(self, data: ObjDataType, context: Context) -> Dict:
#     def render(self, data: ObjDataType, context: Context) -> RenderResultType:
#     def render_attributes(self, data: Dict, context: Context) -> ObjDataType:
#     def render_relationships(self, data: Dict, context: Context) -> RenderResultType:
#     def render_relationship(
#         self, data: Dict, rel_name: str, rel: "RelationshipObject", context: Context
#     ) -> RenderResultType:
#     def from_data(self, data: Dict, attr: str) -> Any:
#     def filter_by_fields(
#         self, names: Sequence[RelType], fields: Dict, name_fn: Callable[[RelType], str]
#     ) -> Iterator[RelType]:
#     def filter_by_fields(
#         self, names: Sequence[str], fields: Dict, name_fn: Callable[[str], str]
#     ) -> Iterator[str]:
#     def filter_by_fields(
#         self, names: Sequence[Any], fields: Dict, name_fn: Callable[[Any], str]
#     ) -> Iterator[Any]:
#     def __init__(self, **kwargs: Any) -> None:
#     def render(self, request: Request) -> Dict[str, Any]:
#     def get_schema(self) -> ResourceObject:
#     def get_data(self) -> Dict[str, Any]:
#     def __init__(self, **kwargs: Any) -> None:
#     def render_included(
#         self, rel_data: "ResourceIdObject", context: Context
#     ) -> List[Dict[str, Any]]:
#     def render(
#         self,
#         obj_data: ObjDataType,
#         rel_data: ResourceIdObject,
#         context: Context,
#         include_this: bool,
#     ) -> RenderResultType:
#     def parse(
#         self, obj_data: ObjDataType, context: Context
#     ) -> Union[str, List[str], None]:
#     def __init__(self, **kwargs: Any) -> None:
#     def render(self, data: ObjDataType, request: Request) -> Any:
#     def render(self, data: ObjDataType, request: Request) -> Any:
# 
# Path: rest_framework_json_schema/transforms.py
# class CamelCaseTransform(Transform):
#     """Transform snake_underscore_case to camelCase."""
# 
#     def transform(self, name: str) -> str:
#         """Transform snake_underscore_case to camelCase."""
#         split = name.split("_")
#         return split[0] + "".join([_upper(c) for c in split[1:]])
# 
# Path: rest_framework_json_schema/utils.py
# def parse_include(include: str) -> Dict[str, Dict]:
#     """
#     Parse an include parameter into its constituent paths.
# 
#     It returns a tree of include paths, for instance:
# 
#     a,a.b,a.c.d,e.f,g
#     Returns:
#     {
#         'a': {
#             'b': {},
#             'c', {
#                 'd': {}
#             }
#         },
#         'e': {
#             'f': {}
#         },
#         'g': {}
#     }
#     """
#     result: Dict[str, Dict] = {}
#     split = include.split(",")
#     for path in split:
#         if path:
#             components = path.split(".")
#             level = result
#             for c in components:
#                 if c not in level:
#                     level[c] = {}
#                 level = level[c]
#     return result
# 
# Path: tests/support/decorators.py



from collections import OrderedDict
from typing import Any, Dict
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory
from rest_framework_json_schema.exceptions import TypeConflict, IncludeInvalid
from rest_framework_json_schema.schema import (
    Context,
    ResourceObject,
    RelationshipObject,
    ResourceIdObject,
    LinkObject,
    UrlLink,
    ObjDataType,
)
from rest_framework_json_schema.transforms import CamelCaseTransform
from rest_framework_json_schema.utils import parse_include
from tests.support.decorators import mark_urls
import pytest
    """To support write_only data, be tolerant if a relationship isn't in the data."""

    class AlbumObject(ResourceObject):
        type = "album"
        relationships = ("artist", "artist2")

    # Empty to-one relationship: relationship is 'None'
    # Empty to-many relationship: relationship is '[]'
    # Single relationship: a ResourceIdObject
    # To-Many: an array of ResourceIdObjects
    obj = AlbumObject()

    primary, included = obj.render({"id": "123", "artist2": None}, context)
    assert primary == OrderedDict(
        (
            ("id", "123"),
            ("type", "album"),
            (
                "relationships",
                OrderedDict((("artist2", OrderedDict((("data", None),))),)),
            ),
        )
    )
    assert included == []


@mark_urls
def test_render_included(schema_request: Request) -> None:
    """You can render included resources."""


# 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/schema.py
# class Context:
# class BaseLinkedObject:
# class ResourceObject(BaseLinkedObject):
# class ResourceIdObject(BaseLinkedObject):
# class RelationshipObject(BaseLinkedObject):
# class LinkObject:
# class UrlLink(LinkObject):
#     def __init__(
#         self,
#         request: Request,
#         include: Optional[Dict] = None,
#         fields: Optional[Dict] = None,
#     ) -> None:
#     def render_links(self, data: ObjDataType, context: Context) -> OrderedDict:
#     def render_meta(self, data: Any, context: Context) -> Optional[Dict]:
#     def __init__(self, **kwargs: Any) -> None:
#         def _normalize_rel(rel: RelOptType) -> RelType:
#     def parse(self, data: ObjDataType, context: Context) -> Dict:
#     def render(self, data: ObjDataType, context: Context) -> RenderResultType:
#     def render_attributes(self, data: Dict, context: Context) -> ObjDataType:
#     def render_relationships(self, data: Dict, context: Context) -> RenderResultType:
#     def render_relationship(
#         self, data: Dict, rel_name: str, rel: "RelationshipObject", context: Context
#     ) -> RenderResultType:
#     def from_data(self, data: Dict, attr: str) -> Any:
#     def filter_by_fields(
#         self, names: Sequence[RelType], fields: Dict, name_fn: Callable[[RelType], str]
#     ) -> Iterator[RelType]:
#     def filter_by_fields(
#         self, names: Sequence[str], fields: Dict, name_fn: Callable[[str], str]
#     ) -> Iterator[str]:
#     def filter_by_fields(
#         self, names: Sequence[Any], fields: Dict, name_fn: Callable[[Any], str]
#     ) -> Iterator[Any]:
#     def __init__(self, **kwargs: Any) -> None:
#     def render(self, request: Request) -> Dict[str, Any]:
#     def get_schema(self) -> ResourceObject:
#     def get_data(self) -> Dict[str, Any]:
#     def __init__(self, **kwargs: Any) -> None:
#     def render_included(
#         self, rel_data: "ResourceIdObject", context: Context
#     ) -> List[Dict[str, Any]]:
#     def render(
#         self,
#         obj_data: ObjDataType,
#         rel_data: ResourceIdObject,
#         context: Context,
#         include_this: bool,
#     ) -> RenderResultType:
#     def parse(
#         self, obj_data: ObjDataType, context: Context
#     ) -> Union[str, List[str], None]:
#     def __init__(self, **kwargs: Any) -> None:
#     def render(self, data: ObjDataType, request: Request) -> Any:
#     def render(self, data: ObjDataType, request: Request) -> Any:
# 
# Path: rest_framework_json_schema/transforms.py
# class CamelCaseTransform(Transform):
#     """Transform snake_underscore_case to camelCase."""
# 
#     def transform(self, name: str) -> str:
#         """Transform snake_underscore_case to camelCase."""
#         split = name.split("_")
#         return split[0] + "".join([_upper(c) for c in split[1:]])
# 
# Path: rest_framework_json_schema/utils.py
# def parse_include(include: str) -> Dict[str, Dict]:
#     """
#     Parse an include parameter into its constituent paths.
# 
#     It returns a tree of include paths, for instance:
# 
#     a,a.b,a.c.d,e.f,g
#     Returns:
#     {
#         'a': {
#             'b': {},
#             'c', {
#                 'd': {}
#             }
#         },
#         'e': {
#             'f': {}
#         },
#         'g': {}
#     }
#     """
#     result: Dict[str, Dict] = {}
#     split = include.split(",")
#     for path in split:
#         if path:
#             components = path.split(".")
#             level = result
#             for c in components:
#                 if c not in level:
#                     level[c] = {}
#                 level = level[c]
#     return result
# 
# Path: tests/support/decorators.py



# Path: tests/test_schema.py
from collections import OrderedDict
from typing import Any, Dict
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory
from rest_framework_json_schema.exceptions import TypeConflict, IncludeInvalid
from rest_framework_json_schema.schema import (
    Context,
    ResourceObject,
    RelationshipObject,
    ResourceIdObject,
    LinkObject,
    UrlLink,
    ObjDataType,
)
from rest_framework_json_schema.transforms import CamelCaseTransform
from rest_framework_json_schema.utils import parse_include
from tests.support.decorators import mark_urls
import pytest

    """To support write_only data, be tolerant if a relationship isn't in the data."""

    class AlbumObject(ResourceObject):
        type = "album"
        relationships = ("artist", "artist2")

    # Empty to-one relationship: relationship is 'None'
    # Empty to-many relationship: relationship is '[]'
    # Single relationship: a ResourceIdObject
    # To-Many: an array of ResourceIdObjects
    obj = AlbumObject()

    primary, included = obj.render({"id": "123", "artist2": None}, context)
    assert primary == OrderedDict(
        (
            ("id", "123"),
            ("type", "album"),
            (
                "relationships",
                OrderedDict((("artist2", OrderedDict((("data", None),))),)),
            ),
        )
    )
    assert included == []


@mark_urls
def test_render_included(schema_request: Request) -> None:
    """You can render included resources."""


    class ArtistObject(ResourceObject):