kenspirit / joi-route-to-swagger Goto Github PK
View Code? Open in Web Editor NEWConvert joi route definition to swagger doc json format
License: MIT License
Convert joi route definition to swagger doc json format
License: MIT License
Hi, guys,
I have the problems with the mapping Joi shemas to Swagger UI and I look for your advices :)
export const BotSchema = Joi.object().keys({
id: Joi.string().optional(),
layout: Joi.number().required().label('bot.navigation.$.layout'),
title: Joi.string().required().label('bot.navigation.$.title'),
type: Joi.string().required(),
});
As a result - we can see "id" param in both cases - req and res:
What is a right way to working with this schemas?
Should I create different schemas - first for request body and second for response body?
I see the next picture, but It's incorrect result (we have different types of field "data" depends on field "type".
What is a right way to configure this schemas for displaying correct result in Swagger UI?
Thanks in advance!
Hello sir,
Can anyway to upload the multipart/form-data via joi_to_json_schema?
Hello sir,
Can you help me out!!
Unable to render this definition
The provided definition does not specify a valid version field.
Please indicate a valid Swagger or OpenAPI version field. Supported version fields are swagger: "2.0" and those that match openapi: 3.0.n (for example, openapi: 3.0.0).
https://picresize.com/popup.html?images/rsz_screenshot_from_2020-11-10_10-44-24.png
For joi.when() schema proper swagger definition is not coming for example
Joi schema:-
myRequiredField: rm.joi.boolean(),
message: rm.joi.when('myRequiredField', {
is: true,
then: rm.joi.string(),
otherwise: rm.joi.number(),
})
Actual swagger definition:-
"myRequiredField": {
"type": "boolean",
"description": ""
},
"message": {
"type": [
"array",
"boolean",
"number",
"object",
"string",
"null"
],
"description": ""
}
Expected swagger definition:-
"myRequiredField": {
"type": "boolean",
"description": ""
},
"message": {
"properties": {
"oneOf": [
{
"type": "string"
},
{
"type": "number",
"format": "number"
}
]
}
}
I try to pass the auth token but it does not allow to send in the request headers
Hello,
The current version generates an incorrect reference in the entity defintion.
pet: {
type: "object",
description: "",
schema: {
$ref: "#/definitions/Pet"
}
},
The correct version should be:
pet: {
type: "object",
description: "",
$ref: "#/definitions/Pet"
},
Is there any example to define an upload api?
how can i get custom response and remove schemas from documentation
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.