Open
Description
Dev. issue: tarantool/tarantool#10636
Product: Tarantool
Since: 3.3.0
Root document: https://www.tarantool.io/en/doc/latest/reference/reference_lua/config/utils_schema/
SME: @ mandesero
Details
Brief API description
The schema object has the new method:
- Generate JSON schema as lua table
<schema object>:jsonschema() -> lua table
Detailed API description
Example:
You can obtain the JSON schema representation of a ,
encode it using json.encode()
, and integrate it with tools like
VSCode or similar.
local json = require('json')
local schema = require('experimental.config.utils.schema')
local my_schema = schema.new('my_schema', schema.record({
name = schema.scalar({
type = 'string'
}),
list = schema.array({
items = schema.scalar({
type = 'string'
})
}),
}))
local json_schema = json.encode(my_schema:jsonschema())
...
Requested by @mandesero in tarantool/tarantool@ea5d3cd.