geopython / geopython/pygeometa

Add support for non MCF validation

Open
#264 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
127
Forks
52
Avg merge
3d 8h
Merged PRs (30d)
1

Description

This topic was raised during the code sprint:

When we are transforming from a more relaxed schema to another more restrictive, it is possible that the result will not be compliant with the output schema, as we are not validating the output.

I took a look on how this could be implemented, and here are my thoughts about it:

- The current `validate` command is a proxy to `validate_mcf`
- I understand that we want to keep `validate_mcf`, as it is used in the `pygeoapi_plugin`
- Validation can be useful on its own, not only when transforming
- The commands that accept an MCF as an input are different from the commands that accept metadata in other schemas

The path I am following is:

- Add a `validate` method to `BaseOutputSchema`
- Add `can_validate` to the `schema_matrix` elements in `get_supported_schemas`
- Add `validate` to the `schemas` click command from `get_supported_schemas`
- Modify the `get_supported_schemas` to filter by schemas that can validate?
- Add a `validate` option to the `transform` click command using the previous filter when calling to `get_supported_schemas` to build the list of choices
- If the option `validate` is present, call to `schema_object_output.validate(content)` in `transform_metadata`

The questions I have are:

- What to do with `can_validate` in `get_supported_schemas` for `include_autodetect`
- Should we add the filter by validate in `get_supported_schemas`?
- How to generalize the `validate` click command? It seems like a design decision to have differentiated the commands that accept MFC from the ones that accept metadata in other schemas, so a unification might break that principle

I will reference a branch in my fork to show all the details mentioned in this issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.