Apisix-dashboard: The route imported through Apisix's interface using Export OpenAPI exported file is empty

Created on 25 Mar 2021  路  5Comments  路  Source: apache/apisix-dashboard

Issue description

I want to synchronize old data, the old apisix version is 1.4.0, and now I use apisix with version 2.4 and apisix-dashboard with version 2.4, etcd with version v3.4.15.
I use Apisix's interface '/apisix/admin/route' to import my route data, I see it work by apisix-dashboard.
When I use Export OpenAPI to export this route data, the file which I export was empty.
But another route which I create by apisix-dashboard I can export full data to file.

Expected behavior

I want to export full json data to file using Export OpenAPI function.
The route data is imported by Apisix's interface and not only create by apisix-dashboard.

How to Reproduce

1銆乮mported route data by Apisix's route api
2銆乫ind it on apisix-dashboard
3銆乧hoose this route, click Export OpenAPI to export json data
4銆乻ee this json file

Screenshots


image

which one I wish to see:
image

Environment

  • apisix version (cmd: apisix version): 2.4 (docker)
  • OS (cmd: uname -a): centos
  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):
  • etcd version, if have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):
  • apisix-dashboard version, if have: 2.4 (docker)
  • Browser version, if have: Chrome

Additional context

bug checking

All 5 comments

Hi @Jaycean @nic-chen , please take a look when you have time :)

@wangruozhu
Hi,Is it convenient to provide the data of the route created by APISIX?
This will help to reproduce the problem and solve it. Thks.

$ curl http://127.0.0.1:9080/apisix/admin/upstreams/00000000000000000058 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -i -X PUT -d '
{"name":"UC-EUREKA", "desc": "UC-EUREKA", "enable_websocket": false, "hash_on": "vars", "nodes": {"172.16.0.123:18088": 1}, "type": "roundrobin"}'

$ curl http://127.0.0.1:9080/apisix/admin/routes/00000000000000000027 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{"name":"uc鏈嶅姟", "priority": 0, "upstream_id": "00000000000000000058", "desc": "uc鏈嶅姟", "hosts": ["testbms.einyun.com"],
"uris": ["/uc/"], "plugins": {"proxy-rewrite": {"regex_uri": ["/uc/", "/"]}}}'

$ curl http://127.0.0.1:9080/apisix/admin/upstreams/00000000000000000058 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -i -X PUT -d '
{"name":"UC-EUREKA", "desc": "UC-EUREKA", "enable_websocket": false, "hash_on": "vars", "nodes": {"172.16.0.123:18088": 1}, "type": "roundrobin"}'

$ curl http://127.0.0.1:9080/apisix/admin/routes/00000000000000000027 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
{"name":"uc鏈嶅姟", "priority": 0, "upstream_id": "00000000000000000058", "desc": "uc鏈嶅姟", "hosts": ["testbms.einyun.com"],
"uris": ["/uc/_"], "plugins": {"proxy-rewrite": {"regex_uri": ["/uc/_", "/"]}}}'

  • Thank you for your reply. I have located the problem.
  • When the methods field data is empty or [], the route supports all methods, but the export does not do relevant adaptation. This is a bug, and I will fix it in the near future.
  • The fastest way to solve this problem is to add the methods field corresponding to the route, such as "methods": ["DELETE"], to ensure that the methods data is not empty, which will not affect the use of the export function. Thks.

For example

$ curl http://127.0.0.1:9080/apisix/admin/upstreams/00000000000000000058 -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -i -X PUT -d '
{"name":"UC-EUREKA", "desc": "UC-EUREKA", "enable_websocket": false, "hash_on": "vars", "nodes": {"172.16.0.123:18088": 1}, "type": "roundrobin", "methods": ["GET"]}'

I try add the method field corresponding and it work. Thks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

moonming picture moonming  路  6Comments

nic-chen picture nic-chen  路  6Comments

Firstsawyou picture Firstsawyou  路  5Comments

aiyiyi121 picture aiyiyi121  路  4Comments

qian0817 picture qian0817  路  4Comments