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

Fastify-swagger integration #3

Closed
mbaev opened this issue Dec 23, 2020 · 2 comments
Closed

Fastify-swagger integration #3

mbaev opened this issue Dec 23, 2020 · 2 comments
Labels
question Further information is requested

Comments

@mbaev
Copy link

mbaev commented Dec 23, 2020

Hello! This is awesome package!
I did deep research until finally I found this package!
I love it!

So dear Jeka, can you help to understand how to integrate the plugin with fastify-swagger?

it doesn't see the list of routes defined by the package.

@jeka-kiselyov
Copy link
Owner

Glad you find it helpful, @mbaev

Tried it out of the box with default configuration on sample application and it works. Be sure you register fastify-swagger first and fastify-mongoose-api after it, as swager one adds hooks for new routes.

Parameters and sample responses are expectedly empty though. If while working on your project you have any ideas or pull requests which would generate this data for swagger - please let me know.

94c0ade3-dd20-47d2-92d5-2d5c92eea7b5

@jeka-kiselyov jeka-kiselyov added the question Further information is requested label Dec 23, 2020
@mbaev
Copy link
Author

mbaev commented Dec 24, 2020

Oh, right! It works perfect!

It could be a good idea for the future to add an example response based on mongoose schema

// models/Center.js
import { Schema, model } from 'mongoose'

const schema = new Schema({
  name: {
    type: String,
    required: true
  },
  createdAt: {
    type: Date,
    required: true,
    default: Date.now
  },
  updatedAt: {
    type: Date,
    required: true,
    default: Date.now
  }
})

export default model('Center', schema)

image

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants