-
-
Notifications
You must be signed in to change notification settings - Fork 216
Closed
Labels
semver-minorIssue or PR that should land as semver minorIssue or PR that should land as semver minor
Description
🐛 Bug Report
When I add schema by fastify.addSchema, the Model name is shown as def-# where # is index.
To Reproduce
Steps to reproduce the behavior:
const fastify = require('fastify')();
fastify.register(require('fastify-swagger'), {
swagger: {
info: {
title: 'Test swagger',
description: 'testing the fastify swagger api',
version: '0.1.0',
},
host: 'localhost',
schemes: ['http'],
consumes: ['application/json'],
produces: ['application/json'],
},
exposeRoute: true,
});
fastify.addSchema({
$id: 'greetings',
type: 'object',
properties: {
hello: { type: 'string' },
},
});
fastify.put(
'/some-route/:id',
{
schema: {
description: 'post some data',
tags: ['user'],
summary: 'qwerty',
params: {
type: 'object',
properties: {
id: {
type: 'string',
description: 'user id',
},
},
},
response: {
201: {
description: 'Succesful response',
type: 'object',
properties: {
greetings: { $ref: 'greetings#' },
},
},
},
},
},
(req, reply) => {}
);
fastify.listen(5000, (err) => {
if (err) throw err;
console.log('listening');
});Expected behavior
The model names should be shown properly like following screenshot:
Your Environment
- node version: v12.15.0
- fastify version: ^3.2.1
- os: Mac
- "fastify-swagger": "^3.3.0"
- any other relevant information
Metadata
Metadata
Assignees
Labels
semver-minorIssue or PR that should land as semver minorIssue or PR that should land as semver minor

