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.
Metadata
Release files for oarepo-model-builder-polymorphic 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| oarepo-model-builder-polymorphic-1.0.2.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| oarepo_model_builder_polymorphic-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.8 kB
Release files / oarepo-model-builder-polymorphic-1.0.2.tar.gz
| Download URL | oarepo-model-builder-polymorphic-1.0.2.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7340fa1598ad8bb56b629be133688c21e1aa8113503933e930697425bcd7442e
|
|
BLAKE2b-256 checksum How to use checksums |
cfb718d8ff159718f670afdebd91d27d345aee45e648eeb4c1c45c393e0bdec6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / oarepo_model_builder_polymorphic-1.0.2-py3-none-any.whl
| Download URL | oarepo_model_builder_polymorphic-1.0.2-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a80b5fe7710a697eb41e3c516b1ac733f042b2a7d1208ccf7304ef3490f33563
|
|
BLAKE2b-256 checksum How to use checksums |
e675847b7b35daeb71a450404419413843ef03d30ec41800e6f2c71227e14a05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|