Jaycean edited a comment on pull request #2440: URL: https://github.com/apache/apisix/pull/2440#issuecomment-710769509
> > > hi please see here [apache/apisix-dashboard#495](https://github.com/apache/apisix-dashboard/issues/495) > > > > > > so you means apisix should not return disable filed until get request when FE needed? @juzhiyuan > > it seems that when the schema of the plugin does not have a `properties` property in the first level of the json schema, the interface returns the data with `disable` field. > > related code: https://github.com/membphis/apisix/blob/133b52ec78665b7292af62bab6af6bf981363a42/apisix/plugin.lua#L81 > > which doesn't seem reasonable, especially after json schema changed from draft5 to draft7. > > in json schema draft7, the `oneof` `anyof` and `allof` type of schema e.g the schema in pr #2440 does not contain `properties` in first level > > cc @Jaycean > > the #2439 may also have something to do with it. > > hi @membphis, What do you think? @liuxiran @juzhiyuan @membphis Yes, Lua code is in `apisix/apisix/plugin.lua` I think it's the code's judgment on the current schema structure that needs to be changed However, I may not have a deep understanding of the whole project and the role of the disable field, so I have not thought about how to change the code logic ``` local function load_plugin(name, plugins_list, is_stream_plugin) # line82-88 if plugin.schema and plugin.schema.type == "object" then if not plugin.schema.properties or core.table.nkeys(plugin.schema.properties) == 0 then plugin.schema.properties = core.schema.plugin_disable_schema end end # This is where the disables field is added. It seems that all schemas use this function apisix/schema_def.lua # function _M.plugin_disable_schema = { disable = {type = "boolean"} ``` Because in the JSON schema Draft 7, some structures do not contain `properties` in the first layer, but there are `properties` in the second layer, but the logic fails to judge. As a result, some schemas do not need to add the` disable` field ---------------------------------------------------------------- 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: us...@infra.apache.org