You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/03/29 18:04:44 UTC

[GitHub] [airflow] ephraimbuddy opened a new issue #15072: Refactor the REST API endpoints

ephraimbuddy opened a new issue #15072:
URL: https://github.com/apache/airflow/issues/15072


   The REST API endpoints have a lot of common parts. It will be good to refactor the endpoints and have a common base that the endpoints inherit from. This way, It will be easier to author endpoints.
   
   The refactoring should include the discussion at https://github.com/apache/airflow/pull/14895#discussion_r600334911 if the PR is merged
   


-- 
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.

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



[GitHub] [airflow] uranusjr commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-941988397


   I experiemented a bit in #18934.


-- 
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] ephraimbuddy commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-940700632


   > Nothing immediately comes to mind but I think we'll be able to spot a lot of oppertuinities when we actually start doing this. I wonder if it'd be worthwhile to do thing with classes as well (like how things in `views.py` are structured)
   
   Not sure if openapi/connexion mapping will work correctly otherwise it’ll be nice to use classes. I’ll investigate 
   


-- 
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] uranusjr commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-940571379


   Nothing immediately comes to mind but I think we'll be able to spot a lot of oppertuinities when we actually start doing this. I wonder if it'd be worthwhile to do thing with classes as well (like how things in `views.py` are structured)


-- 
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] uranusjr commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-941988397


   I experiemented a bit in #18934.


-- 
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] uranusjr commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
uranusjr commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-940774908


   If `x-openapi-router-controller` doesn't work well, we can always do some manual plumbing to get the method out. Something like
   
   ```python
   class UserEndpoint(Endpoint):
       def get(self, ...):
           ...
   
       def post(self, ...):
           ...
   
   get_user = route(UserEndpoint, "get")
   post_user = route(UserEndpoint, "post")
   ```


-- 
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] ephraimbuddy edited a comment on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
ephraimbuddy edited a comment on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-939243627


   Some possible areas to refactor:
   
   - [ ] Create a base schema that all schemas will inherit from.  See using enveloping https://marshmallow.readthedocs.io/en/stable/extending.html#example-enveloping and this closed PR: https://github.com/apache/airflow/pull/9147/files#diff-8a440cb9f6479c8a90ab5d1cb8ee15700d6938ef4ccc5ee894e320f719c08d6fR25. 
   
   - [ ] In post/patch endpoints, we  : 
        ```python
       try:
           data = dagruns_batch_form_schema.load(body)
       except ValidationError as err:
           raise BadRequest(detail=str(err.messages))
       ```
   we could have a function that does this for us, so we could just do: `data = validateschema(schema, body, partial=False)`. 
   
   - [ ] See this comment: https://github.com/apache/airflow/pull/14895#discussion_r600334911
   
   cc: @eladkal 
   
   @uranusjr you can add more to the list
   
   


-- 
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] danarwix commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
danarwix commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-942163712


   I think i will start by some refactoring of the tests just to get a better understanding of the structure...


-- 
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] danarwix commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
danarwix commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-941166407






-- 
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] danarwix commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
danarwix commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-941166407


   Hey guys, would really love to take a part in that issue although i cant quite grasp where to get started.
   Would love your help on that :-)


-- 
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] ephraimbuddy commented on issue #15072: Refactor the REST API endpoints

Posted by GitBox <gi...@apache.org>.
ephraimbuddy commented on issue #15072:
URL: https://github.com/apache/airflow/issues/15072#issuecomment-939243627


   Some possible areas to refactor:
   
   - [ ] Create a base schema that all schemas will inherit from.  See using enveloping https://marshmallow.readthedocs.io/en/stable/extending.html#example-enveloping and this closed PR: https://github.com/apache/airflow/pull/9147/files#diff-8a440cb9f6479c8a90ab5d1cb8ee15700d6938ef4ccc5ee894e320f719c08d6fR25. 
   
   - [ ] In post/patch endpoints, we  : 
        ```python
       try:
           data = dagruns_batch_form_schema.load(body)
       except ValidationError as err:
           raise BadRequest(detail=str(err.messages))
       ```
   we could have a function that does this for us, so we could just do: `data = validateschema(schema, body, partial=False)`. 
   
   - [ ] See this comment: #14895#discussion_r600334911
   
   cc: @eladkal 
   
   @uranusjr you can add more to the list
   
   


-- 
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