<commit_before>Django REST Framework - JSON API
================================

A parser and renderer for `Django REST
Framework <http://www.django-rest-framework.org/>`__ that adds support
for the `JSON API <http://jsonapi.org/>`__ specification.

Build status: |Build Status|

Does this work?
---------------

**This package is currently being actively developed**, but is not
widely used in production. If you find any problems when using this
package, please create a bug report at the [issue
tracker][issue-tracker] so we can figure out how to fix it.

How do I use this?
------------------

This is designed to be used as only a renderer and parser and does not
provide any additional functionality that may be expected by JSON API.

Specific to a view(set)
~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    from rest_framework import generics
    from rest_framework_json_api.renderers import JsonApiRenderer


    class ExampleView(generics.ListAPIView):
        renderer_classes = (JsonApiRenderer, )

The JSON API renderer is not limited to just list views and can be used
on any of the generic views. It supports viewsets as well as non-generic
views.

All views
~~~~~~~~~

The JSON API renderer can be used on all views by setting it as a
default renderer.

.. code:: python

    # ...
    REST_FRAMEWORK = {
        "DEFAULT_RENDERER_CLASSES": (
            "rest_framework_json_api.renderers.CamelCaseJSONRenderer",
            # Any other renderers
        ),
        "DEFAULT_PARSER_CLASSES": (
            "rest_framework_json_api.parsers.CamelCaseJSONParser",
            # Any other parsers
        ),
    }
    #...

What does this support?
-----------------------

The JSON API renderer supports all features of hyperlinked serializers
and will normalize attributes such as the ```url``
field <http://www.django-rest-framework.org/api-guide/settings#url_field_name>`__
to match the JSON API specification.

Introspected resource types
~~~~~~~~~~~~~~~~~~~~~~~~~~~

JSON API uses `resource
types <http://jsonapi.org/format/#document-structure-resource-types>`__<commit_msg>Update instructions for applying to all views<commit_after>Django REST Framework - JSON API
================================

A parser and renderer for `Django REST
Framework <http://www.django-rest-framework.org/>`__ that adds support
for the `JSON API <http://jsonapi.org/>`__ specification.

Build status: |Build Status|

Does this work?
---------------

**This package is currently being actively developed**, but is not
widely used in production. If you find any problems when using this
package, please create a bug report at the [issue
tracker][issue-tracker] so we can figure out how to fix it.

How do I use this?
------------------

This is designed to be used as only a renderer and parser and does not
provide any additional functionality that may be expected by JSON API.

Specific to a view(set)
~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

    from rest_framework import generics
    from rest_framework_json_api.renderers import JsonApiRenderer


    class ExampleView(generics.ListAPIView):
        renderer_classes = (JsonApiRenderer, )

The JSON API renderer is not limited to just list views and can be used
on any of the generic views. It supports viewsets as well as non-generic
views.

All views
~~~~~~~~~

The JSON API renderer can be used on all views by setting it as a
default renderer.

.. code:: python

    # ...
    REST_FRAMEWORK = {
        "DEFAULT_RENDERER_CLASSES": (
            "rest_framework_json_api.renderers.JsonApiRenderer",
            "rest_framework.renderers.BrowseableAPIRenderer",
            # Any other renderers
        ),
        "DEFAULT_PARSER_CLASSES": (
            "rest_framework_json_api.parsers.JsonApiParser",
            "rest_framework.parsers.FormParser",
            "rest_framework.parsers.MultiPartParser",
            # Any other parsers
        ),
    }
    #...

What does this support?
-----------------------

The JSON API renderer supports all features of hyperlinked serializers
and will normalize attributes such as the ```url``
field <http://www.django-rest-framework.org/api-guide/settings#url_field_name>`__
to match the JSON API specification.

Introspected resource types
~~~~~~~~~~~~~~~~~~~~~~~~~~~

JSON API uses `resource
types <http://jsonapi.org/format/#document-structure-resource-types>`__
{'fraction_non_alphanumeric': 0.13395923975269064, 'fraction_numerical': 0.0, 'mean_word_length': 3.2325581395348837, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6285586', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1147, 'n_words': 448}