Skip to content

Simple typo-detection by matching MissingField with ExtraField #23

@MathiasPius

Description

@MathiasPius

Misspelling a field in a strictly typed object presently results in a SchemaError::Multiple(FieldMissing, ExtraField) error. It would be cool to do some simple levenshtein distance on these two field names to suggest a typo was made if the similarity is high.

SchemaError { 
  kind: Multiple { 
  errors: [
    SchemaError { 
      kind: FieldMissing { field: "not" }, 
    }, 
    SchemaError { 
      kind: ExtraField { field: "note" },
    }
  ]
}

Would thereby be transformed into:

SchemaError { 
  kind: Typo { 
    extected: "not",
    found: "note",
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions