-
Notifications
You must be signed in to change notification settings - Fork 422
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
Support for Joi 14 | Example #540
Comments
looks like Joi |
Please fixed code in lib/properties.js line 221 as following:
|
^ The above worked for me also. |
Created a branch: https://github.com/glennjones/hapi-swagger/tree/feature/upgrade-joi with above fix but there are 3 failing tests. https://travis-ci.org/glennjones/hapi-swagger/jobs/485966120 I don't have time to look at this further but maybe others can help out. |
Thanks. Just noticed that someone had tried this as a pull request earlier with a faulty title: #546 |
@laurilarjo ah good catch. I never got feedback for the changes requested in #546. |
Examples are now objects, as per relase 14.0.0. References: - hapijs/joi#1615 - hapi-swagger/hapi-swagger#540 - hapi-swagger/hapi-swagger#546
Examples are now objects, as per relase 14.0.0. References: - hapijs/joi#1615 - hapi-swagger/hapi-swagger#540 - hapi-swagger/hapi-swagger#546
Notes about Joi v14 upgrade:
Expecting: {
"in": "body",
"name": "body",
"schema": {
"$ref": "#/definitions/Alt"
},
"x-alternatives": [
{
"$ref": "#/x-alt-definitions/alt1" // <==
},
{
"$ref": "#/x-alt-definitions/alt2" // <==
}
]
} Actual: {
"in": "body",
"name": "body",
"schema": {
"$ref": "#/definitions/Alt"
},
"x-alternatives": [
{
"$ref": "#/x-alt-definitions/Alt" // <==
},
{
"$ref": "#/x-alt-definitions/Model 1" // <==
}
]
} It appears Joi.alternatives().try(Joi.object({
name: Joi.string().required()
}).label('alt1'), Joi.object({
name: Joi.number().required()
}).label('alt2')).label('Alt') |
@robmcguinness When are we planning to publish the change for Joi upgrade. At the moment our documentaion try it now feature is broken because of this example thingy. |
@montumodi no plans yet. Working through the broken test to understand if the |
https://github.com/glennjones/hapi-swagger/releases/tag/v9.3.2 contains compatibility fix for Joi 14 and examples. |
v9.3.2 fixed the .example() issue for me and I was able to update joi to latest version. Thank you so much! |
Context
What are you trying to achieve or the steps to reproduce?
We have recently upgraded our hapi from version 16 to 17, Joi from 12 to 14 and hapi swagger from 7 to 9. Since than our examples on the documentation page are coming incorrect.
Previous
Now
Json schema looks like this
because of this if someone clicks on example and click "Try It out" it gives bad request because schema doesn't allow "value".
I guess this is related to Joi 14 in which examples have started to come in value. Is there any workaround, options or plan to fix this?
The text was updated successfully, but these errors were encountered: