You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2020/09/23 05:56:01 UTC

[GitHub] [openwhisk] ningyougang opened a new pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

ningyougang opened a new pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982


   <!--- Provide a concise summary of your changes in the Title -->
   
   ## Description
   Swagger and API mismatch for action, trigger, rule list, we need keep swagger document and the actual result consistent
   e.g.
   #### Action
   Swagger - Get all actions
   
   ```json
   [
     {
       "namespace": "string",
       "name": "string",
       "version": "string",
       "publish": true,
       "exec": {
         "kind": "blackbox", // missing
         "code": "string",     // missing
         "image": "string",   // missing
         "main": "string",     // missing
         "binary": true,
         "components": [
           "string"
         ]                 // missing
       },
       "annotations": [
         {
           "key": "string"
         }
       ],
       "parameters": [
         {
           "key": "string"
         }
       ], // missing
       "limits": {
         "timeout": 0,
         "memory": 0,
         "logs": 0,
         "concurrency": 0
       },
       "updated": 0
     }
   ]
   ```
   
   
   API
   ```json
   [
     {
       "namespace": "string",
       "name": "string",
       "version": "string",
       "publish": true,
       "exec": {
         "binary": true,
       },
       "annotations": [
         {
           "key": "string"
         }
       ],
       "limits": {
         "timeout": 0,
         "memory": 0,
         "logs": 0,
         "concurrency": 0
       },
       "updated": 0
     }
   ]
   ```
   #### Trigger
   Swagger - Get all triggers
   
   ```json
   [
     {
       "namespace": "string",
       "name": "string",
       "version": "string",
       "publish": true,
       "annotations": [
         {
           "key": "string"
         }
       ],
       "parameters": [
         {
           "key": "string"
         }
       ],                // missing
       "limits": {}, // missing
       "rules": {},  // missing
       "updated": 0
     }
   ]
   ```
   
   API
   ```
   [
     {
       "namespace": "string",
       "name": "string",
       "version": "string",
       "publish": true,
       "annotations": [
         {
           "key": "string"
         }
       ],
       "updated": 0
     }
   ]
   ```
   
   #### Rule
   Swagger - Get all rules
   ```json
   [
     {
       "namespace": "string",
       "name": "string",
       "version": "string",
       "publish": true,
       "annotations": [
         {
           "key": "string"
         }
       ],
       "status": "active", // missing
       "updated": 0,
       "trigger": {
         "path": "string",
         "name": "string"
       },
       "action": {
         "path": "string",
         "name": "string"
       }
     }
   ]
   ```
   
   API
   ```json
   [
     {
       "namespace": "string",
       "name": "string",
       "version": "string",
       "publish": true,
       "annotations": [
         {
           "key": "string"
         }
       ],
       "updated": 0,
       "trigger": {
         "path": "string",
         "name": "string"
       },
       "action": {
         "path": "string",
         "name": "string"
       }
     }
   ]
   ```
   
   ## Related issue and scope
   <!--- Please include a link to a related issue if there is one. -->
   - [ ] I opened an issue to propose and discuss this change (#????)
   
   ## My changes affect the following components
   <!--- Select below all system components are affected by your change. -->
   <!--- Enter an `x` in all applicable boxes. -->
   - [ ] API
   - [ ] Controller
   - [ ] Message Bus (e.g., Kafka)
   - [ ] Loadbalancer
   - [ ] Invoker
   - [ ] Intrinsic actions (e.g., sequences, conductors)
   - [ ] Data stores (e.g., CouchDB)
   - [ ] Tests
   - [ ] Deployment
   - [ ] CLI
   - [ ] General tooling
   - [x] Documentation
   
   ## Types of changes
   <!--- What types of changes does your code introduce? Use `x` in all the boxes that apply: -->
   - [x] Bug fix (generally a non-breaking change which closes an issue).
   - [ ] Enhancement or new feature (adds new functionality).
   - [ ] Breaking change (a bug fix or enhancement which changes existing behavior).
   
   ## Checklist:
   <!--- Please review the points below which help you make sure you've covered all aspects of the change you're making. -->
   
   - [x] I signed an [Apache CLA](https://github.com/apache/openwhisk/blob/master/CONTRIBUTING.md).
   - [x] I reviewed the [style guides](https://github.com/apache/openwhisk/wiki/Contributing:-Git-guidelines#code-readiness) and followed the recommendations (Travis CI will check :).
   - [ ] I added tests to cover my changes.
   - [ ] My changes require further changes to the documentation.
   - [ ] I updated the documentation where necessary.
   
   


----------------------------------------------------------------
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] [openwhisk] ningyougang closed pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

Posted by GitBox <gi...@apache.org>.
ningyougang closed pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982


   


----------------------------------------------------------------
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] [openwhisk] ningyougang commented on pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

Posted by GitBox <gi...@apache.org>.
ningyougang commented on pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982#issuecomment-698078620


   @rabbah ,thanks for your suggestion.
   Already added the test case, but i am not sure whether it is suitable.


----------------------------------------------------------------
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] [openwhisk] rabbah commented on pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

