Skip to content

Commit

Permalink
README update
Browse files Browse the repository at this point in the history
  • Loading branch information
raindrift committed Apr 3, 2024
1 parent f304fec commit 771fa9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions examples/models/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

You can use these models in your Python code, both to generate valid data, and to parse incoming data.

Using the models ensures that your data has been at least somewhat validated. If the schema changes your code needs an update, you're more likely to be able to tell right away.
Using the models ensures that your data has been at least somewhat validated. If the schema changes and your code needs an update, you're more likely to be able to tell right away.

## Parsing a request

Expand All @@ -23,6 +23,8 @@ def rank(ranking_request: RankingRequest) -> RankingResponse:

If you specify `RankingResponse` as your reeturn type, you will get validation of your response for free.

For a complete example, check out `../fastapi_nltk/`

### Otherwise

If you'd like to parse a request directly, here is how:
Expand All @@ -35,7 +37,7 @@ loaded_request = RankingRequest.model_validate_json(json_data)

## Generating fake data

There is a fake data generator in `fake.py`. If you run it, it will print some. You can also import it
There is a fake data generator in `fake.py`. If you run it directly it'll print some. You can also import it and run `fake_request()` or `fake_response()`. Take a look at the test for a usage example.

## More

Expand Down

0 comments on commit 771fa9d

Please sign in to comment.