<commit_before>Configuring pyramid_swagger
===========================================

The pyramid_swagger library is intended to require very little configuration to
get up and running.

A few relevant settings for your `Pyramid .ini file <http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html#pyramid-includes-vs-pyramid-config-configurator-include>`_ (and their default settings):

.. code-block:: ini

        [app:main]
        # Add the pyramid_swagger validation tween to your app (required)
        pyramid.includes = pyramid_swagger

        # Point pyramid_swagger at your api declaration (defaults to swagger.json)
        pyramid_swagger.schema_path = "swagger.json"

        # Enable/disable response validation (true by default)
        pyramid_swagger.enable_response_validation = true

        # Enable/disable swagger spec validation (true by default)
        pyramid_swagger.enable_swagger_spec_validation = true

Note that, equivalently, you can add these during webapp configuration:

.. code-block:: python

        def main(global_config, **settings):
            # ...
            settings['pyramid_swagger.schema_path'] = 'swagger.json'
            settings['pyramid_swagger.enable_response_validation'] = True
            settings['pyramid_swagger.enable_swagger_spec_validation'] = True
            config = Configurator(settings=settings)
            config.include('pyramid_swagger')<commit_msg>Modified the docs to include configuration for skipping validation<commit_after>Configuring pyramid_swagger
===========================================

The pyramid_swagger library is intended to require very little configuration to
get up and running.

A few relevant settings for your `Pyramid .ini file <http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html#pyramid-includes-vs-pyramid-config-configurator-include>`_ (and their default settings):

.. code-block:: ini

        [app:main]
        # Add the pyramid_swagger validation tween to your app (required)
        pyramid.includes = pyramid_swagger

        # Point pyramid_swagger at your api declaration (defaults to swagger.json)
        pyramid_swagger.schema_path = "swagger.json"

        # Enable/disable response validation (true by default)
        pyramid_swagger.enable_response_validation = true

        # Enable/disable swagger spec validation (true by default)
        pyramid_swagger.enable_swagger_spec_validation = true

        # Skip validation for certain endpoints. Takes a list
        # of regular expressions for the endpoints to skip
        # ([r'/(static)\b', r'/(api-docs)\b'] by default)
        pyramid_swagger.skip_validation = [r'/(static)\b', r'/(api-docs)\b']

Note that, equivalently, you can add these during webapp configuration:

.. code-block:: python

        def main(global_config, **settings):
            # ...
            settings['pyramid_swagger.schema_path'] = 'swagger.json'
            settings['pyramid_swagger.enable_response_validation'] = True
            settings['pyramid_swagger.enable_swagger_spec_validation'] = True
            settings['pyramid_swagger.skip_validation'] = [r'/(static)\b', r'/(api-docs)\b']
            config = Configurator(settings=settings)
            config.include('pyramid_swagger')
{'fraction_non_alphanumeric': 0.1132990003029385, 'fraction_numerical': 0.0, 'mean_word_length': 3.492517006802721, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5142321', 'n_tokens_mistral': 935, 'n_tokens_neox': 888, 'n_words': 227}