Created
July 5, 2019 12:11
-
-
Save romkhub/71ec632d37d1e1b4057ca652c82d3947 to your computer and use it in GitHub Desktop.
openapi-backend minimal reproducible example - error overriding a required parameter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const OpenApiBackend = require('openapi-backend').default; | |
start(); | |
function start() { | |
const api = new OpenApiBackend({ | |
definition: { | |
openapi: '3.0.1', | |
info: { | |
title: 'test', | |
version: '1.0.0' | |
}, | |
paths: { | |
'/users/{id}': { | |
parameters: [{ | |
in: 'path', | |
name: 'id', | |
schema: { | |
type: 'integer', | |
}, | |
required: true, | |
description: 'The user ID.' | |
}], | |
get: { | |
operationId: 'getUsers', | |
parameters: [{ | |
in: 'path', | |
name: 'id', | |
required: true, | |
description: 'A comma-separated list of user IDs.', | |
schema: { | |
type: 'array', | |
items: {type: 'integer'}, | |
minItems: 1 | |
}, | |
explode: false, | |
style: 'simple' | |
}], | |
responses: { | |
'200': { | |
description: 'OK' | |
} | |
} | |
} | |
} | |
} | |
}, | |
ajvOpts: { | |
allErrors: true, | |
} | |
}); | |
api.init(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment