Skip to content

Commit d6fd021

Browse files
authored
Merge pull request #631 from renja-g/fix/docs-indentation
Changed doc indentation from 3 to 4
2 parents 6890a80 + a150c94 commit d6fd021

10 files changed

+236
-236
lines changed

README.rst

+21-21
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ Recommended way (via pip):
4545

4646
.. code-block:: console
4747
48-
pip install openapi-core
48+
pip install openapi-core
4949
5050
Alternatively you can download the code and install from the repository:
5151

5252
.. code-block:: console
5353
54-
pip install -e git+https://github.com/python-openapi/openapi-core.git#egg=openapi_core
54+
pip install -e git+https://github.com/python-openapi/openapi-core.git#egg=openapi_core
5555
5656
5757
First steps
@@ -61,32 +61,32 @@ Firstly create your specification object.
6161

6262
.. code-block:: python
6363
64-
from openapi_core import Spec
64+
from openapi_core import Spec
6565
66-
spec = Spec.from_file_path('openapi.json')
66+
spec = Spec.from_file_path('openapi.json')
6767
6868
Now you can use it to validate and unmarshal against requests and/or responses.
6969

7070
.. code-block:: python
7171
72-
from openapi_core import unmarshal_request
72+
from openapi_core import unmarshal_request
7373
74-
# raises error if request is invalid
75-
result = unmarshal_request(request, spec=spec)
74+
# raises error if request is invalid
75+
result = unmarshal_request(request, spec=spec)
7676
7777
Retrieve validated and unmarshalled request data
7878

7979
.. code-block:: python
8080
81-
# get parameters
82-
path_params = result.parameters.path
83-
query_params = result.parameters.query
84-
cookies_params = result.parameters.cookies
85-
headers_params = result.parameters.headers
86-
# get body
87-
body = result.body
88-
# get security data
89-
security = result.security
81+
# get parameters
82+
path_params = result.parameters.path
83+
query_params = result.parameters.query
84+
cookies_params = result.parameters.cookies
85+
headers_params = result.parameters.headers
86+
# get body
87+
body = result.body
88+
# get security data
89+
security = result.security
9090
9191
Request object should implement OpenAPI Request protocol. Check `Integrations <https://openapi-core.readthedocs.io/en/latest/integrations.html>`__ to find officially supported implementations.
9292

@@ -98,15 +98,15 @@ If you just want to validate your request/response data without unmarshalling, r
9898
Related projects
9999
################
100100
* `openapi-spec-validator <https://github.com/python-openapi/openapi-spec-validator>`__
101-
Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0 and OpenAPI 3.1 specification. The validator aims to check for full compliance with the Specification.
101+
Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0 and OpenAPI 3.1 specification. The validator aims to check for full compliance with the Specification.
102102
* `openapi-schema-validator <https://github.com/python-openapi/openapi-schema-validator>`__
103-
Python library that validates schema against the OpenAPI Schema Specification v3.0 and OpenAPI Schema Specification v3.1.
103+
Python library that validates schema against the OpenAPI Schema Specification v3.0 and OpenAPI Schema Specification v3.1.
104104
* `bottle-openapi-3 <https://github.com/cope-systems/bottle-openapi-3>`__
105-
OpenAPI 3.0 Support for the Bottle Web Framework
105+
OpenAPI 3.0 Support for the Bottle Web Framework
106106
* `pyramid_openapi3 <https://github.com/niteoweb/pyramid_openapi3>`__
107-
Pyramid addon for OpenAPI3 validation of requests and responses.
107+
Pyramid addon for OpenAPI3 validation of requests and responses.
108108
* `tornado-openapi3 <https://github.com/correl/tornado-openapi3>`__
109-
Tornado OpenAPI 3 request and response validation library.
109+
Tornado OpenAPI 3 request and response validation library.
110110

111111

112112
License

