cli: addition of mapping_type parameter#10
Merged
jirikuncar merged 1 commit intoinveniosoftware:masterfrom Mar 11, 2016
Merged
Conversation
domapping/cli.py
Outdated
|
|
||
| mapping = schema_to_mapping(parsed_schema, id, {}, config_instance) | ||
| if final: | ||
| mapping_name = os.path.splitext(os.path.basename(schema.name))[0] |
Member
There was a problem hiding this comment.
the file name is not reliable. If the schema is coming from stdin there is no schema.name. This name should be given as an argument to the option.
b8f4b2e to
3a4bc71
Compare
final parameter to schema_to_mappinges_type parameter to schema_to_mapping
5aa913a to
8919459
Compare
domapping/cli.py
Outdated
| if 'mappings' in parsed_mapping: | ||
| result = [] | ||
| for item in parsed_mapping: | ||
| template = mapping_to_jinja(parsed_mapping, item, indent=indent) |
Member
There was a problem hiding this comment.
I think it would be better if by default the type name was the one already in the mappings dict.
What do you think of this workflow?:
- 1/ The input file is a doctype mapping (no root
mappings) =>--typeoption is used and is by default equal to"type" - 2/ The input file is a
mappingsfile- 2.1/ The input file contains only one doctype mapping => the name of the doctype in the input file is used if the option
--typeis not set, otherwise the option overrides the type name. - 2.2/ The input file contains multiple doctypes => the name used is the one provided in the input file. The command fails if the option
--typeis set
- 2.1/ The input file contains only one doctype mapping => the name of the doctype in the input file is used if the option
27a829c to
8cbb734
Compare
Contributor
Author
|
@nharraud Updated. Please, could you take a look when you have a minute? |
tests/test_cli.py
Outdated
| assert gen_output == expected | ||
|
|
||
|
|
||
| def test_mapping_to_jinja_iconsistencies(): |
Member
There was a problem hiding this comment.
s/test_mapping_to_jinja_iconsistencies/test_mapping_to_jinja_inconsistencies/g
8cbb734 to
33ca65b
Compare
Contributor
Author
|
@nharraud Could you take a look please? |
domapping/cli.py
Outdated
| @click.option('--indent', '-i', default=4, type=click.INT, | ||
| help='Output json indentation step.') | ||
| def schema_to_mapping_cli(schema, output, config, indent): | ||
| @click.option('--es_type', '-t', |
2620e01 to
3aedf55
Compare
Contributor
Author
|
This PR is ready from my side. Could someone take a look? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mapping_type) that allows you to generatemappings to use directly with
invenio_search.mappingsentry point.(closes Incorrect property name ('settings' instead of 'mappings') #9)
Signed-off-by: Javier Delgado javier.delgado.fernandez@cern.ch