Khan3K opened a new pull request, #71456:
URL: https://github.com/apache/airflow/pull/71456

   When a required field is missing from a REST API request, FastAPI/pydantic 
currently returns the generic 422 message `"Field required"`, which does not 
say *which* field is missing. This makes debugging requests against the Airflow 
API needlessly slow, since users have to cross-reference the OpenAPI schema.
   
   This PR registers a `RequestValidationErrorHandler` in the FastAPI error 
handlers, so missing-field validation errors now name the offending field:
   
   ```json
   {
     "detail": [
       {
         "type": "missing",
         "loc": ["body", "conn_type"],
         "msg": "Field required: `conn_type` is a required field. Please 
provide a value for it in the request.",
         "input": {"connection_id": "my_conn"}
       }
     ]
   }
   ```
   
   The response shape and all other validation errors are preserved exactly as 
before; only the `msg` of `type == "missing"` errors is enhanced.
   
   closes: #57721
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: big-pickle following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to