parameters: (
      parts: Sequence[Union[str, int]]
  )
return_statement: return None
docstring: Format a validation location from FastAPI into an ErrorSource.
docstring_summary: Format a validation location from FastAPI into an ErrorSource.
docstring_tokens: Format a validation location from FastAPI into an ErrorSource .
function: def _format_validation_source(
      parts: Sequence[Union[str, int]]
  ) -> Optional[ErrorSource]:
      """Format a validation location from FastAPI into an ErrorSource."""
      try:
          if parts[0] == "body":
              # ["body", "field"] > { "pointer": "/field" }
              return ErrorSource(pointer=f"/{'/'.join(str(p) for p in parts[1::])}")
          elif parts[0] == "query":
              # ["query", "param"] > { parameter: "param" }
              return ErrorSource(parameter=str(parts[1]))
          elif parts[0] == "header":
              # ["header", "name"] > { header: "name" }
              return ErrorSource(header=str(parts[1]))
      except KeyError:
          pass
  
      return None
function_tokens: def _format_validation_source ( parts : Sequence [ Union [ str , int ] ] ) -> Optional [ ErrorSource ] : try : if parts [ 0 ] == "body" : # ["body", "field"] > { "pointer": "/field" } return ErrorSource ( pointer = f"/{'/'.join(str(p) for p in parts[1::])}" ) elif parts [ 0 ] == "query" : # ["query", "param"] > { parameter: "param" } return ErrorSource ( parameter = str ( parts [ 1 ] ) ) elif parts [ 0 ] == "header" : # ["header", "name"] > { header: "name" } return ErrorSource ( header = str ( parts [ 1 ] ) ) except KeyError : pass return None