Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change 'Schema' to 'Field' in docs #746

Merged
merged 3 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/tutorial/body-schema.md → docs/tutorial/body-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The same way you can declare additional validation and metadata in path operatio
First, you have to import it:

```Python hl_lines="2"
{!./src/body_schema/tutorial001.py!}
{!./src/body_fields/tutorial001.py!}
```

!!! warning
Expand All @@ -17,7 +17,7 @@ First, you have to import it:
You can then use `Field` with model attributes:

```Python hl_lines="9 10"
{!./src/body_schema/tutorial001.py!}
{!./src/body_fields/tutorial001.py!}
```

`Field` works the same way as `Query`, `Path` and `Body`, it has all the same parameters, etc.
Expand All @@ -34,7 +34,7 @@ You can then use `Field` with model attributes:
!!! tip
Notice how each model's attribute with a type, default value and `Field` has the same structure as a path operation function's parameter, with `Field` instead of `Path`, `Query` and `Body`.

## Schema extras
## JSON Schema extras

In `Field`, `Path`, `Query`, `Body` and others you'll see later, you can declare extra parameters apart from those described before.

Expand All @@ -48,12 +48,12 @@ If you know JSON Schema and want to add extra information apart from what we hav
For example, you can use that functionality to pass a <a href="http://json-schema.org/latest/json-schema-validation.html#rfc.section.8.5" target="_blank">JSON Schema example</a> field to a body request JSON Schema:

```Python hl_lines="20 21 22 23 24 25"
{!./src/body_schema/tutorial002.py!}
{!./src/body_fields/tutorial002.py!}
```

And it would look in the `/docs` like this:

<img src="/img/tutorial/body-schema/image01.png">
<img src="/img/tutorial/body-fields/image01.png">

## Recap

Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ nav:
- Query Parameters and String Validations: 'tutorial/query-params-str-validations.md'
- Path Parameters and Numeric Validations: 'tutorial/path-params-numeric-validations.md'
- Body - Multiple Parameters: 'tutorial/body-multiple-params.md'
- Body - Schema: 'tutorial/body-schema.md'
- Body - Fields: 'tutorial/body-fields.md'
- Body - Nested Models: 'tutorial/body-nested-models.md'
- Extra data types: 'tutorial/extra-data-types.md'
- Cookie Parameters: 'tutorial/cookie-params.md'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from starlette.testclient import TestClient

from body_schema.tutorial001 import app
from body_fields.tutorial001 import app

# TODO: remove when removing support for Pydantic < 1.0.0
try:
Expand Down