Skip to content

Commit

Permalink
feat: GraphiQL Playground (#3660)
Browse files Browse the repository at this point in the history
*GraphiQL playground and GraphQL server sample implementation.

Signed-off-by: Olha <olya.kishkinova@gmail.com>

---------

Signed-off-by: Olha <olya.kishkinova@gmail.com>
Signed-off-by: ac892247 <a.chmelo@gmail.com>
Signed-off-by: Pablo Hernán Carle <pablo.carle@broadcom.com>
Signed-off-by: Andrea Tabone <andrea.tabone@broadcom.com>
Signed-off-by: mirek163 <95099003+mirek163@users.noreply.github.com>
Signed-off-by: Pavel Jareš <Pavel.Jares@broadcom.com>
Signed-off-by: sj895092 <shobhackm9@gmail.com>
Signed-off-by: ShobhaJayanna <36433611+Shobhajayanna@users.noreply.github.com>
Signed-off-by: Elena Kubantseva <elena.kubantseva@broadcom.com>
Signed-off-by: Pavel Jareš <58428711+pj892031@users.noreply.github.com>
Signed-off-by: achmelo <37397715+achmelo@users.noreply.github.com>
Signed-off-by: nx673747 <nafi.xhafa@broadcom.com>
Co-authored-by: achmelo <37397715+achmelo@users.noreply.github.com>
Co-authored-by: Andrea Tabone <39694626+taban03@users.noreply.github.com>
Co-authored-by: ac892247 <a.chmelo@gmail.com>
Co-authored-by: Pablo Hernán Carle <pablo.carle@broadcom.com>
Co-authored-by: Pablo Carle <pablocarle@users.noreply.github.com>
Co-authored-by: Zowe Robot <zowe-robot@users.noreply.github.com>
Co-authored-by: mirek163 <95099003+mirek163@users.noreply.github.com>
Co-authored-by: Elena Kubantseva <elena.kubantseva@broadcom.com>
Co-authored-by: Pavel Jareš <58428711+pj892031@users.noreply.github.com>
Co-authored-by: ShobhaJayanna <36433611+shobhajayanna@users.noreply.github.com>
Co-authored-by: Nafi Xhafa <164854562+nxhafa@users.noreply.github.com>
Co-authored-by: nx673747 <nafi.xhafa@broadcom.com>
  • Loading branch information
13 people authored Aug 28, 2024
1 parent b5f945d commit 9e23fba
Show file tree
Hide file tree
Showing 52 changed files with 6,980 additions and 7,664 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void givenSwaggerDoc_whenPreparePaths_thenSetpathsInSwaggerDoc() {
routedServices.addRoutedService(routedService);
routedServices.addRoutedService(routedService2);

ApiInfo apiInfo = new ApiInfo("org.zowe.apicatalog", "api/v1", null, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo("org.zowe.apicatalog", "api/v1", null, "https://localhost:10014/apicatalog/api-doc", null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, apiDocContent, routedServices);

abstractApiDocService.preparePath(openAPI.getPaths(), apiDocPath, apiDocInfo, "/api/v1/api-doc", "/", "apicatalog");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void givenSwaggerValidJson() {
routedServices.addRoutedService(routedService2);
routedServices.addRoutedService(routedService3);

ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, apiDocContent, routedServices);

String actualContent = apiDocV2Service.transformApiDoc(SERVICE_ID, apiDocInfo);
Expand Down Expand Up @@ -152,7 +152,7 @@ void givenSwaggerValidYaml() {
routedServices.addRoutedService(routedService2);
routedServices.addRoutedService(routedService3);

ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, apiDocContent, routedServices);

String actualContent = apiDocV2Service.transformApiDoc(SERVICE_ID, apiDocInfo);
Expand Down Expand Up @@ -247,7 +247,7 @@ void givenMultipleRoutedService() {
routedServices.addRoutedService(routedService2);
routedServices.addRoutedService(routedService3);

ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc",null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, apiDocContent, routedServices);

String actualContent = apiDocV2Service.transformApiDoc(SERVICE_ID, apiDocInfo);
Expand Down Expand Up @@ -297,7 +297,7 @@ void givenServiceUrlAsRoot() {
routedServices.addRoutedService(routedService);
routedServices.addRoutedService(routedService2);

ApiInfo apiInfo = new ApiInfo(API_VERSION, "api/v1", API_ID, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_VERSION, "api/v1", API_ID, "https://localhost:10014/apicatalog/api-doc", null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, apiDocContent, routedServices);

String actualContent = apiDocV2Service.transformApiDoc(SERVICE_ID, apiDocInfo);
Expand All @@ -324,7 +324,7 @@ void givenApimlHiddenTag_thenShouldBeSameDescriptionAndPaths() {
routedServices.addRoutedService(routedService);
routedServices.addRoutedService(routedService2);

ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", null);
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", null, null);
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, apiDocContent, routedServices);

String actualContent = apiDocV2Service.transformApiDoc(SERVICE_ID, apiDocInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void givenOpenApiValidJson() {
RoutedServices routedServices = new RoutedServices();
routedServices.addRoutedService(routedService);
routedServices.addRoutedService(routedService2);
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc",null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, apiDocContent, routedServices);

String actualContent = apiDocV3Service.transformApiDoc(SERVICE_ID, apiDocInfo);
Expand Down Expand Up @@ -136,7 +136,7 @@ void givenOpenApiValidYaml() {
RoutedServices routedServices = new RoutedServices();
routedServices.addRoutedService(routedService);
routedServices.addRoutedService(routedService2);
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, apiDocContent, routedServices);

String actualContent = apiDocV3Service.transformApiDoc(SERVICE_ID, apiDocInfo);
Expand Down Expand Up @@ -175,7 +175,7 @@ class ThenThrowException {
@Test
void givenEmptyJson() {
String invalidJson = "";
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc",null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, invalidJson, null);

Exception exception = assertThrows(UnexpectedTypeException.class, () -> apiDocV3Service.transformApiDoc(SERVICE_ID, apiDocInfo));
Expand All @@ -187,7 +187,7 @@ void givenInvalidJson() {
String invalidJson = "nonsense";
String error = "[Cannot construct instance of `java.util.LinkedHashMap` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('nonsense')\n" +
" at [Source: UNKNOWN; byte offset: #UNKNOWN]]";
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc",null, "https://www.zowe.org");
ApiDocInfo apiDocInfo = new ApiDocInfo(apiInfo, invalidJson, null);

Exception exception = assertThrows(UnexpectedTypeException.class, () -> apiDocV3Service.transformApiDoc(SERVICE_ID, apiDocInfo));
Expand All @@ -200,7 +200,7 @@ void givenInvalidJson() {
*/
@Test
void givenValidApiDoc_thenDontCapitalizeEnums() {
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", "https://www.zowe.org");
ApiInfo apiInfo = new ApiInfo(API_ID, "api/v1", API_VERSION, "https://localhost:10014/apicatalog/api-doc", null, "https://www.zowe.org");
String content = "{\"openapi\":\"3.0.1\",\"info\":{\"title\":\"ZoweKotlinSampleRESTAPI\",\"description\":\"SampleKotlinSpringBootRESTAPIforZowe.\",\"version\":\"1.0.0\"},\"servers\":[{\"url\":\"https://localhost:10090\",\"description\":\"Generatedserverurl\"}],\"paths\":{\"/api/v1/greeting\":{\"get\":{\"tags\":[\"Greeting\"],\"summary\":\"Returnsagreetingforthenamepassed\",\"operationId\":\"getGreeting\",\"parameters\":[{\"name\":\"name\",\"in\":\"query\",\"description\":\"Personorobjecttobegreeted\",\"required\":false,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"description\":\"Successfulgreeting\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/Greeting\"}}}},\"404\":{\"description\":\"Notfound\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schemas/ApiMessage\"}}}}}}}},\"components\":{\"schemas\":{\"Greeting\":{\"required\":[\"content\",\"id\",\"languageTag\"],\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"integer\",\"description\":\"GeneratedsequenceIDofthemessage\",\"format\":\"int64\"},\"content\":{\"type\":\"string\",\"description\":\"Thegreetingmessage\"},\"languageTag\":{\"type\":\"string\",\"description\":\"Thelocalelanguagetagusedforthismessage\"}}},\"ApiMessage\":{\"type\":\"object\",\"properties\":{\"messages\":{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/Message\"}}}},\"Message\":{\"type\":\"object\",\"properties\":{\"messageType\":{\"type\":\"string\",\"enum\":[\"ERROR\",\"WARNING\",\"INFO\",\"DEBUG\",\"TRACE\"]},\"messageNumber\":{\"type\":\"string\"},\"messageContent\":{\"type\":\"string\"},\"messageAction\":{\"type\":\"string\"},\"messageReason\":{\"type\":\"string\"},\"messageKey\":{\"type\":\"string\"},\"messageParameters\":{\"type\":\"array\",\"items\":{\"type\":\"object\"}},\"messageInstanceId\":{\"type\":\"string\"},\"messageComponent\":{\"type\":\"string\"},\"messageSource\":{\"type\":\"string\"}}}}}}";
RoutedService routedService = new RoutedService("api_v1", "api/v1", "/apicatalog");

Expand Down
3 changes: 1 addition & 2 deletions api-catalog-ui/frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ REACT_APP_STATUS_UPDATE_MAX_RETRIES=10
REACT_APP_STATUS_UPDATE_DEBOUNCE=300
REACT_APP_CA_ENV=false
REACT_APP_STATUS_UPDATE_SCALING_DURATION=1000
REACT_APP_GATEWAY_URL=
REACT_APP_ZOWE_BUILD_INFO=
REACT_APP_ZOWE_BUILD_INFO=3.0.21-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('>>> Service version compare Test', () => {
);
cy.get('div.MuiTabs-flexContainer.MuiTabs-flexContainerVertical') // Select the parent div
.find('a.MuiTab-root') // Find all the anchor elements within the div
.should('have.length', 12); // Check if there are 12 anchor elements within the div
.should('have.length', 13); // Check if there are 13 anchor elements within the div -- changed from 12 to 13 after adding Discoverable client with GraphQL
cy.get('.version-text').should('exist');
cy.get('.version-text').should('contain.text', 'Compare');
});
Expand Down
Loading

0 comments on commit 9e23fba

Please sign in to comment.