Posted by GitBox <gi...@apache.org>.
rabbah commented on pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982#issuecomment-697500932


   @ningyougang 👏 
   There are swagger tests which we can update to make sure we have enforcement. Can those tests be improved to increase coverage?


----------------------------------------------------------------
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] [openwhisk] style95 commented on a change in pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

Posted by GitBox <gi...@apache.org>.
style95 commented on a change in pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982#discussion_r496415227



##########
File path: tests/src/test/scala/system/rest/SwaggerTests.scala
##########
@@ -46,6 +46,20 @@ class SwaggerTests extends FlatSpec with Matchers with RestUtil {
     response.body().asString().contains("\"swagger\":") should be(true)
   }
 
+  it should "respond to /api-docs including ActionMeta/ActionExecMeta/RuleMeta/TriggerMeta" in {
+    val response = RestAssured.given().config(sslconfig).get(getServiceURL() + "/api/v1/api-docs")
+
+    response.statusCode() should be(200)
+    response.body().asString().contains("\"#/definitions/ActionMeta\"") should be(true)

Review comment:
       Since the controller just returns the content of the swagger JSON file, I am not quite sure it is meaningful.
   We need to better way to make the swagger JSON file conforms to the actual APIs controllers provide.
   
   But have no idea yet..




----------------------------------------------------------------
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] [openwhisk] ningyougang commented on pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

Posted by GitBox <gi...@apache.org>.
ningyougang commented on pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982#issuecomment-698078620


   @rabbah ,thanks for your suggestion.
   Already added the test case, but i am not sure whether it is suitable.


----------------------------------------------------------------
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] [openwhisk] ningyougang closed pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

Posted by GitBox <gi...@apache.org>.
ningyougang closed pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982


   


----------------------------------------------------------------
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] [openwhisk] style95 commented on a change in pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

Posted by GitBox <gi...@apache.org>.
style95 commented on a change in pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982#discussion_r496415227



##########
File path: tests/src/test/scala/system/rest/SwaggerTests.scala
##########
@@ -46,6 +46,20 @@ class SwaggerTests extends FlatSpec with Matchers with RestUtil {
     response.body().asString().contains("\"swagger\":") should be(true)
   }
 
+  it should "respond to /api-docs including ActionMeta/ActionExecMeta/RuleMeta/TriggerMeta" in {
+    val response = RestAssured.given().config(sslconfig).get(getServiceURL() + "/api/v1/api-docs")
+
+    response.statusCode() should be(200)
+    response.body().asString().contains("\"#/definitions/ActionMeta\"") should be(true)

Review comment:
       Since the controller just returns the content of the swagger JSON file, I am not quite sure it is meaningful.
   We need a better way to make the swagger JSON file conforms to the actual APIs controllers provide.
   
   But have no idea yet..




----------------------------------------------------------------
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] [openwhisk] style95 merged pull request #4982: Fix Swagger and API mismatch for action, trigger, rule list

Posted by GitBox <gi...@apache.org>.
style95 merged pull request #4982:
URL: https://github.com/apache/openwhisk/pull/4982


   


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