Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question: how can I get the new value with default value. #40

Open
membphis opened this issue Jul 24, 2019 · 1 comment
Open

question: how can I get the new value with default value. #40

membphis opened this issue Jul 24, 2019 · 1 comment

Comments

@membphis
Copy link
Contributor

local json = require('rapidjson')

local schema = {
    type = "object",
    properties = {
        key = {type = "string"},
        secret = {type = "string", default = "xxxxxxxxx"}
    }
}

local value = {key = 'zzz'}

local sd = rapidjson.SchemaDocument(schema)
local validator = rapidjson.SchemaValidator(sd)

local d = rapidjson.Document(value)

local ok, message = validator:validate(d)

I think we can get new value {key='zzz', default = "xxxxxxxxx"}, how can I get the new value.

@membphis
Copy link
Contributor Author

@xpol Do you have any suggestions for this question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant