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

Adding 'new_record' field for all schemas #11

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@ target/

CHANGELOG
AUTHORS

node_modules
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ python:
- '3.5'

before_install:
- travis_retry pip install --upgrade pip setuptools py
- travis_retry pip install --upgrade pip setuptools py coveralls
- travis_retry pip install -r requirements-test.txt
- pip freeze

Expand Down
5 changes: 5 additions & 0 deletions inspire_schemas/records/authors.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@
"description": "Stores name in native form.",
"type": "array"
},
"new_record": {
"$ref": "elements/json_reference.json",
"description": "Master record that replaces this record",
"title": "New record"
Copy link
Contributor

Choose a reason for hiding this comment

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

For now these will stay, but I really don't like titles that repeat the field name, and descriptions which leave me more confused than before (what is a master record?).

Copy link
Contributor

Choose a reason for hiding this comment

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

I think @spirosdelviniotis copied from the original schema (hep) that already had this field, beside being this $ref the description and title fields will be overwritten by whatever referenced (a bit of a sad functionality of jsonschema).

Copy link
Contributor

Choose a reason for hiding this comment

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

beside being this $ref the description and title fields will be overwritten by whatever referenced (a bit of a sad functionality of jsonschema).

Uh, I didn't know that!

},
"other_names": {
"description": "Contains other variation of names. Usually a different form of writing the primary name.",
"items": {
Expand Down
5 changes: 5 additions & 0 deletions inspire_schemas/records/conferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
"type": "array",
"uniqueItems": true
},
"new_record": {
"$ref": "elements/json_reference.json",
"description": "Master record that replaces this record",
"title": "New record"
},
"nonpublic_note": {
"title": "Non public note",
"type": "string"
Expand Down
5 changes: 5 additions & 0 deletions inspire_schemas/records/experiments.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@
"title": "Hidden note",
"type": "string"
},
"new_record": {
"$ref": "elements/json_reference.json",
"description": "Master record that replaces this record",
"title": "New record"
},
"nonpublic_note": {
"description": "FIXME: difference from hidden_note!?",
"title": "Non public note",
Expand Down
5 changes: 5 additions & 0 deletions inspire_schemas/records/institutions.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@
"type": "array",
"uniqueItems": true
},
"new_record": {
"$ref": "elements/json_reference.json",
"description": "Master record that replaces this record",
"title": "New record"
},
"non_public_notes": {
"items": {
"title": "Non-Public note",
Expand Down
5 changes: 5 additions & 0 deletions inspire_schemas/records/jobs.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
"type": "array",
"uniqueItems": true
},
"new_record": {
"$ref": "elements/json_reference.json",
"description": "Master record that replaces this record",
"title": "New record"
},
"position": {
"title": "Job position",
"type": "string"
Expand Down
5 changes: 5 additions & 0 deletions inspire_schemas/records/journals.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
"type": "array",
"uniqueItems": true
},
"new_record": {
"$ref": "elements/json_reference.json",
"description": "Master record that replaces this record",
"title": "New record"
},
"nonpublic_note": {
"title": "Non public note",
"type": "string"
Expand Down
4 changes: 3 additions & 1 deletion scripts/generate_example_records.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env node
//requires the json-schema-faker npm package installed
var jsf = require('json-schema-faker')
var fs = require('fs',
Copy link
Contributor

Choose a reason for hiding this comment

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

missing )?

Copy link
Contributor

Choose a reason for hiding this comment

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

The fs and path were already loaded by node on my installation when running it, sorry if it did not worked for you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Argh! I wonder how that happened...

jsf = require('json-schema-faker'),
path = require('path');

jsf.format('ISO 639-1', function(gen, schema){ return gen.randexp('^1.*$');});
jsf.format('date', function(gen, schema){ return gen.randexp('^1.*$');});
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/fixtures/authors_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
"value": ")qk,t/ [((>?! oOEE=a8uIb\"u5V_J@/%qmn&YH,:1:stA@z}TNi/lrF{*X;YBt-e=J*AFmNsTF_(4[dtSFMpIWt1*:pA, UZ~oG)`hd5AYA.FW@M-Wq3+ag7a\\:J~4(3aIM7mbYg;5yOSyv,S?Az`ncWRH{cBAv`L%jEsmY"
},
"native_name": [],
"new_record": {
"$ref": "1M\"?!ouZ]W}^ 6ZBtT (OpV2~FoO1*YXan`6q+Zz{|E}b&Rty<P]6o0i)l[,YDwm4_9c}HnG.:l_H"
Copy link
Contributor

Choose a reason for hiding this comment

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

What!?

Copy link
Contributor

Choose a reason for hiding this comment

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

Something got currputed here...

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah no. I see that this is an example fixture... :)

},
"other_names": [
"ad non",
"sed cupidatat Duis ut",
Expand Down Expand Up @@ -176,4 +179,4 @@
"value": "1*jBK`<gem?+ j`1T|$;b<Q%;8?+"
}
]
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@david-caro, do we care about EOL here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually this would be solved by also transferring my little schema-linters tools: https://github.com/inspirehep/inspire-next/blob/master/scripts/prettify_json

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't really care, I see no reason to complain about it, but if you give me a reason to avoid it I'll follow, automating as @kaplun says would be the best though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. I asked because it looked like you took care of avoiding EOLs, so I wasn't sure if there was a reason for that. I don't care either, they can stay.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's what the js script generated 'as is' :)