docs/contributing.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Install `Poetry <https://python-poetry.org>`__ by following the `official instal
3333

3434
.. code-block:: console
3535
36-
poetry config virtualenvs.in-project true
36+
poetry config virtualenvs.in-project true
3737
3838
Setup
3939
^^^^^
@@ -42,13 +42,13 @@ To create a development environment and install the runtime and development depe
4242

4343
.. code-block:: console
4444
45-
poetry install
45+
poetry install
4646
4747
Then enter the virtual environment created by Poetry:
4848

4949
.. code-block:: console
5050
51-
poetry shell
51+
poetry shell
5252
5353
Static checks
5454
^^^^^^^^^^^^^
@@ -59,18 +59,18 @@ To turn on pre-commit checks for commit operations in git, enter:
5959

6060
.. code-block:: console
6161
62-
pre-commit install
62+
pre-commit install
6363
6464
To run all checks on your staged files, enter:
6565

6666
.. code-block:: console
6767
68-
pre-commit run
68+
pre-commit run
6969
7070
To run all checks on all files, enter:
7171

7272
.. code-block:: console
7373
74-
pre-commit run --all-files
74+
pre-commit run --all-files
7575
7676
Pre-commit check results are also attached to your PR through integration with Github Action.

docs/customizations.rst

+20-20
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ If you know you have a valid specification already, disabling the validator can
1111
.. code-block:: python
1212
:emphasize-lines: 5
1313
14-
from openapi_core import Spec
14+
from openapi_core import Spec
1515
16-
spec = Spec.from_dict(
16+
spec = Spec.from_dict(
1717
spec_dict,
1818
validator=None,
19-
)
19+
)
2020
2121
Media type deserializers
2222
------------------------
@@ -28,20 +28,20 @@ You can also define your own ones. Pass custom defined media type deserializers
2828
.. code-block:: python
2929
:emphasize-lines: 13
3030
31-
def protobuf_deserializer(message):
31+
def protobuf_deserializer(message):
3232
feature = route_guide_pb2.Feature()
3333
feature.ParseFromString(message)
3434
return feature
3535
36-
extra_media_type_deserializers = {
36+
extra_media_type_deserializers = {
3737
'application/protobuf': protobuf_deserializer,
38-
}
38+
}
3939
40-
result = unmarshal_response(
40+
result = unmarshal_response(
4141
request, response,
4242
spec=spec,
4343
extra_media_type_deserializers=extra_media_type_deserializers,
44-
)
44+
)
4545
4646
Format validators
4747
-----------------
@@ -55,20 +55,20 @@ Here's how you could add support for a ``usdate`` format that handles dates of t
5555
.. code-block:: python
5656
:emphasize-lines: 13
5757
58-
import re
58+
import re
5959
60-
def validate_usdate(value):
60+
def validate_usdate(value):
6161
return bool(re.match(r"^\d{1,2}/\d{1,2}/\d{4}$", value))
6262
63-
extra_format_validators = {
63+
extra_format_validators = {
6464
'usdate': validate_usdate,
65-
}
65+
}
6666
67-
validate_response(
67+
validate_response(
6868
request, response,
6969
spec=spec,
7070
extra_format_validators=extra_format_validators,
71-
)
71+
)
7272
7373
Format unmarshallers
7474
--------------------
@@ -82,17 +82,17 @@ Here's an example with the ``usdate`` format that converts a value to date objec
8282
.. code-block:: python
8383
:emphasize-lines: 13
8484
85-
from datetime import datetime
85+
from datetime import datetime
8686
87-
def unmarshal_usdate(value):
87+
def unmarshal_usdate(value):
8888
return datetime.strptime(value, "%m/%d/%y").date
8989
90-
extra_format_unmarshallers = {
90+
extra_format_unmarshallers = {
9191
'usdate': unmarshal_usdate,
92-
}
92+
}
9393
94-
result = unmarshal_response(
94+
result = unmarshal_response(
9595
request, response,
9696
spec=spec,
9797
extra_format_unmarshallers=extra_format_unmarshallers,
98-
)
98+
)

docs/extensions.rst

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ By default, objects are unmarshalled to dictionaries. You can use dynamically cr
99
.. code-block:: yaml
1010
:emphasize-lines: 5
1111
12-
...
13-
components:
12+
...
13+
components:
1414
schemas:
1515
Coordinates:
1616
x-model: Coordinates
@@ -35,8 +35,8 @@ You can use your own dataclasses, pydantic models or models generated by third p
3535
.. code-block:: yaml
3636
:emphasize-lines: 5
3737
38-
...
39-
components:
38+
...
39+
components:
4040
schemas:
4141
Coordinates:
4242
x-model-path: foo.bar.Coordinates
@@ -52,11 +52,11 @@ You can use your own dataclasses, pydantic models or models generated by third p
5252
5353
.. code-block:: python
5454
55-
# foo/bar.py
56-
from dataclasses import dataclass
55+
# foo/bar.py
56+
from dataclasses import dataclass
5757
58-
@dataclass
59-
class Coordinates:
58+
@dataclass
59+
class Coordinates:
6060
lat: float
6161
lon: float
6262

docs/index.rst

+27-27
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ openapi-core
22
============
33

44
.. toctree::
5-
:hidden:
6-
:maxdepth: 2
5+
:hidden:
6+
:maxdepth: 2
77

8-
unmarshalling
9-
validation
10-
integrations
11-
customizations
12-
security
13-
extensions
14-
contributing
8+
unmarshalling
9+
validation
10+
integrations
11+
customizations
12+
security
13+
extensions
14+
contributing
1515

1616
Openapi-core is a Python library that adds client-side and server-side support
1717
for the `OpenAPI v3.0 <https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md>`__
@@ -30,13 +30,13 @@ Installation
3030

3131
.. md-tab-set::
3232

33-
.. md-tab-item:: Pip + PyPI (recommented)
33+
.. md-tab-item:: Pip + PyPI (recommented)
3434

3535
.. code-block:: console
3636
3737
pip install openapi-core
3838
39-
.. md-tab-item:: Pip + the source
39+
.. md-tab-item:: Pip + the source
4040

4141
.. code-block:: console
4242
@@ -49,32 +49,32 @@ Firstly create your specification object.
4949

5050
.. code-block:: python
5151
52-
from openapi_core import Spec
52+
from openapi_core import Spec
5353
54-
spec = Spec.from_file_path('openapi.json')
54+
spec = Spec.from_file_path('openapi.json')
5555
5656
Now you can use it to validate and unmarshal your requests and/or responses.
5757

5858
.. code-block:: python
5959
60-
from openapi_core import unmarshal_request
60+
from openapi_core import unmarshal_request
6161
62-
# raises error if request is invalid
63-
result = unmarshal_request(request, spec=spec)
62+
# raises error if request is invalid
63+
result = unmarshal_request(request, spec=spec)
6464
6565
Retrieve validated and unmarshalled request data
6666

6767
.. code-block:: python
6868
69-
# get parameters
70-
path_params = result.parameters.path
71-
query_params = result.parameters.query
72-
cookies_params = result.parameters.cookies
73-
headers_params = result.parameters.headers
74-
# get body
75-
body = result.body
76-
# get security data
77-
security = result.security
69+
# get parameters
70+
path_params = result.parameters.path
71+
query_params = result.parameters.query
72+
cookies_params = result.parameters.cookies
73+
headers_params = result.parameters.headers
74+
# get body
75+
body = result.body
76+
# get security data
77+
security = result.security
7878
7979
Request object should implement OpenAPI Request protocol. Check :doc:`integrations` to find oficially supported implementations.
8080

@@ -86,9 +86,9 @@ Related projects
8686
----------------
8787

8888
* `openapi-spec-validator <https://github.com/python-openapi/openapi-spec-validator>`__
89-
Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0 and OpenAPI 3.1 specification. The validator aims to check for full compliance with the Specification.
89+
Python library that validates OpenAPI Specs against the OpenAPI 2.0 (aka Swagger), OpenAPI 3.0 and OpenAPI 3.1 specification. The validator aims to check for full compliance with the Specification.
9090
* `openapi-schema-validator <https://github.com/python-openapi/openapi-schema-validator>`__
91-
Python library that validates schema against the OpenAPI Schema Specification v3.0 and OpenAPI Schema Specification v3.1.
91+
Python library that validates schema against the OpenAPI Schema Specification v3.0 and OpenAPI Schema Specification v3.1.
9292

9393
License
9494
-------

0 commit comments

Comments
 (0)