Skip to content

How to Show Errors for Required Fields but Warnings for Optional Fields in Frictionless? #1734

Open
@megin1989

Description

@megin1989

Description:

I am using Frictionless to validate CSV data with a schema, and I need to differentiate between errors and warnings based on the field type:

  1. For Required Fields (e.g., GENDER):

    • If the value is missing or does not match the enum, it should be treated as an error.
  2. For Optional Fields (e.g., EXTENSION_SEX_AT_BIRTH_CODE_VALUE):

    • If the format or enum does not match, it should be treated as a warning, not an error.
    • If the value is "male", it should also generate a warning instead of an error.

Schema Example (schema.json)

{
  "fields": [
    {
      "name": "GENDER",
      "type": "string",
      "description": "Bundle.entry.resource.where(resourceType ='Patient').gender",
      "constraints": {
        "required": true,
        "enum": ["male", "female", "other", "unknown"]
      }
    },
    {
      "name": "EXTENSION_SEX_AT_BIRTH_CODE_VALUE",
      "type": "string",
      "description": "Bundle.entry.resource.where(resourceType ='Patient').extension.where(url='http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex').valueCode",
      "constraints": {
        "enum": ["f", "m", "unk"]
      }
    }
  ]
}

Expected Behavior:

Field Issue Type Expected Output
GENDER is empty ❌ Error "GENDER is required"
GENDER is "invalid_value" ❌ Error "Invalid GENDER value"
EXTENSION_SEX_AT_BIRTH_CODE_VALUE is "wrong_value" ⚠️ Warning "Invalid EXTENSION_SEX_AT_BIRTH_CODE_VALUE"

Question:

🔹 Is there a native way in Frictionless to classify specific validation errors as warnings instead of errors?


Thanks in advance! 🚀

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions