diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-29 10:03:13 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-29 10:03:13 +0000 |
| commit | ceb3ada7b46104e5a6c76b2736e996935b2f311f (patch) | |
| tree | 5eb248518a0206575a2996187017a45f1849c624 | |
| parent | 4d0691a8c54404e8a3482d53c755962d5922cd5b (diff) | |
automatic import of python-ts-ids-es-json-generator
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-ts-ids-es-json-generator.spec | 221 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 223 insertions, 0 deletions
@@ -0,0 +1 @@ +/ts-ids-es-json-generator-1.0.1.tar.gz diff --git a/python-ts-ids-es-json-generator.spec b/python-ts-ids-es-json-generator.spec new file mode 100644 index 0000000..b72b743 --- /dev/null +++ b/python-ts-ids-es-json-generator.spec @@ -0,0 +1,221 @@ +%global _empty_manifest_terminate_build 0 +Name: python-ts-ids-es-json-generator +Version: 1.0.1 +Release: 1 +Summary: Python utility for generating elasticsearch.json from schema.json for an IDS +License: Apache License 2.0 +URL: https://github.com/tetrascience/ts-ids-es-json-generator +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/d5/1c/c0b68d36010671a96d922040634515e4acdc5da8cb939f1658dea7a1fc6c/ts-ids-es-json-generator-1.0.1.tar.gz +BuildArch: noarch + +Requires: python3-jsonref +Requires: python3-pydash + +%description +# ts-ids-es-json-generator + +## Introduction + +This simple utility generates `elasticsearch.json` using `schema.json`. + +## How to Use + +To run the generator, simply provide the program with the location of the IDS root directory: + +``` +$ pipenv run python -m ids_es_json_generator ~/path/to/ids/folder +``` + +`elasticsearch.json` may be manually edited after automatic generation (e.g. to update non-searchable fields). + +## Output + +The script saves `elasticsearch.json` to the same directory you provided. + +## Assumptions + +The generator operates under the following assumptions: + +- It's the IDS designer's responsibility to make sure the schema and `elasticsearch.json` are correct. + The generator will not validate the IDS for you. + +## Restrictions + +- JSON pointers are dereferenced to create the mapping, so schemas with circular references or missing references will fail. + +## Tests + +Run the tests using the following command: + +`$ pipenv run python -m pytest` + +## How it works + +Anywhere an array of objects appears in the schema, a `nested` field type will be created in the output `elasticsearch.json`, including arrays of objects contained anywhere within other arrays of objects. +The steps are: + +1. The schema is loaded into a dict with all of its JSON pointers dereferenced using `jsonref`, so that nested fields involving `definitions` are included in the elasticsearch mapping. +2. `find_array_object` will find all arrays of objects and create a dict representing their locations in the schema (see test case `test_array_simple_nested_case` in `__tests__/unit/test_find_array_object.py`). +3. `generate_es_mapping` uses this dict to create the elasticsearch mapping (see test case `test_nested_keys_case` in `__tests__/unit/test_generate_es_mapping.py`). + +See the example files and test cases for more example usage. + + + + +%package -n python3-ts-ids-es-json-generator +Summary: Python utility for generating elasticsearch.json from schema.json for an IDS +Provides: python-ts-ids-es-json-generator +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-ts-ids-es-json-generator +# ts-ids-es-json-generator + +## Introduction + +This simple utility generates `elasticsearch.json` using `schema.json`. + +## How to Use + +To run the generator, simply provide the program with the location of the IDS root directory: + +``` +$ pipenv run python -m ids_es_json_generator ~/path/to/ids/folder +``` + +`elasticsearch.json` may be manually edited after automatic generation (e.g. to update non-searchable fields). + +## Output + +The script saves `elasticsearch.json` to the same directory you provided. + +## Assumptions + +The generator operates under the following assumptions: + +- It's the IDS designer's responsibility to make sure the schema and `elasticsearch.json` are correct. + The generator will not validate the IDS for you. + +## Restrictions + +- JSON pointers are dereferenced to create the mapping, so schemas with circular references or missing references will fail. + +## Tests + +Run the tests using the following command: + +`$ pipenv run python -m pytest` + +## How it works + +Anywhere an array of objects appears in the schema, a `nested` field type will be created in the output `elasticsearch.json`, including arrays of objects contained anywhere within other arrays of objects. +The steps are: + +1. The schema is loaded into a dict with all of its JSON pointers dereferenced using `jsonref`, so that nested fields involving `definitions` are included in the elasticsearch mapping. +2. `find_array_object` will find all arrays of objects and create a dict representing their locations in the schema (see test case `test_array_simple_nested_case` in `__tests__/unit/test_find_array_object.py`). +3. `generate_es_mapping` uses this dict to create the elasticsearch mapping (see test case `test_nested_keys_case` in `__tests__/unit/test_generate_es_mapping.py`). + +See the example files and test cases for more example usage. + + + + +%package help +Summary: Development documents and examples for ts-ids-es-json-generator +Provides: python3-ts-ids-es-json-generator-doc +%description help +# ts-ids-es-json-generator + +## Introduction + +This simple utility generates `elasticsearch.json` using `schema.json`. + +## How to Use + +To run the generator, simply provide the program with the location of the IDS root directory: + +``` +$ pipenv run python -m ids_es_json_generator ~/path/to/ids/folder +``` + +`elasticsearch.json` may be manually edited after automatic generation (e.g. to update non-searchable fields). + +## Output + +The script saves `elasticsearch.json` to the same directory you provided. + +## Assumptions + +The generator operates under the following assumptions: + +- It's the IDS designer's responsibility to make sure the schema and `elasticsearch.json` are correct. + The generator will not validate the IDS for you. + +## Restrictions + +- JSON pointers are dereferenced to create the mapping, so schemas with circular references or missing references will fail. + +## Tests + +Run the tests using the following command: + +`$ pipenv run python -m pytest` + +## How it works + +Anywhere an array of objects appears in the schema, a `nested` field type will be created in the output `elasticsearch.json`, including arrays of objects contained anywhere within other arrays of objects. +The steps are: + +1. The schema is loaded into a dict with all of its JSON pointers dereferenced using `jsonref`, so that nested fields involving `definitions` are included in the elasticsearch mapping. +2. `find_array_object` will find all arrays of objects and create a dict representing their locations in the schema (see test case `test_array_simple_nested_case` in `__tests__/unit/test_find_array_object.py`). +3. `generate_es_mapping` uses this dict to create the elasticsearch mapping (see test case `test_nested_keys_case` in `__tests__/unit/test_generate_es_mapping.py`). + +See the example files and test cases for more example usage. + + + + +%prep +%autosetup -n ts-ids-es-json-generator-1.0.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-ts-ids-es-json-generator -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.1-1 +- Package Spec generated @@ -0,0 +1 @@ +f5fe17edda741fbff3864902b32cc05e ts-ids-es-json-generator-1.0.1.tar.gz |
