How to break swagger 2.0 JSON file into multiple modules

后端 未结 8 832
半阙折子戏
半阙折子戏 2020-12-04 09:41

I\'m trying to break my API document up into multiple JSON files that can be edited independently. All the examples I\'ve been able to find use the Swagger 1.2 schema which

8条回答
  •  不知归路
    2020-12-04 10:32

    If json does not work for you bis, you can also and you use node.js, you can also use module.exports

    I have my definitions in modules, and I can require a module within a module:

    const params = require(./parameters);
    module.exports = {
      description: 'Articles',
      find: {
        description: 'Some description of the method', 
        summary: 'Some summary',
        parameters: [
            params.id,
            params.limit,
    
    
    ...
    

提交回复
热议问题