https://github.com/luiscoms/eve-embedded
https://github.com/luiscoms/eve-embedded
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/luiscoms/eve-embedded
- Owner: luiscoms
- License: mit
- Created: 2016-12-19T20:38:14.000Z (about 9 years ago)
- Default Branch: develop
- Last Pushed: 2017-09-09T23:24:15.000Z (over 8 years ago)
- Last Synced: 2025-02-02T08:44:46.102Z (12 months ago)
- Language: Python
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Eve-Embedded
===========
[](https://travis-ci.org/luiscoms/eve-embedded)
[](https://requires.io/github/luiscoms/eve-embedded/requirements/?branch=master)
[](https://coveralls.io/github/luiscoms/eve-embedded?branch=master)
This project servers as an example of a Python package with some boilerplate
code already in place.
Usage
----
In the schema set the url
```python
schema = {
"firstname": {
"type": "string",
"minlength": 1,
"maxlength": 10,
},
"country": {
"type": "string",
"schema": {
"type": "string",
"data_relation": {
"api": "http://api.example.com/country",
"embeddable": True
}
}
}
}
```
Then install the module
```python
from eve_embedded import embedded
app = Eve()
embedded.install(app)
```
Special field types
----
When you are using specia field types, you can pass it as argumen like:
```python
skill_schema = {
"title": {
"type": "string",
},
"level": {
"type": "string",
"schema": {
"type": "string",
"data_relation": {
"api": "http://api.example.com/levels",
"embeddable": True
}
}
}
}
skill_type_schema = {
"type": "skill",
"schema": skill_schema
}
schema = {
"firstname": {
"type": "string",
"minlength": 1,
"maxlength": 10,
},
"country": {
"type": "string",
"schema": {
"type": "string",
"data_relation": {
"api": "http://api.example.com/country",
"embeddable": True
}
}
},
"skills": {
"type": "list",
"schema": {
"type": "skill",
}
}
}
app = Eve()
embedded.install(app, dict(area=skill_type_schema))
```
Running tests with `tox`
----
You will need an instance of `mongo` running locally
Install `tox`
```
$ pip install tox
```
Run tests
```
tox
```