mirror of
https://github.com/emqx/neuron.git
synced 2026-10-17 04:40:42 +08:00
fix getting schema api
This commit is contained in:
@@ -195,7 +195,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "ekuiper.json",
|
||||
.schema = "ekuiper",
|
||||
.module_name = "ekuiper",
|
||||
.module_descr = "Neuron and LF Edge eKuiper integration plugin",
|
||||
.module_descr_zh = "Neuron 和 LF Edge eKuiper 一体化插件",
|
||||
|
||||
@@ -52,7 +52,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "file.json",
|
||||
.schema = "file",
|
||||
.module_name = "file",
|
||||
.module_descr = "The plugin is used to read and write files.",
|
||||
.module_descr_zh = "该插件用于读写文件。",
|
||||
|
||||
@@ -56,7 +56,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "modbus-tcp.json",
|
||||
.schema = "modbus-tcp",
|
||||
.module_name = "modbus-tcp",
|
||||
.module_descr = "The modbus-tcp plugin is used for devices connected using "
|
||||
"the modbus protocol tcp mode.",
|
||||
|
||||
@@ -469,7 +469,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "monitor.json",
|
||||
.schema = "monitor",
|
||||
.module_name = "monitor",
|
||||
.module_descr = DEFAULT_MONITOR_PLUGIN_DESCR,
|
||||
.module_descr_zh = DEFAULT_MONITOR_PLUGIN_DESCR_ZH,
|
||||
|
||||
@@ -375,7 +375,7 @@ static const neu_plugin_intf_funs_t plugin_intf_funs = {
|
||||
|
||||
const neu_plugin_module_t neu_plugin_module = {
|
||||
.version = NEURON_PLUGIN_VER_1_0,
|
||||
.schema = "mqtt.json",
|
||||
.schema = "mqtt",
|
||||
.module_name = "mqtt",
|
||||
.module_descr = DESCRIPTION,
|
||||
.module_descr_zh = DESCRIPTION_ZH,
|
||||
|
||||
@@ -167,14 +167,14 @@ void handle_get_plugin_schema(nng_aio *aio)
|
||||
|
||||
NEU_VALIDATE_JWT(aio);
|
||||
|
||||
const char *plugin_name = neu_http_get_param(aio, "plugin_name", &len);
|
||||
if (plugin_name == NULL || len == 0) {
|
||||
const char *schema_name = neu_http_get_param(aio, "schema_name", &len);
|
||||
if (schema_name == NULL || len == 0) {
|
||||
neu_http_bad_request(aio, "{\"error\": 1002}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (0 > neu_asprintf(&schema_path, "%s/schema/%s.json", g_plugin_dir,
|
||||
plugin_name)) {
|
||||
schema_name)) {
|
||||
NEU_JSON_RESPONSE_ERROR(NEU_ERR_EINTERNAL, {
|
||||
neu_http_response(aio, error_code.error, result_error);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user