@@ -57,7 +57,7 @@ def _type_sort_key(t: str) -> tuple:
5757def get_friendly_type (annotation : Type ) -> str :
5858 """Get a user-friendly type string for documentation.
5959
60- Produces types like: ``int | str``, ``"rps" ``, ``list[object]``, ``"spot" | "on-demand" | "auto" ``.
60+ Produces types like: ``int | str``, ``"vscode" | "cursor" ``, ``list[object]``.
6161 """
6262 # Unwrap Annotated
6363 if get_origin (annotation ) is Annotated :
@@ -83,9 +83,10 @@ def get_friendly_type(annotation: Type) -> str:
8383 parts .sort (key = _type_sort_key )
8484 return " | " .join (parts )
8585
86- # Handle Literal — show as enum (specific values are in the field description)
86+ # Handle Literal — list values
8787 if get_origin (annotation ) is Literal :
88- return "enum"
88+ values = get_args (annotation )
89+ return " | " .join (f'"{ v } "' for v in values )
8990
9091 # Handle list
9192 if get_origin (annotation ) is list :
@@ -184,6 +185,9 @@ def _enrich_type_from_schema(friendly_type: str, prop_schema: Dict[str, Any]) ->
184185 _ENRICHABLE = {"string" : "str" , "integer" : "int" }
185186 schema_types = set ()
186187 for entry in any_of :
188+ # Skip entries with enum constraints — those are already captured as literal values
189+ if "enum" in entry :
190+ continue
187191 mapped = _ENRICHABLE .get (entry .get ("type" , "" ))
188192 if mapped :
189193 schema_types .add (mapped )
@@ -193,9 +197,9 @@ def _enrich_type_from_schema(friendly_type: str, prop_schema: Dict[str, Any]) ->
193197 if not new_parts :
194198 return friendly_type
195199 all_parts = list (set (current_parts ) | new_parts )
196- # If str is now present, enum is redundant
197- if "str" in all_parts and "enum" in all_parts :
198- all_parts . remove ( "enum" )
200+ # If str is now present, single-value literals are redundant
201+ if "str" in all_parts :
202+ all_parts = [ p for p in all_parts if not p . startswith ( '"' ) or p in all_parts ]
199203 all_parts .sort (key = _type_sort_key )
200204 return " | " .join (all_parts )
201205
0 commit comments