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/09/17 07:38:38 UTC

[GitHub] [apisix] membphis opened a new issue #2247: feat: one tools can return the definition `jsonschema` of route, service, upstream and plugins

membphis opened a new issue #2247:
URL: https://github.com/apache/apisix/issues/2247


   I write an example, @ShiningRush please take a look at this design.
   
   ```shell
   $ ./apisix-schema help
   route               # fetch route schema
   service             # fetch service schema
   upstream            # fetch upstream schema
   consumer            # fetch consumer schema
   plugin    ***       # fetch the schema of plugin, *** means name of plugin
   
   # fetch schema of route
   ./apisix-schema route
   {...}
   
   # fetch schema of service
   ./apisix-schema service
   {...}
   
   # fetch schema of upstream
   ./apisix-schema upstream
   {...}
   
   # fetch schema of consumer
   ./apisix-schema consumer
   {...}
   
   # fetch schema of plugin basic-auth
   ./apisix-schema plugin basic-auth
   {...}
   ```


----------------------------------------------------------------
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 edited a comment on issue #2247: feat: `apisix-schema` tool can return the `jsonschema` of route, service, upstream and plugins

Posted by GitBox <gi...@apache.org>.
membphis edited a comment on issue #2247:
URL: https://github.com/apache/apisix/issues/2247#issuecomment-701249164


   another way, I think it is better than the pre one:
   
   ```lua
   #!/usr/bin/env lua
   
   -- fake "apisix.core.schema"
   package.loaded["apisix.core.schema"] = {}
   
   local schema = require("apisix.schema_def")
   print(type(schema.route))
   ```


----------------------------------------------------------------
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] ShiningRush commented on issue #2247: feat: `apisix-schema` tool can return the `jsonschema` of route, service, upstream and plugins

Posted by GitBox <gi...@apache.org>.
ShiningRush commented on issue #2247:
URL: https://github.com/apache/apisix/issues/2247#issuecomment-694053177


   We maybe need a command to export all resources to a json file at once, such as 
   `./apisix-schem all`
   It will automatically write the schema into the default directory for easy dashboard import


----------------------------------------------------------------
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 issue #2247: feat: `apisix-schema` tool can return the `jsonschema` of route, service, upstream and plugins

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2247:
URL: https://github.com/apache/apisix/issues/2247#issuecomment-732729216


   we can close this issue now


----------------------------------------------------------------
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 issue #2247: feat: `apisix-schema` tool can return the `jsonschema` of route, service, upstream and plugins

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2247:
URL: https://github.com/apache/apisix/issues/2247#issuecomment-701249164


   another way, I think it is better than the pre one:
   
   ```
   #!/usr/bin/env lua
   
   -- fake "apisix.core.schema"
   package.loaded["apisix.core.schema"] = {}
   
   local schema = require("apisix.schema_def")
   print(type(schema.route))
   ```


----------------------------------------------------------------
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 edited a comment on issue #2247: feat: `apisix-schema` tool can return the `jsonschema` of route, service, upstream and plugins

Posted by GitBox <gi...@apache.org>.
membphis edited a comment on issue #2247:
URL: https://github.com/apache/apisix/issues/2247#issuecomment-701241039


   here is an example, @nic-chen you can take a look at this:
   
   
   ```lua
   #!/usr/bin/env resty
   
   local pkg_cpath_org = package.cpath
   local pkg_path_org = package.path
   
   local apisix_home = "./"
   local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
                     .. apisix_home .. "/deps/lib/lua/5.1/?.so;"
   local pkg_path  = apisix_home .. "/?/init.lua;"
                     .. apisix_home .. "/deps/share/lua/5.1/?.lua;;"
   
   package.cpath = pkg_cpath .. pkg_cpath_org
   package.path  = pkg_path .. pkg_path_org
   
   -- local schema = require("apisix.schema_def")
   -- ngx.say(json.encode(schema.route))
   
   local json = require("cjson.safe")
   local schema = require("apisix.plugins.limit-count")
   ngx.say(json.encode(schema.schema))
   ```
   
   


----------------------------------------------------------------
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 closed issue #2247: feat: `apisix-schema` tool can return the `jsonschema` of route, service, upstream and plugins

Posted by GitBox <gi...@apache.org>.
membphis closed issue #2247:
URL: https://github.com/apache/apisix/issues/2247


   


----------------------------------------------------------------
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] nic-chen commented on issue #2247: feat: `apisix-schema` tool can return the `jsonschema` of route, service, upstream and plugins

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2247:
URL: https://github.com/apache/apisix/issues/2247#issuecomment-701249579


   OK, let me do this.


----------------------------------------------------------------
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 issue #2247: feat: `apisix-schema` tool can return the `jsonschema` of route, service, upstream and plugins

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2247:
URL: https://github.com/apache/apisix/issues/2247#issuecomment-701241039


   here is an example, @nic-chen you can take a look at this:
   
   
   ```lua
   #!/usr/bin/env resty
   
   local pkg_cpath_org = package.cpath
   local pkg_path_org = package.path
   
   local apisix_home = "./"
   local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
                     .. apisix_home .. "/deps/lib/lua/5.1/?.so;"
   local pkg_path  = apisix_home .. "/?/init.lua;"
                     .. apisix_home .. "/deps/share/lua/5.1/?.lua;;"
   
   package.cpath = pkg_cpath .. pkg_cpath_org
   package.path  = pkg_path .. pkg_path_org
   
   -- local schema = require("apisix.schema_def")
   -- ngx.say(json.encode(schema.route))
   
   ngx.timer.at(0, function ( ... )
       local json = require("cjson.safe")
       local schema = require("apisix.plugins.limit-count")
       ngx.say(json.encode(schema.schema))
   end)
   
   ngx.sleep(2)
   


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