Skip to content

Commit b5762e9

Browse files
authored
Version 2.0 (#29)
* Removed handle_{get, patch, delete, get_all, post} in favour of handle_request * Specify starlette 0.14.2 requirement in setup.py * Renamed get_all to get_many * Various documentation improvements * Catch errors from before and after request hooks * Implemented _BaseResourceHandler and moved common functionality * Always include the JSONAPIException detail * Include relationships in schema by default * Relaxed implementation for pagination query params * Fixed sparse fields logic for including unspecified types * Make base_path optional for BaseResource.register_routes * Return 400 if include requests are not supported * Renamed prepare_relations to include_relations
1 parent b0bea43 commit b5762e9

39 files changed

Lines changed: 1482 additions & 638 deletions

.github/workflows/test_suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
python-version: ["3.6", "3.7", "3.8"]
15+
python-version: ["3.6", "3.7", "3.8", "3.9"]
1616

1717
steps:
1818
- uses: "actions/checkout@v2"

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ any available async ORM. This also means that you are going to get a very basic
1111
with some helpers to make your experience more pleasant, but nothing fancy.
1212

1313
##### Installing
14-
`pip install starlette-jsonapi==1.2.0`
14+
`pip install starlette-jsonapi`
1515

1616
Since this project is under development, please pin your dependencies to avoid problems.
1717

@@ -25,9 +25,9 @@ Since this project is under development, please pin your dependencies to avoid p
2525
- sparse fields
2626
- support for client generated IDs
2727
- support top level meta objects
28+
- [pagination helpers](https://jsonapi.org/format/#fetching-pagination)
2829

2930
### Todo:
30-
- [pagination helpers](https://jsonapi.org/format/#fetching-pagination)
3131
- [sorting helpers](https://jsonapi.org/format/#fetching-sorting)
3232
- examples for other ORMs
3333
- [support jsonapi objects](https://jsonapi.org/format/#document-jsonapi-object)
@@ -39,6 +39,18 @@ Available on [Read The Docs](https://starlette-jsonapi.readthedocs.io/)
3939

4040
You should take a look at the [examples](examples) directory for full implementations.
4141

42+
To generate documentation files locally, you should create a virtualenv,
43+
then activate it and install the requirements:
44+
```shell
45+
cd docs
46+
pip install -r requirements.txt
47+
```
48+
49+
With the docs virtualenv activated, you can then run `make html` to generate the HTML files.
50+
51+
The result will be written to `docs/build`, and you can open `docs/build/html/index.html` in your browser of choice
52+
to view the pages.
53+
4254
## Contributing
4355
This project is in its early days, so **any** help is appreciated.
4456

@@ -47,4 +59,4 @@ As simple as running ```tox```.
4759

4860
If you plan to use pyenv and want to run tox for multiple python versions,
4961
you can create multiple virtual environments and then make them available to tox by running
50-
something like: `pyenv shell starlette_jsonapi_venv36 starlette_jsonapi_venv37`.
62+
something like: `pyenv shell starlette_jsonapi_venv36 starlette_jsonapi_venv37 starlette_jsonapi_venv38 starlette_jsonapi_venv39`.

docs/source/_static/wide_theme.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.wy-nav-content {
2+
/*max-width: 75%;*/
3+
}

docs/source/api_reference/modules.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,11 @@ starlette_jsonapi
44
.. toctree::
55
:maxdepth: 4
66

7-
starlette_jsonapi
7+
starlette_jsonapi.exceptions
8+
starlette_jsonapi.fields
9+
starlette_jsonapi.meta
10+
starlette_jsonapi.pagination
11+
starlette_jsonapi.resource
12+
starlette_jsonapi.responses
13+
starlette_jsonapi.schema
14+
starlette_jsonapi.utils
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
starlette\_jsonapi.pagination module
2+
====================================
3+
4+
.. automodule:: starlette_jsonapi.pagination
5+
:members:
6+
:exclude-members: Pagination
7+
:undoc-members:
8+
:show-inheritance:
9+
:inherited-members:
10+
11+
12+
.. autoclass:: starlette_jsonapi.pagination.Pagination
13+
:members:
14+
:show-inheritance:

docs/source/api_reference/starlette_jsonapi.resource.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ starlette\_jsonapi.resource module
55
:members:
66
:undoc-members:
77
:show-inheritance:
8+
:inherited-members:

docs/source/api_reference/starlette_jsonapi.responses.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@ starlette\_jsonapi.responses module
33

44
.. automodule:: starlette_jsonapi.responses
55
:members:
6+
:exclude-members: JSONAPIResponse
67
:undoc-members:
78
:show-inheritance:
9+
10+
.. autoclass:: starlette_jsonapi.responses.JSONAPIResponse
11+
:members:
12+
:undoc-members:
13+
:exclude-members: render

docs/source/api_reference/starlette_jsonapi.rst

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/source/api_reference/starlette_jsonapi.schema.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ starlette\_jsonapi.schema module
44
.. automodule:: starlette_jsonapi.schema
55
:members:
66
:undoc-members:
7+
:exclude-members: BaseSchemaOpts
78
:show-inheritance:

docs/source/conf.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@
5858
# Add any paths that contain custom static files (such as style sheets) here,
5959
# relative to this directory. They are copied after the builtin static files,
6060
# so a file named "default.css" will overwrite the builtin "default.css".
61-
html_static_path = []
61+
html_static_path = ['_static']
6262

6363
autodoc_typehints = 'description'
64+
65+
autodoc_default_options = {
66+
'member-order': 'bysource',
67+
'special-members': '__init__',
68+
}
69+
70+
autodoc_inherit_docstrings = False
71+
72+
73+
def setup(app):
74+
app.add_css_file('wide_theme.css')

0 commit comments

Comments
 (0)