%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.aliyun.com/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 * Thu Jun 08 2023 Python_Bot - 1.0.1-1 - Package Spec generated