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

fix: joi transform #374

Merged
merged 6 commits into from
Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ fastify.register(require('fastify-swagger'), {
If you would like to use different schemas like, let's say [Joi](https://github.com/hapijs/joi), you can pass a synchronous `transform` method in the options to convert them back to standard JSON schemas expected by this plugin to generate the documentation (`dynamic` mode only).

```js
const convert = require('joi-to-json-schema')
const convert = require('joi-to-json')

fastify.register(require('fastify-swagger'), {
swagger: { ... },
Expand All @@ -494,7 +494,7 @@ fastify.register(require('fastify-swagger'), {
if (params) transformed.params = convert(params)
if (body) transformed.body = convert(body)
if (querystring) transformed.querystring = convert(querystring)
if (response) transformed.response = convert(response)
// if (response) transformed.response = convert(response)
alexanderniebuhr marked this conversation as resolved.
Show resolved Hide resolved
return transformed
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"fastify-helmet": "^5.0.3",
"fs-extra": "^9.0.0",
"joi": "^14.3.1",
"joi-to-json-schema": "^5.1.0",
"joi-to-json": "^1.2.0",
"pre-commit": "^1.2.2",
"standard": "^16.0.1",
"swagger-parser": "^10.0.2",
Expand Down
2 changes: 1 addition & 1 deletion test/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { test } = require('tap')
const Fastify = require('fastify')
const fastifySwagger = require('../index')
const Joi = require('joi')
const Convert = require('joi-to-json-schema')
const Convert = require('joi-to-json')

const params = Joi
.object()
Expand Down