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

Refactor the field_categories #44

Merged
merged 3 commits into from
Dec 1, 2016

Conversation

rikirenz
Copy link
Contributor

This change is:

  • removing the field: field_categories
  • adding 2 field: external_field_categories and inspire_field_categories

In order to maintain different lists for the categories of INSPIRE and the categories that we receive from external sites, during the articles collection

@rikirenz rikirenz force-pushed the move-category-field branch 7 times, most recently from 3611e03 to 519b13d Compare November 28, 2016 14:44
@rikirenz rikirenz changed the title WIP Refactor the field_categories Refactor the field_categories Nov 28, 2016
@rikirenz rikirenz force-pushed the move-category-field branch 4 times, most recently from 0d43f68 to 485cb31 Compare November 28, 2016 17:28
@rikirenz
Copy link
Contributor Author

Ready for review! @david-caro



function resolve_schema(unresolved_schema, base_path, definitions) {
definitions = set_definitions(unresolved_schema['definitions'], definitions);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use select/pick instead of set for the name of the method, as usually the methods that have 'set' on the name are expected to modify on of the parameters or some global, setting a property on them.

delete(resolved_element_schema['$schema'])
return resolved_element_schema
} else if (key === '$ref' && typeof(unresolved_schema[key]) === 'string' && unresolved_schema[key][0] === '#') {
return definitions
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this return resolve_schema(extract_definition(definitions, defs_path), schema_path, definitions)? Where the defs_path is the path part of the '#key1/key2' and the extract_definiton just extracts the value for the key it references?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it possible to have a $ref statement in the definitions obj?

Copy link
Contributor

@david-caro david-caro left a comment

Choose a reason for hiding this comment

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

Not critical at all though



function resolve_schema(unresolved_schema, base_path, definitions) {
definitions = pick_definitions(unresolved_schema['definitions'], definitions);
Copy link
Contributor

Choose a reason for hiding this comment

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

definitions = unresolved_schema['definitions'] || definitions



function extract_definition(definitions_object, defs_path) {
keys_array = defs_path.split('/');
Copy link
Contributor

Choose a reason for hiding this comment

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

var keys_array...

@rikirenz rikirenz force-pushed the move-category-field branch 3 times, most recently from fd433e9 to f59e85c Compare November 29, 2016 12:50
@rikirenz
Copy link
Contributor Author

I think you can merge!

@david-caro
Copy link
Contributor

you should rebase on latest master too, to get rid of that extra commit that's shown.

@rikirenz rikirenz force-pushed the move-category-field branch 5 times, most recently from d37d14f to 2283686 Compare December 1, 2016 13:44
@rikirenz
Copy link
Contributor Author

rikirenz commented Dec 1, 2016

@david-caro rebased and tests have passed.

* INCOMPATIBLE split field_categories in 2 new fields.
* Remove field_categories field.
* Add inspire_field_categories.
* Add external_field_categories.
@david-caro david-caro merged commit 041fa93 into inspirehep:master Dec 1, 2016
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