Maybe. What is a mongoose schema?
From: <[email protected]> on behalf of Abezar Baker <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Wednesday, 31 August 2016 at 06:13 To: Swagger <[email protected]> Subject: Can we use mongoose schema when defining the schema in swagger.json ? "paths": { "/testing": { "post": { "tags": [ "testing" ], "summary": "", "description": "Add a test", "parameters": [ { "name": "body", "in": "body", "description": "", "required": true, "schema": { "$ref": "#/definitions/SomeSchema" //can we instead point to the mongoose schema in my project so that i dont violate DRY } } ], "responses": { "200": {}, "400": { "description": "Invalid request" } } }, } "definitions": { "SomeSchema": { "type": "object", "required": [ "name" ], "properties": { "name": { "type": "string", "example": "hello" } } } } Example mongoose schema: 'use strict'; let mongoose = require('mongoose'); let Schema = mongoose.Schema; let testSchema = new Test({ name: { type: String, required: true } }, { collection: 'test', versionKey: false }); module.exports = mongoose.model('Test', testSchema); -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
