@@ -20,37 +20,32 @@ pip install drf-openapi-tester
2020
2121## Usage
2222
23- First instantiate one or more instances of SchemaTester:
23+ Instantiate one or more instances of ` SchemaTester ` :
2424
2525``` python
2626from openapi_tester import SchemaTester
2727
2828schema_tester = SchemaTester()
29-
30-
3129```
3230
3331If you are using either [ drf-yasg] ( https://github.com/axnsan12/drf-yasg )
3432or [ drf-spectacular] ( https://github.com/tfranzel/drf-spectacular ) this will be auto-detected, and the schema will be
35- loaded by the SchemaTester automatically. If you are using schema files though, you will need to pass the file path to
36- the tester:
33+ loaded by the ` SchemaTester ` automatically.
34+
35+ If you are using schema files, you will need to pass the file path:
3736
3837``` python
3938from openapi_tester import SchemaTester
4039
4140# path should be a string
4241schema_tester = SchemaTester(schema_file_path = " ./schemas/publishedSpecs.yaml" )
43-
44-
4542```
4643
47- Once you instantiate a tester, you can use it to test responses:
44+ Once you've instantiated a tester, you can use it to test responses:
4845
4946``` python
5047from openapi_tester.schema_tester import SchemaTester
5148
52- # you need to create at least one instance of SchemaTester.
53- # you can pass kwargs to it
5449schema_tester = SchemaTester()
5550
5651
@@ -60,7 +55,7 @@ def test_response_documentation(client):
6055 schema_tester.validate_response(response = response)
6156```
6257
63- If you are using the Django testing framework, you can create a base APITestCase that incorporates schema validation:
58+ If you are using the Django testing framework, you can create a base ` APITestCase ` that incorporates schema validation:
6459
6560``` python
6661from rest_framework.response import Response
@@ -131,7 +126,7 @@ def my_test(client):
131126
132127### case_tester
133128
134- The case tester argument takes a callable that is used to validate the key casings of both schemas and responses. If
129+ The case tester argument takes a callable that is used to validate the key case of both schemas and responses. If
135130nothing is passed, case validation is skipped.
136131
137132The library currently has 4 built-in case testers:
@@ -141,11 +136,11 @@ The library currently has 4 built-in case testers:
141136- ` is_camel_case `
142137- ` is_kebab_case `
143138
144- You can of course pass your own custom case tester .
139+ You can use one of these, or your own.
145140
146141### ignore_case
147142
148- List of keys to ignore when testing key casing . This setting only applies when case_tester is not ` None ` .
143+ List of keys to ignore when testing key case . This setting only applies when case_tester is not ` None ` .
149144
150145### validators
151146
@@ -171,7 +166,7 @@ def my_uuid_4_validator(schema_section: dict, data: Any) -> Optional[str]:
171166
172167### field_key_map
173168
174- You can pass an optional dictionary that maps custom url parameter names into values, for cases where this cannot be
169+ You can pass an optional dictionary that maps custom url parameter names into values, for situations where this cannot be
175170inferred by the DRF ` EndpointEnumerator ` . A concrete use case for this option is when
176171the [ django i18n locale prefixes] ( https://docs.djangoproject.com/en/3.1/topics/i18n/translation/#language-prefix-in-url-patterns ) .
177172
@@ -185,10 +180,9 @@ schema_tester = SchemaTester(field_key_map={
185180
186181## Schema Validation
187182
188- When the SchemaTester loads a schema, it runs it through
189- [ OpenAPI Spec validator] ( https://github.com/p1c2u/openapi-spec-validator ) which validates that the schema passes without
190- specification compliance issues. In case of issues with the schema itself, the validator will raise the appropriate
191- error.
183+ When the SchemaTester loads a schema, it parses it using an
184+ [ OpenAPI spec validator] ( https://github.com/p1c2u/openapi-spec-validator ) . This validates the schema.
185+ In case of issues with the schema itself, the validator will raise the appropriate error.
192186
193187## Django testing client
194188
0 commit comments