21 lines
432 B
Lua
21 lines
432 B
Lua
---
|
|
--- Generated by EmmyLua(https://github.com/EmmyLua)
|
|
--- Created by frankly.
|
|
--- DateTime: 2025/10/14 09:07
|
|
---
|
|
|
|
local jsonSchema = require"jsonschema"
|
|
local schema = {
|
|
type = 'object',
|
|
properties = {
|
|
foo = {type = 'string'},
|
|
bar = {type = 'number'}
|
|
}
|
|
}
|
|
|
|
local validator = jsonSchema.generate_validator(schema)
|
|
local data = { foo = 'hello', bar = 42 }
|
|
local result = validator(data)
|
|
|
|
ngx.say(result)
|