Skip to content

Commit

Permalink
Merge pull request #23499 from mshima/skip_ci-swagger
Browse files Browse the repository at this point in the history
fix swagger for gateway/microservices
  • Loading branch information
DanielFran authored Sep 14, 2023
2 parents 8950c3c + 8bab7d4 commit f6a805a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-%>
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title><%= baseName %> - Swagger UI</title>
<base href="/swagger-ui/"/>
<base href="/swagger-ui/" />
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
Expand Down Expand Up @@ -91,20 +91,23 @@
urls = (
await Promise.allSettled(
services.map(async service => {
return axios.get(`/services/${service}/management/jhiopenapigroups`, axiosConfig).then(response => {
if (Array.isArray(response.data)) {
return response.data.map(({ group, description }) => ({
name: description,
url: `/services/${service}${baseUrl}/${group}`,
}));
}
return undefined;
}).catch(() => {
return axios
.get(`/services/${service}${baseUrl}`, axiosConfig)
.then(() => [{ url: `/services/${service}${baseUrl}`, name: `${service} (default)` }]);
});
})
return axios
.get(`/services/${service}/management/jhiopenapigroups`, axiosConfig)
.then(response => {
if (Array.isArray(response.data)) {
return response.data.map(({ group, description }) => ({
name: description,
url: `/services/${service}/${baseUrl}/${group}`,
}));
}
return undefined;
})
.catch(() => {
return axios
.get(`/services/${service}/${baseUrl}`, axiosConfig)
.then(() => [{ url: `/services/${service}/${baseUrl}`, name: `${service} (default)` }]);
});
}),
)
)
.filter(settled => settled.status === 'fulfilled')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@ describe('/admin', () => {
cy.get(swaggerFrameSelector).should('be.visible').then(() => {
// Wait iframe to load
cy.wait(500); // eslint-disable-line cypress/no-unnecessary-waiting
cy.get(swaggerFrameSelector).its('0.contentDocument.body').find(swaggerPageSelector, { timeout: 15000 }).should('be.visible');
const getSwaggerIframe = () => {
return cy.get(swaggerFrameSelector).its('0.contentDocument.body').should('not.be.empty').then(cy.wrap);
};
getSwaggerIframe().find(swaggerPageSelector, { timeout: 15000 }).should('be.visible');
getSwaggerIframe().find('[id="select"] > option').its('length').should('be.gt', 0);
getSwaggerIframe().find(swaggerPageSelector).then(cy.wrap).find('.information-container').its('length').should('be.gt', 0);
});
}
});
Expand Down

0 comments on commit f6a805a

Please sign in to comment.