hapi-swagger Joi string example
up vote
0
down vote
favorite
I'm having an issue with adding proper examples to hapi-swagger with Joi. When I add .example('') to either the response schema or validate { payload: {} } it's adding an additional obj with a value.
response: {
schema: Joi.object().keys({
name: Joi.string().example('Coinbase'),
baseCurrency: Joi.string()
.valid('USD', 'EUR', 'MXN', 'ETH', 'LTH', 'BTC'),
}),
},
validate: {
payload: Joi.object().keys({
name: Joi.string().required(),
baseCurrency: Joi.string().required(),
}),
},
What I expect is on the example value to have
{
"name": "Coinbase",
"baseCurrency": "USD"
}
Not
{
"name": {
"value": "Coinbase"
},
"baseCurrency": {
"value": "USD"
}
}
joi hapi-swagger
add a comment |
up vote
0
down vote
favorite
I'm having an issue with adding proper examples to hapi-swagger with Joi. When I add .example('') to either the response schema or validate { payload: {} } it's adding an additional obj with a value.
response: {
schema: Joi.object().keys({
name: Joi.string().example('Coinbase'),
baseCurrency: Joi.string()
.valid('USD', 'EUR', 'MXN', 'ETH', 'LTH', 'BTC'),
}),
},
validate: {
payload: Joi.object().keys({
name: Joi.string().required(),
baseCurrency: Joi.string().required(),
}),
},
What I expect is on the example value to have
{
"name": "Coinbase",
"baseCurrency": "USD"
}
Not
{
"name": {
"value": "Coinbase"
},
"baseCurrency": {
"value": "USD"
}
}
joi hapi-swagger
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm having an issue with adding proper examples to hapi-swagger with Joi. When I add .example('') to either the response schema or validate { payload: {} } it's adding an additional obj with a value.
response: {
schema: Joi.object().keys({
name: Joi.string().example('Coinbase'),
baseCurrency: Joi.string()
.valid('USD', 'EUR', 'MXN', 'ETH', 'LTH', 'BTC'),
}),
},
validate: {
payload: Joi.object().keys({
name: Joi.string().required(),
baseCurrency: Joi.string().required(),
}),
},
What I expect is on the example value to have
{
"name": "Coinbase",
"baseCurrency": "USD"
}
Not
{
"name": {
"value": "Coinbase"
},
"baseCurrency": {
"value": "USD"
}
}
joi hapi-swagger
I'm having an issue with adding proper examples to hapi-swagger with Joi. When I add .example('') to either the response schema or validate { payload: {} } it's adding an additional obj with a value.
response: {
schema: Joi.object().keys({
name: Joi.string().example('Coinbase'),
baseCurrency: Joi.string()
.valid('USD', 'EUR', 'MXN', 'ETH', 'LTH', 'BTC'),
}),
},
validate: {
payload: Joi.object().keys({
name: Joi.string().required(),
baseCurrency: Joi.string().required(),
}),
},
What I expect is on the example value to have
{
"name": "Coinbase",
"baseCurrency": "USD"
}
Not
{
"name": {
"value": "Coinbase"
},
"baseCurrency": {
"value": "USD"
}
}
joi hapi-swagger
joi hapi-swagger
asked Nov 5 at 18:33
Joseph Chambers
8301924
8301924
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53160173%2fhapi-swagger-joi-string-example%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password