Skip to content

Commit

Permalink
documents: configure _files in JSON schema
Browse files Browse the repository at this point in the history
* Configures `_files` property in JSON schema for editing files metadata.
* Adds a date format for `embargo_date` in elasticsearch mapping.
* Closes #280.

Co-Authored-by: Sébastien Délèze <[email protected]>
  • Loading branch information
Sébastien Délèze committed Oct 19, 2020
1 parent 6a67b40 commit c960a49
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
"description": "List of files attached to the record.",
"type": "array",
"items": {
"title": "File item",
"description": "Describes the information of a single file in the record.",
"type": "object",
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -64,7 +62,6 @@
},
"label": {
"title": "Label",
"description": "Label of the file",
"type": "string",
"minLength": 1
},
Expand All @@ -81,36 +78,39 @@
},
"order": {
"title": "Position",
"description": "Position of the file",
"description": "Position of the file, The lowest position means file is the main file.",
"type": "integer",
"default": 1,
"minimum": 1
},
"external_url": {
"title": "URL to file",
"description": "URL to file hosted in an external platform.",
"type": "string",
"minLength": 1,
"pattern": "^https?://"
"pattern": "^https?://.*"
},
"restricted": {
"title": "Restricted",
"description": "Type of restriction. 'organisation': the file is only available inside organisation view. 'internal': file is only available with a referenced IP.",
"type": "string",
"minLength": 1
"minLength": 1,
"pattern": "^(organisation|internal)$"
},
"embargo_date": {
"title": "Embargo date",
"description": "Example: 2019-05-05",
"type": "string",
"minLength": 1,
"format": "date"
"pattern": "^[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$"
}
},
"required": [
"bucket",
"file_id",
"version_id",
"key"
]
],
"propertiesOrder": ["label", "order", "external_url", "restricted", "embargo_date"]
}
},
"pid": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
"type": "keyword"
},
"embargo_date": {
"type": "date"
"type": "date",
"format": "yyyy-MM-dd"
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def _make_document(organisation='org', with_file=False, pid=None):
record.add_file(file.read(),
'test1.pdf',
order=1,
restricted='institution',
restricted='organisation',
embargo_date='2021-01-01')
record.commit()

Expand Down

0 comments on commit c960a49

Please sign in to comment.