Skip to content
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

Merged
merged 1 commit into from Dec 8, 2015

Conversation

nharraud
Copy link
Member

  • Refactors to match the last cookie cutter template, and to make all function names consistent.
  • Fixes some bugs.
  • Adds templating.jinja_to_mapping function.
  • Adds CLI.

Coverage is ok but not perfect (97%).


es-jsonschema provides a library and a CLI generating Elasticsearch mappings from json-schemas.

- CERN <info@invenio-software.org>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the author list

@nharraud nharraud force-pushed the add-cli branch 2 times, most recently from a67dc6c to 74f1814 Compare November 18, 2015 16:39
@nharraud
Copy link
Member Author

Good catch
I also replaced other json.dumps with json.dump and json.loads with json.load when possible.

@nharraud nharraud force-pushed the add-cli branch 4 times, most recently from 7fb354e to 5377e9f Compare November 19, 2015 14:27
@nharraud nharraud changed the title WIP Add cli Add cli Nov 20, 2015
@nharraud
Copy link
Member Author

@jirikuncar PR ready for review. Only invalid use cases remain untested. I can fix that in another PR.

@jirikuncar jirikuncar added this to the v0.1.0 milestone Nov 23, 2015
resolver, config,
es_properties.get(prop))
for prop, prop_schema in iteritems(json_schema['properties']):
es_properties[prop] = \
Copy link
Member

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 \.

@jirikuncar jirikuncar assigned nharraud and unassigned jirikuncar Nov 23, 2015
@jirikuncar jirikuncar changed the title Add cli cli: initial implementation using Click Nov 26, 2015
@@ -40,10 +46,48 @@ def __init__(self, *args, **kwargs):
}
# json string formats -> elasticsearch type
self.__formats_map = {}
Copy link
Member

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 ...

@nharraud
Copy link
Member Author

@jirikuncar Fixed and added an example

def test_schema_to_mapping():
"""Test schema_to_mapping."""
json_schema = {
'id': 'http://some.site/root_schema#',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://example.org/

@nharraud
Copy link
Member Author

nharraud commented Dec 7, 2015

@jirikuncar squashed in one commit as requested.

@jirikuncar
Copy link
Member

@nharraud please run kwalitee check message

* 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>
@nharraud
Copy link
Member Author

nharraud commented Dec 8, 2015

@jirikuncar fixed and travis finished at last.

@jirikuncar jirikuncar merged commit 4d5f9b7 into inveniosoftware:master Dec 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants