You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "zbysir (via GitHub)" <gi...@apache.org> on 2023/02/01 07:51:48 UTC

[GitHub] [airflow-client-go] zbysir opened a new issue, #38: Request.Execute() return `undefined response type` error

zbysir opened a new issue, #38:
URL: https://github.com/apache/airflow-client-go/issues/38

   ```
   ➜  ~ curl -i -X GET 'https://airflow.xxx.com/api/v1/dags/xx/dagRuns/xxx' \
   -H 'Content-Type: application/json' -H 'Accept: application/json' \
   --user "xxx:xxx" \
   -d '{}'
   HTTP/2 404
   date: Wed, 01 Feb 2023 07:42:55 GMT
   content-type: application/problem+json
   content-length: 263
   server: gunicorn
   x-robots-tag: noindex, nofollow
   
   {
     "detail": "DAGRun with DAG ID: 'xxx' and DagRun ID: 'xxx' not found",
     "status": 404,
     "title": "DAGRun not found",
     "type": "https://airflow.apache.org/docs/apache-airflow/2.5.0/stable-rest-api-ref.html#section/Errors/NotFound"
   }
   ```
   
   In airflow version 2.5.0, Content-type header in error response is `application/problem+json`, but in this repo the json content-type is check by regexp 
   ```
   jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
   ```
   
   The regexp can't mach `application/problem+json`, I guess that's the problem.
   
   > About [problem+json](https://datatracker.ietf.org/doc/html/draft-nottingham-http-problem-07)
   


-- 
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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow-client-go] pierrejeambrun closed issue #38: Request.Execute() return `undefined response type` error

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun closed issue #38: Request.Execute() return `undefined response type` error
URL: https://github.com/apache/airflow-client-go/issues/38


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow-client-go] zbysir commented on issue #38: Request.Execute() return `undefined response type` error

Posted by "zbysir (via GitHub)" <gi...@apache.org>.
zbysir commented on issue #38:
URL: https://github.com/apache/airflow-client-go/issues/38#issuecomment-1411634939

   I found a related issue in openapi-generator:
   
   https://github.com/OpenAPITools/openapi-generator/issues/4890
   
   Amazingly surprised that this was a three year old question and it wasn't closed.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow-client-go] pierrejeambrun commented on issue #38: Request.Execute() return `undefined response type` error

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on issue #38:
URL: https://github.com/apache/airflow-client-go/issues/38#issuecomment-1426843717

   PR has been merged, changes will take effect at the next client release.
   
   Thanks.


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow-client-go] pierrejeambrun commented on issue #38: Request.Execute() return `undefined response type` error

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun commented on issue #38:
URL: https://github.com/apache/airflow-client-go/issues/38#issuecomment-1426759463

   Hello @zbysir,
   
   Thank you for reporting this, indeed it looks like the `problem+json` content type is not handled by generated clients. We could also add a post generation step to update the accepted content type for the client. I just opened a [PR](https://github.com/apache/airflow/pull/29476) for that.
   
   In the mean time, the `nethttp.Response` returned object will have everything you need from that failed call, maybe this is the reason this issue wasn't addressed yet.
   ```
       run, response, error := cli.DAGRunApi.GetDagRun(ctx, "fake", "fake_run").Execute()
   ```
   
   > Indeed, in case of an error you need to use 'response' and disregard 'error' which will no be relevant (undefined response type).


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow-client-go] zbysir commented on issue #38: Request.Execute() return `undefined response type` error

Posted by "zbysir (via GitHub)" <gi...@apache.org>.
zbysir commented on issue #38:
URL: https://github.com/apache/airflow-client-go/issues/38#issuecomment-1427261509

   Thank you for your proposal, it makes sense.
   
   > Hello @zbysir,
   > 
   > Thank you for reporting this, indeed it looks like the `problem+json` content type is not handled by generated clients. We could also add a post generation step to update the accepted content type for the client. I just opened a [PR](https://github.com/apache/airflow/pull/29476) for that.
   > 
   > In the mean time, the `nethttp.Response` returned object will have everything you need from that failed call, maybe this is the reason this issue wasn't addressed yet.
   > 
   > ```
   >     run, response, error := cli.DAGRunApi.GetDagRun(ctx, "fake", "fake_run").Execute()
   > ```
   > 
   > > In case of an error you need to use 'response' and disregard 'error' which will not be relevant (undefined response type).
   
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org