You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/10/24 04:05:15 UTC

[GitHub] [apisix] Jaycean opened a new pull request #2509: feat: get schema by schema_type

Jaycean opened a new pull request #2509:
URL: https://github.com/apache/apisix/pull/2509


   ### What this PR does / why we need it:
   - part fix apache/apisix#2441
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   


----------------------------------------------------------------
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] [apisix] membphis commented on a change in pull request #2509: WIP: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#discussion_r511526239



##########
File path: apisix/admin/plugins.lua
##########
@@ -25,7 +25,7 @@ local type      = type
 local table_remove = table.remove
 local table_sort = table.sort
 local table_insert = table.insert
-
+local json_schema = {}

Review comment:
       `json_schema` should be a temporary variable in function.




----------------------------------------------------------------
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] [apisix] Jaycean commented on pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
Jaycean commented on pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#issuecomment-716341972


   @membphis PTAL,Thx


----------------------------------------------------------------
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] [apisix] Jaycean edited a comment on pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
Jaycean edited a comment on pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#issuecomment-716355836


   @membphis I have some questions I want to discuss with you.
   
   The method I currently implement is to directly determine whether to return `consumer_schema` through whether the query field has `schema_type=consumer` in `apisix/admin/plugins.lua`. 
   ```
       local arg = get_uri_args()
       local json_schema = plugin.schema
       if arg and arg["schema_type"] == "consumer" then
           json_schema = plugin.consumer_schema
       end
   ```
   https://github.com/apache/apisix/issues/2441#issuecomment-714506729
   I thought of another implementation method to obtain the corresponding schema directly through the value of `schema_type`, but if Obtain directly through the value of `schema_type`, then you need to pass the corresponding complete schema_type:`/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer_schema`
   Instead of: `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer`


----------------------------------------------------------------
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] [apisix] juzhiyuan commented on pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#issuecomment-718301456


   > LGTM
   > 
   > tips:
   > after this pr merged, jwt-auth also needs to add `consumer_schema` to the `_M` @Jaycean
   > https://github.com/apache/apisix/blob/1dfc4cdacd620e6d59c3d4c75506ff80581612eb/apisix/plugins/jwt-auth.lua#L59
   
   - [ ] TODO this issue


----------------------------------------------------------------
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] [apisix] Jaycean commented on a change in pull request #2509: WIP: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
Jaycean commented on a change in pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#discussion_r511701638



##########
File path: apisix/admin/plugins.lua
##########
@@ -25,7 +25,7 @@ local type      = type
 local table_remove = table.remove
 local table_sort = table.sort
 local table_insert = table.insert
-
+local json_schema = {}

Review comment:
       Yes, the previous wording is indeed wrong, it has been revised




----------------------------------------------------------------
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] [apisix] Jaycean edited a comment on pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
Jaycean edited a comment on pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#issuecomment-716355836


   @membphis I have some questions to discuss with you.
   
   The method I currently implement is to directly determine whether to return `consumer_schema` through whether the query field has `schema_type=consumer` in `apisix/admin/plugins.lua`. 
   ```
       local arg = get_uri_args()
       local json_schema = plugin.schema
       if arg and arg["schema_type"] == "consumer" then
           json_schema = plugin.consumer_schema
       end
   ```
   https://github.com/apache/apisix/issues/2441#issuecomment-714506729
   I thought of another implementation method to obtain the corresponding schema directly through the value of `schema_type`, but if Obtain directly through the value of `schema_type`, then you need to pass the corresponding complete schema_type:`/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer_schema`
   Instead of: `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer`


----------------------------------------------------------------
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] [apisix] liuxiran commented on pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
liuxiran commented on pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#issuecomment-718296772


   LGTM
   
   tips:
   after this pr merged, jwt-auth also needs to add `consumer_schema` to the `_M` @Jaycean 
   https://github.com/apache/apisix/blob/1dfc4cdacd620e6d59c3d4c75506ff80581612eb/apisix/plugins/jwt-auth.lua#L59
   


----------------------------------------------------------------
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] [apisix] Jaycean commented on pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
Jaycean commented on pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#issuecomment-716355836


   @membphis I have some questions I want to discuss with you.
   
   The method I currently implement is to directly determine whether to return `consumer_schema` through whether the query field has `schema_type=consumer` in `apisix/admin/plugins.lua`. 
   ```
       local arg = get_uri_args()
       local json_schema = plugin.schema	    local json_schema = plugin.schema
       if arg and arg["schema_type"] == "consumer" then
           json_schema = plugin.consumer_schema
       end
   ```
   https://github.com/apache/apisix/issues/2441#issuecomment-714506729
   I thought of another implementation method to obtain the corresponding schema directly through the value of `schema_type`, but if Obtain directly through the value of `schema_type`, then you need to pass the corresponding complete schema_type:`/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer_schema`
   Instead of: `/apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer`


----------------------------------------------------------------
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] [apisix] Jaycean commented on pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
Jaycean commented on pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#issuecomment-718301182


   > LGTM
   > 
   > tips:
   > after this pr merged, jwt-auth also needs to add `consumer_schema` to the `_M` @Jaycean
   > https://github.com/apache/apisix/blob/1dfc4cdacd620e6d59c3d4c75506ff80581612eb/apisix/plugins/jwt-auth.lua#L59
   
   OK, I will submit a new PR unified addition to consumer_schema support


----------------------------------------------------------------
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] [apisix] membphis commented on pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #2509:
URL: https://github.com/apache/apisix/pull/2509#issuecomment-718000563


   > /apisix/admin/schema/plugins/{plugin_name}?schema_type=consumer
   
   I think this way is simpler and enough.


----------------------------------------------------------------
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] [apisix] juzhiyuan merged pull request #2509: feat: get schema by schema_type

Posted by GitBox <gi...@apache.org>.
juzhiyuan merged pull request #2509:
URL: https://github.com/apache/apisix/pull/2509


   


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