ad-m opened a new issue #9808:
URL: https://github.com/apache/airflow/issues/9808


   **Description**
   
   I notice that we have API specifications that require manual maintenance 
over time. In order to minimize the risk that it will become outdated, I 
propose to use its elements during integration tests ( 
https://github.com/apache/airflow/tree/master/tests/api_connexion/endpoints ).
   
   From my own experience I know that simple verification whether the scheme 
(selected by hard-coded name) contained in the specification contains all the 
fields placed in the sample answers allows to avoid many oversights. More 
attention may be required if the relevant schema will be searched based on the 
path rather than based on the schema name. Then, however, it should not be 
difficult to check if the status of the answer is provided by the 
specifications also.
   
   It requires attention to ensure that this type of test verifies both that 
the required fields are included in the response and that the response does not 
contain any fields not included in the specification.
   
   The implementation of basic tests of this type of tests should not be 
complex, as the current tests contain a response structure in memory, so you 
should find the appropriate scheme and validate this response, just as HTTP 
response status code is now verified: 
   
   
https://github.com/apache/airflow/blob/5eb2808/tests/api_connexion/endpoints/test_task_endpoint.py#L131-L133
   
   Example implementation in JavaScript:
   
   
https://github.com/hyperonecom/h1-cli/blob/5895f7414d3ebf8ceed912ef5443ebc01dd9eb69/lib/tests.js#L55-L65
   
https://github.com/hyperonecom/h1-cli/blob/5895f7414d3ebf8ceed912ef5443ebc01dd9eb69/lib/tests.js#L188-L191
   
   **Use case / motivation**
   
   Reduce maintenance burden of OpenAPI specification
   
   **Related Issues**
   
   #8107


----------------------------------------------------------------
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:
[email protected]


Reply via email to