Model builder plugin for oarepo-polymorphic
Project description
Polymorphic model builder plugin
An OARepo Model Builder plugin to generate invenio sources for polymorphic models.
Installation
pip install oarepo-model-builder-polymorphic
Usage
What is polymorphic model?
A polymorphic model is a dict that can be defined by multiple schemas. Which schema is used depends on a value of a present field (that is shared across all the schemas).
Polymorphic model can be used, for example, to express inheritance:
extension1{}:
disc: { type: keyword }
a: { type: keyword }
extension2{}:
disc: { type: keyword }
b: { type: keyword }
record:
properties:
a:
type: polymorphic
discriminator: disc
schemas:
"1": { use: "/extension1" }
"2": { use: "/extension2" }
The following are valid instances:
a:
disc: "1"
a: "blah"
---
a:
disc: "2"
b: "blah"
Invalid instance:
a:
disc: "3"
b: "blah"
---
a:
disc: "1"
a: "blah"
b: "blah"
If the "disc" field contains value "1", first extension schema will be used, if it contains value "2", second schema will be used. Any other value is not valid.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oarepo-model-builder-polymorphic-1.0.2.tar.gz.
File metadata
- Download URL: oarepo-model-builder-polymorphic-1.0.2.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7340fa1598ad8bb56b629be133688c21e1aa8113503933e930697425bcd7442e
|
|
| MD5 |
d549eb3ddf9cd4df049a5e29f9dd954d
|
|
| BLAKE2b-256 |
cfb718d8ff159718f670afdebd91d27d345aee45e648eeb4c1c45c393e0bdec6
|
File details
Details for the file oarepo_model_builder_polymorphic-1.0.2-py3-none-any.whl.
File metadata
- Download URL: oarepo_model_builder_polymorphic-1.0.2-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a80b5fe7710a697eb41e3c516b1ac733f042b2a7d1208ccf7304ef3490f33563
|
|
| MD5 |
4f377dc17239673ad236f3bf0b27eebd
|
|
| BLAKE2b-256 |
e675847b7b35daeb71a450404419413843ef03d30ec41800e6f2c71227e14a05
|