Questions tagged [swagger-tools]
18 questions
26
votes
2 answers
"discriminator" in polymorphism, OpenAPI 2.0 (Swagger 2.0)
Referencing OpenAPI 2.0, Schema Object, or Swagger 2.0, Schema Object, and the definition of discriminator field as:
Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema…

Musa Haidari
- 2,109
- 5
- 30
- 53
9
votes
1 answer
swagger tools error handler middleware not catching errors
overview
My custom errorHandler middleware is not catching the swagger-tools request validator error. Instead, the swagger tools HTML error is sent back to the client. How can I get my errorHandler middleware to catch the swagger tools validation…

Chris Covney
- 819
- 1
- 7
- 11
3
votes
1 answer
Swagger Tools Production Build Node js
We implemented the swagger in our nodeJs application. As of now we are created production build using webpack and remove the controller and services file.
bin/www.js
const YAML = require('yamljs');
const swaggerTools =…

Rajasekar Sankar
- 101
- 2
- 3
- 13
3
votes
0 answers
Combine multifile yaml in Javascript
I have my yaml files split up according to a structure like this:
.
├── index.yaml
├── info
│ └── index.yaml
├── definitions
│ └── index.yaml
│ └── User.yaml
└── paths
├── index.yaml
├── bar.yaml
└── foo.yaml
index.yaml:
swagger:…

TovrikTheThird
- 471
- 2
- 7
- 20
3
votes
1 answer
Swagger with custom configuration not loading params
I had been using Swagger with custom configuration and directory structure in node application.
Here is snippet of my app.js
var swaggerConfig = {
appRoot: config.get('app_root'),
configDir: 'swagger/config',
swaggerFile:…

Nazar Hussain
- 5,102
- 6
- 40
- 67
2
votes
0 answers
Is there better way to implement OAuth security in swagger-tools API?
I prepared Swagger 2.0 definition for my API implemented on node.js/connect. I added security definitions:
securityDefinitions:
BasicAuth:
type: basic
OAuth2:
type: oauth2
flow: accessCode
authorizationUrl:…

mackojar
- 21
- 3
2
votes
1 answer
Terminate outgoing http requests when incoming client http request is terminated
Overview of app
I have a node.js server application implemented with the express.js 4 module and the node.js core http module. At a high level, the app takes incoming client http messages, makes various http calls (using http module) to other…

Chris Covney
- 819
- 1
- 7
- 11
2
votes
1 answer
Swagger-UI Customization in Swagger-Tools
I want to be able to modify swagger-ui and it is currently beng served through the instance in swagger tools, which is the current dist folder of swagger-ui. I would like to modify the templates and more through main/templates which swagger tools…

user3221287
- 337
- 3
- 12
2
votes
1 answer
Changing response code on request param validation failure with Swagger 2.0
I'm using Apigee 127 on top of swagger to create a REST API.
This is the head of the configuration file swagger.yaml:
swagger: 2.0
info:
version: "0.0.1"
title: LMS API Gateway
# during dev, should point to your local machine
host: localhost
#…

Henrique Barcelos
- 7,670
- 1
- 41
- 66
1
vote
0 answers
How to use initializeMiddleware of oas tools to add customized properties to the HTTP request?
I am trying to replace the existing swagger tools in my project with oas-tools.
Source code shown as follows
const express = require('express');
const swaggerTools = require('swagger-tools');
const oasTools = require('oas-tools');
const {…

Josh-Tea
- 31
- 2
1
vote
1 answer
Possible to return 401 instead of 403 for expired token?
I want to be able to return a 401 on JWT token expiry (which I believe is the correct response?) but it returns a 403 no matter what
here is where I tell swagger tools to use my bearer token verification…

1977
- 2,580
- 6
- 26
- 37
1
vote
0 answers
Swagger-node - Capturing multer "Unexpected Field" error
I'm using swagger-node v0.7.5 for a small project that involves uploading a file.
The file to be uploaded has been declared in the YAML file and it works as expected, but with the following wrinkle I haven't been able to solve.
If the client sends…

Joseph Sabido
- 43
- 2
- 6
1
vote
0 answers
How do I make sure APIs have been documented in Swagger file before starting Express app?
My node application creates three different express servers, each one listening on a different port. Each server has a different set of APIs, with some in common between the three servers. There is also a swagger.yaml file that should contain…

Aysha Cotterill
- 11
- 1
1
vote
1 answer
Swagger-codegen generated code having issues Routing requests with parameters in path
I created my api definition using swagger and have generated the server code using Swagger-tools in NodeJs. The SwaggerRouter handles all routes properly excepts the routes with ID.
For example , routes like
/v1/factoris/self
/v1/factoris/create
are…

Karthikraj Sriram
- 11
- 1
0
votes
1 answer
Access swagger path parameters from middleware
How can I retrieve a swagger path parameter from nodejs?
The swagger definition:
/objects/{id}:
x-swagger-router-controller: object.controller
get:
summary: Get object
operationId: getObject
consumes:
-…

klautern
- 129
- 3
- 7
- 26