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

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

Open
giohappy opened this issue Feb 14, 2023 · 0 comments
Open

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

giohappy opened this issue Feb 14, 2023 · 0 comments

Comments

@giohappy
Copy link

giohappy commented Feb 14, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants