mirror of
https://github.com/usebruno/bruno.git
synced 2025-02-17 02:00:49 +01:00
Update openapi v3 import handle no operationId and no security
This commit is contained in:
parent
76787b4080
commit
6c52263c3c
@ -53,9 +53,15 @@ const buildEmptyJsonBody = (bodySchema) => {
|
|||||||
|
|
||||||
const transformOpenapiRequestItem = (request) => {
|
const transformOpenapiRequestItem = (request) => {
|
||||||
let _operationObject = request.operationObject;
|
let _operationObject = request.operationObject;
|
||||||
|
|
||||||
|
let operationName = _operationObject.operationId || _operationObject.summary || _operationObject.description;
|
||||||
|
if (!operationName) {
|
||||||
|
operationName = `${request.method} ${request.path}`;
|
||||||
|
}
|
||||||
|
|
||||||
const brunoRequestItem = {
|
const brunoRequestItem = {
|
||||||
uid: uuid(),
|
uid: uuid(),
|
||||||
name: _operationObject.operationId,
|
name: operationName,
|
||||||
type: 'http-request',
|
type: 'http-request',
|
||||||
request: {
|
request: {
|
||||||
url: ensureUrl(request.global.server + '/' + request.path),
|
url: ensureUrl(request.global.server + '/' + request.path),
|
||||||
@ -100,7 +106,7 @@ const transformOpenapiRequestItem = (request) => {
|
|||||||
|
|
||||||
let auth;
|
let auth;
|
||||||
// allow operation override
|
// allow operation override
|
||||||
if (_operationObject.security) {
|
if (_operationObject.security && _operationObject.security.length > 0) {
|
||||||
let schemeName = Object.keys(_operationObject.security[0])[0];
|
let schemeName = Object.keys(_operationObject.security[0])[0];
|
||||||
auth = request.global.security.getScheme(schemeName);
|
auth = request.global.security.getScheme(schemeName);
|
||||||
} else if (request.global.security.supported.length > 0) {
|
} else if (request.global.security.supported.length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user