not support the plugins with map schema

See original GitHub issue

The schema.lua

local typedefs = require "kong.db.schema.typedefs"


return {
  name = "api-auth",
  fields = {
    { consumer = typedefs.no_consumer },
    { config = {
        type = "record",
        fields = {
          { secrets = { type = "map", keys = { type = "string" }, values = { type = "string" } }, },
        },
    }, },
  },
}

the raw view:

{
  "created_at": 1562661921,
  "config": {
    "secrets": {
      "aaa": "bbb"
    }
  },
  "id": "a17edc8d-c206-4d3a-a430-e8607a4d07e5",
  "service": null,
  "name": "apiauth",
  "protocols": [
    "http",
    "https"
  ],
  "enabled": false,
  "run_on": "first",
  "consumer": null,
  "route": null,
  "tags": null
}

but the preview was wrong image

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:7

github_iconTop GitHub Comments

1reaction
4n70w4commented, Apr 8, 2021

Hi! Any news? I try use plugin https://github.com/samngms/kong-plugin-request-firewall

But get error: schema violation (config.exact_match: expected a map)

image

0reactions
json7commented, Nov 3, 2022

Change plug-in schema Lua, change the type of the corresponding field to string. Then, when processing data, convert the string into a table structure. Use the ”file-log” provided by the system as an example(You can compare the original plug-in and feel the difference): schema.lua: return { name = "file-log", fields = { { protocols = typedefs.protocols }, { config = { type = "record", fields = { { lua_script = { type = "string" }}, }, }, }, } }

handler.lua: ` function FileLogHandler:log(conf) local script_table = sandbox("return "… conf.custom_fields_by_lua, sandbox_opts) if script_table then local set_serialize_value = kong.log.set_serialize_value for key, expression in pairs(script_table) do set_serialize_value(key, sandbox(expression, sandbox_opts)()) end end

local message = kong.log.serialize() log(conf, message) end `

Read more comments on GitHub >

github_iconTop Results From Across the Web

avro maven plugin can not generate code for map schema
but after I used mvn compile , no error reported but no specific class generated. when the avsc schema is about enum or...
Read more >
Provider SDK , how I can create schema that describe map of ...
Hi Folks,. I'm trying to figure out how to declare a map of map. ... I see the error TypeMap with Elem *Resource...
Read more >
Mapping with Schema Map Manager - No Magic Documentation
The Schema Map Manager dialog allows you to see all attributes of both sources and targets. It automates data matching and mapping so...
Read more >
Change Map Zoom | WordPress.org
What's the easiest way to change the zoom on the map. ... Plugin Support jaysupport ... There is no option in the plugin...
Read more >
Create Rendering Plugins - HERE Developer
For a full list of GeoJSON features supported by the Data Inspector Library, ... In this case, for a custom layer schema that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found