New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: initial implementation using Click #1
Conversation
|
||
es-jsonschema provides a library and a CLI generating Elasticsearch mappings from json-schemas. | ||
|
||
- CERN <info@invenio-software.org> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update the author list
a67dc6c
to
74f1814
Compare
Good catch |
7fb354e
to
5377e9f
Compare
@jirikuncar PR ready for review. Only invalid use cases remain untested. I can fix that in another PR. |
resolver, config, | ||
es_properties.get(prop)) | ||
for prop, prop_schema in iteritems(json_schema['properties']): | ||
es_properties[prop] = \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's preferable to break line after (
instead of introducing \
.
@@ -40,10 +46,48 @@ def __init__(self, *args, **kwargs): | |||
} | |||
# json string formats -> elasticsearch type | |||
self.__formats_map = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
be careful with using double underscore for properties (https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references) - they make it hard for subclassing ...
@jirikuncar Fixed and added an example |
def test_schema_to_mapping(): | ||
"""Test schema_to_mapping.""" | ||
json_schema = { | ||
'id': 'http://some.site/root_schema#', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://example.org/
@jirikuncar squashed in one commit as requested. |
@nharraud please run |
* Fixes some issues. * Refactors es_jsonschema so that it can be used with a CLI. * Adds examples. Signed-off-by: Nicolas Harraudeau <nicolas.harraudeau@cern.ch>
@jirikuncar fixed and travis finished at last. |
Coverage is ok but not perfect (97%).