Skip to content

Client doesn't manage optional files for supported formats correctly #1387

Open
@giohappy

Description

@giohappy

We're facing two issues with option files inside the supported format configuration that is returned by GeoNode inside its settings.
The following (partial) configuration shows two cases:

[
    (...)
    {
        "id": "csv",
        "label": "CSV",
        "format": "archive",
        "ext": [
            "csv"
        ],
        "optional": [
            "prj",
            "sld",
            "xml",
            "cst"
        ]
    },
   (...)
]

First case

For the first case, MapStore complains about the missing "shp", "shx" and "dbf" files, as if it clashed with the required files for the shapefile when it founds the .prj file.

Second case

For the second case, the custom .cst file is not refused but it's not visible inside the upload widget and it's not sent to the backend.

Proposed changes

The current configuration model and parsing implemented in #1032 are convoluted and don't extend to new use cases.

The model could probably be simplified to:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://example.com/product.schema.json",
    "title": "File format configuration",
    "description": "Configuration object for a supported file format",
    "type": "object",
    "properties": {
        "id": {
            "description": "The unique identifier for the format",
            "type": "string"
        },
        "label": {
            "description": "The label for the format",
            "type": "string"
        },
        "ext": {
            "description": "The extention for the primary file",
            "type": "string"
        },
        "format": {
            "description": "The price of the product",
            "type": "array",
            "items": {
                "type": "string",
                "enum": ["vector", "raster", "archive"]
            }
        },
        "required": {
            "description": "Required companion files",
            "type": "array",
            "items": {
                "type": "string"
            },
        },
        "optional": {
            "description": "Optional companion files",
            "type": "array",
            "items": {
                "type": "string"
            },
        },
        "mimeType": {
            "description": "Array of mimeTypes to be matched",
            "type": "array",
            "items": {
                "type": "string"
            },
        }
    },
    "required": [ "id", "label", "ext", "format" ]
}

where:

  • the ext property is a string instead of an array (why an array was used before???)
  • needsFiles property is removed

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions