inveniosoftware / domapping

Package generating elasticsearch mapping from jsonschemas
https://domapping.readthedocs.io
GNU General Public License v2.0
14 stars 8 forks source link

dereferencing local files #5

Closed tiborsimko closed 8 years ago

tiborsimko commented 8 years ago

Problem:

$ workon domapping
$ cd dojson/contrib/marc21/schemas
$ domapping schema_to_mapping ./marc21.json
[...]
jsonschema.exceptions.RefResolutionError: unknown url type: bd00x

Input:

$ cat marc21.json 
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "anyOf": [
        {"$ref": "bd00x#"},
        {"$ref": "bd01x09x#"},
        {"$ref": "bd1xx#"},
        {"$ref": "bd20x24x#"},
        {"$ref": "bd25x28x#"},
        {"$ref": "bd3xx#"},
        {"$ref": "bd4xx#"},
        {"$ref": "bd5xx#"},
        {"$ref": "bd6xx#"},
        {"$ref": "bd70x75x#"},
        {"$ref": "bd76x78x#"},
        {"$ref": "bd80x83x#"},
        {"$ref": "bd84188x#"}
    ]
}

Possible solutions:

nharraud commented 8 years ago

We can suppose that if the schema does not have an id and we have the file path (because domapping is called like this: domapping schema_to_mapping ./marc21.json) we can use the file URL as its id. However we won't be able to do it if domapping's input is stdin ( as in cat marc21.json | domapping schema_to_mapping).