5 changes: 4 additions & 1 deletion tests/integration/fixtures/conferences_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@
"value": "sunt ut nulla"
}
],
"new_record": {
"$ref": "1M\"?!ouZ]W}^ 6ZBtT (OpV2~FoO1*YXan`6q+Zz{|E}b&Rty<P]6o0i)l[,YDwm4_9c}HnG.:l_H"
},
"nonpublic_note": "voluptate culpa ipsum anim incididunt",
"note": [],
"opening_date": "1V_5^kBacxK2f+DgAPp*}jGfAQ1e+7dkR+n+cZk[JP#f&GO$[6,0Y\"C]h [R)dc31",
Expand Down Expand Up @@ -188,4 +191,4 @@
"value": "1)qfrCEry,z;*XdT.&P+`tE8G`#Wq6kE&T\"p4\"yxd4:q;<E:{H^x:dXh[_y{2W-E!jRx2*Kxpcu67Gf)oN]&Fls|6t|3e\"YV6(}Md"
}
]
}
}
5 changes: 4 additions & 1 deletion tests/integration/fixtures/experiments_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
"cillum culpa ut ut nulla"
],
"hidden_note": "dolor ut cillum",
"new_record": {
"$ref": "1M\"?!ouZ]W}^ 6ZBtT (OpV2~FoO1*YXan`6q+Zz{|E}b&Rty<P]6o0i)l[,YDwm4_9c}HnG.:l_H"
},
"nonpublic_note": "dolor labore voluptate",
"other_experiment_names": [
{
Expand Down Expand Up @@ -227,4 +230,4 @@
"value": "18\"vH8lmG]h9iblVl&1/Z%`.%#R\\7IAQKy~ _JJDCM'O5V9kF%AprGIE9J`]d<&,jiw'Zqd"
}
]
}
}
5 changes: 4 additions & 1 deletion tests/integration/fixtures/institutions_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
]
}
],
"new_record": {
"$ref": "1M\"?!ouZ]W}^ 6ZBtT (OpV2~FoO1*YXan`6q+Zz{|E}b&Rty<P]6o0i)l[,YDwm4_9c}HnG.:l_H"
},
"non_public_notes": [
"aliquip"
],
Expand Down Expand Up @@ -151,4 +154,4 @@
"value": "1&,-`1N8_%I}<%^\"aIC+FvgvUD$<A;A0iTQu"
}
]
}
}
5 changes: 4 additions & 1 deletion tests/integration/fixtures/jobs_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@
}
}
],
"new_record": {
"$ref": "1M\"?!ouZ]W}^ 6ZBtT (OpV2~FoO1*YXan`6q+Zz{|E}b&Rty<P]6o0i)l[,YDwm4_9c}HnG.:l_H"
},
"position": "incididunt est amet cillum dolor",
"ranks": [
"UNDERGRADUATE",
Expand Down Expand Up @@ -140,4 +143,4 @@
"value": "1oCrjGBqlEYvIo"
}
]
}
}
5 changes: 4 additions & 1 deletion tests/integration/fixtures/journals_example.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
"value": "1kaeYi96?cHS(He9DVeVEr47|U9\\rS+JkqP^S6X*cEO/cf<8k$/TRV*"
}
],
"new_record": {
"$ref": "1M\"?!ouZ]W}^ 6ZBtT (OpV2~FoO1*YXan`6q+Zz{|E}b&Rty<P]6o0i)l[,YDwm4_9c}HnG.:l_H"
},
"nonpublic_note": "sint",
"peer_reviewed": false,
"public_note": "magna Ut et",
Expand Down Expand Up @@ -99,4 +102,4 @@
"value": "1kylPX:wIFy+6EI`0/hZh*a#'KGM9!~w:G,SJ,7bO~NGj!hCA8]l0m_>`RwfR5LO"
}
]
}
}