Class: Lutaml::Xsd::Errors::Suggesters::TypeNotFoundSuggester
- Inherits:
-
ErrorSuggester
- Object
- ErrorSuggester
- Lutaml::Xsd::Errors::Suggesters::TypeNotFoundSuggester
- Defined in:
- lib/lutaml/xsd/errors/suggesters/type_not_found_suggester.rb
Overview
Suggester for type not found errors
Suggests similar type names using fuzzy matching
Constant Summary collapse
- DEFAULT_LIMIT =
Returns Maximum number of suggestions.
5- DEFAULT_MIN_SIMILARITY =
Returns Minimum similarity threshold.
0.6
Instance Method Summary collapse
-
#generate_suggestions(error) ⇒ Array<Suggestion>
Generate suggestions for type not found errors.
Instance Method Details
#generate_suggestions(error) ⇒ Array<Suggestion>
Generate suggestions for type not found errors
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/lutaml/xsd/errors/suggesters/type_not_found_suggester.rb', line 38 def generate_suggestions(error) return [] unless can_suggest?(error) query = actual_value_from(error) return [] unless query repository = repository_from(error) return [] unless repository matcher = FuzzyMatcher.new(repository, min_similarity: min_similarity) matcher.find_similar_types(query, limit: suggestion_limit) end |