"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.

Reply via email to