swagger split definition yaml - model structure not shown -


i using swagger 0.7.5 , trying split swagger.yaml file multiple. used swagger project create sample-api command create project. framework chosen express. execution of these commands created nodejs project expressjs setting , default swagger.yaml file. since targeting big application, want split yaml file across multiple. per documentation, have started externalizing response model external file , here how looks

swagger.yaml

swagger: "2.0" info:   version: "0.0.1"   title: hello service host: localhost:10010 basepath: / ... #skipping code brevity paths:   /hello:     x-swagger-router-controller: user     get:       description: hello       operationid: hello       parameters:         - name: name           in: query           description: name of person whom hello           required: false           type: string       responses:         "200":           description: success           schema:             # pointer definition             $ref: "#/definitions/helloresponse"         default:           description: error           schema:             $ref: "#/definitions/errorresponse"   /swagger:     x-swagger-pipe: swagger_raw definitions:   helloresponse:     $ref : models/response/hello_response.yaml   errorresponse:     required:       - message     properties:       message:         type: string 

models/response/hello_response.yaml

type: string properties:   message:     type: string 

after executing command swagger project start @ root of project directory, service gets started , in browser documentation displayed. problem is, swagger doc doesn't display structure externalized yaml file , shows following error message.

enter image description here

the directory structure project looks below

- api   -- swagger --- swagger.yaml - config -- config.yaml - models -- response --- hello_response.yaml - app.js 

note: tried copying models directory @ swagger.yaml level didn't work too.

never mind, after trying out lot of options, solved problem adding following line in app.js

app.use("/models", express.static("models")); 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -