Skip to content

Commit

Permalink
feat: Set bearerAuth global when SecurityScheme is empty (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuraf authored Aug 23, 2024
1 parent c07c423 commit 9a6481d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
{
"inputFile": "../../../../../../../docs/pagopa/selfcare-ms-core/openapi.json",
"inputFile": "../../../../../../../docs/pagopa/selfcare-institution-ms/openapi.json",
"operationSelection": {
"includeTags": ["external-v2"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
{
"inputFile": "../../../../../../../docs/pagopa/selfcare-ms-core/openapi.json",
"inputFile": "../../../../../../../docs/pagopa/selfcare-institution-ms/openapi.json",
"operationSelection": {
"includeTags": ["internal-v1"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
{
"inputFile": "../../../../../../../docs/pagopa/selfcare-ms-core/openapi.json",
"inputFile": "../../../../../../../docs/pagopa/selfcare-institution-ms/openapi.json",
"operationSelection": {
"includeTags": ["support"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
{
"inputFile": "../../../../../../../docs/pagopa/selfcare-ms-core/openapi.json",
"inputFile": "../../../../../../../docs/pagopa/selfcare-institution-ms/openapi.json",
"operationSelection": {
"includeTags": ["external-pnpg"]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
{
"inputFile": "../../../../../../../docs/pagopa/selfcare-ms-core/openapi.json",
"inputFile": "../../../../../../../docs/pagopa/selfcare-institution-ms/openapi.json",
"operationSelection": {
"includeTags": ["support-pnpg"]
}
Expand Down
19 changes: 19 additions & 0 deletions infra/apim_v2/openapi_merge/remove_v_and_tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ fs.readFile(inputFilePathComplete, 'utf8', (err, data) => {
});
}


// Set security bearerAuth
if (openapi.paths && typeof openapi.paths === 'object') {
Object.keys(openapi.paths).forEach(path => {
const pathItem = openapi.paths[path];
['get', 'post', 'put', 'delete', 'options', 'head', 'patch', 'trace'].forEach(method => {
if (pathItem[method] && pathItem[method].security) {
pathItem[method].security.forEach(schema => {
if(schema["SecurityScheme"]) {
delete schema["SecurityScheme"];
schema["bearerAuth"] = ["global"]
}
})
}
});

});
}

// Filtra i tag nei paths
if (openapi.paths && typeof openapi.paths === 'object') {
Object.keys(openapi.paths).forEach(path => {
Expand Down

0 comments on commit 9a6481d

Please sign in to comment.