(annotation: Any)
| 279 | |
| 280 | |
| 281 | def _primitive_schema(annotation: Any) -> Dict[str, Any]: |
| 282 | if isinstance(annotation, type) and issubclass(annotation, Enum): |
| 283 | values = [member.value for member in annotation] |
| 284 | schema = _literal_schema(values) |
| 285 | return schema if schema else {"type": "string"} |
| 286 | |
| 287 | if annotation in {str}: |
| 288 | return {"type": "string"} |
| 289 | if annotation in {int}: |
| 290 | return {"type": "integer"} |
| 291 | if annotation in {float}: |
| 292 | return {"type": "number"} |
| 293 | if annotation in {bool}: |
| 294 | return {"type": "boolean"} |
| 295 | if annotation in {dict, abc.Mapping}: |
| 296 | return {"type": "object"} |
| 297 | if annotation in {list, abc.Sequence}: |
| 298 | return {"type": "array", "items": {"type": "string"}} |
| 299 | |
| 300 | return {"type": "string"} |
| 301 | |
| 302 | |
| 303 | def _apply_param_meta(schema: Dict[str, Any], meta: ParamMeta | None) -> Dict[str, Any]: |
no test coverage detected