-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Querystring not working with shared schema #224
Comments
leorossi
added a commit
to leorossi/fastify-swagger
that referenced
this issue
Feb 13, 2020
4 tasks
Resolved by fastify/fastify#2108 |
This issue still persists for refs of nested properties of shared schemas. To Reproduce
Fastify doesn't throw any errors, but parameters documentation is not generated. Sample Codeconst fastify = require('fastify')({ logger: true });
fastify.register(require('fastify-swagger'), {
routePrefix: '/documentation',
exposeRoute: true,
swagger: {
host: 'localhost',
schemes: ['http'],
consumes: ['application/json'],
produces: ['application/json'],
},
});
// Add a shared schema
fastify.addSchema({
$id: 'http://example.com/',
type: 'object',
properties: {
hello: { type: 'string' },
},
});
// Generates required Swagger Docs for Parameters
fastify.get('/generates-param-docs', {
schema: {
querystring: { $ref: 'http://example.com/#' },
},
}, (req, reply) => req.query);
// Does not generate required Swagger Docs for Parameters
// If ref is used with nested properties
fastify.get('/does-not-generate-docs', {
schema: {
querystring: {
hello: { $ref: 'http://example.com#/properties/hello' },
},
},
}, (req, reply) => req.query);
fastify.listen(9000, (err) => {
if (err) {
fastify.log.error(err);
process.exit(1);
}
}); Output Screenshot |
@CodeMogul Your problem is similar to #337 or #394 but not this one. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🐛 Bug Report
Generating of swagger docs fails when I use shared schema (replace-way) in querystring.
To Reproduce
Use this code to reproduce error:
Expected behavior
I expect to see my shared schema definition in querystring on docs page.
Your Environment
The text was updated successfully, but these errors were encountered: