Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shirokovnv/py-seed
Seed generator, written in python with FastAPI.
https://github.com/shirokovnv/py-seed
fastapi json python seeder
Last synced: 1 day ago
JSON representation
Seed generator, written in python with FastAPI.
- Host: GitHub
- URL: https://github.com/shirokovnv/py-seed
- Owner: shirokovnv
- License: mit
- Created: 2022-09-18T21:04:58.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-27T16:52:07.000Z (about 1 year ago)
- Last Synced: 2023-09-28T04:03:00.908Z (about 1 year ago)
- Topics: fastapi, json, python, seeder
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# py-seed
![ci.yml][link-ci]
Minimalistic data seeder, written in python.
The service generates a list of dummy data from [JSON schema](https://json-schema.org/) provided in single API method.
Python version: `3.10`
## Dependencies
- [Docker][link-docker]
- [Make][link-make]
- [FastAPI][link-fastapi]
- [JSON Schema Faker][link-faker]## Project setup
**From the project root, inside shell, run:**
- `make pull` to pull latest images
- `make install` to install fresh dependencies
- `make up` to run app containersNow you can visit [`localhost:8000`](http://localhost:8000) from your browser.
- `make down` - to extinguish running containers
- `make help` - for additional commands## Usage
**Make a post request to** [localhost:8000/seeds](http://localhost:8000/seeds)
_Options_:
- `format`: Wether response data returned in `json` or `xml` (defaults to `json`)
- `count`: The number of seeds (min: 1, max: 100)
- `schema`: your JSON schema### Request
```bash
curl --location --request POST 'http://localhost:8000/seeds' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"count": 1,
"format": "json",
"schema": {
"title": "products",
"type": "object",
"properties": {
"productId": {
"type": "integer"
},
"title": {
"type": "string"
}
},
"required": [ "productId", "title" ]
}}'
```### Response
```json
{
"products": [
{
"productId": 9963,
"title": "molestias, Hic"
}
]
}
```## License
MIT. Please see the [license file](LICENSE.md) for more information.
[link-ci]: https://github.com/shirokovnv/py-seed/actions/workflows/ci.yml/badge.svg
[link-docker]: https://www.docker.com/
[link-make]: https://www.gnu.org/software/make/manual/make.html
[link-faker]: https://github.com/json-schema-faker/json-schema-faker
[link-fastapi]: https://fastapi.tiangolo.com/