Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save romkhub/71ec632d37d1e1b4057ca652c82d3947 to your computer and use it in GitHub Desktop.
Save romkhub/71ec632d37d1e1b4057ca652c82d3947 to your computer and use it in GitHub Desktop.
openapi-backend minimal reproducible example - error overriding a required parameter
'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