diff --git a/backstage/examples/address-validation-service/catalog.json b/backstage/examples/address-validation-service/catalog.json index cff2c82..75220c7 100644 --- a/backstage/examples/address-validation-service/catalog.json +++ b/backstage/examples/address-validation-service/catalog.json @@ -6,7 +6,7 @@ "name": "address-validation-service", "links": [{ "url": "http://address-validation.ok-cluster.azure.cloud.openknowledge.services/webjars/swagger-ui/index.html", - "title": "Customer Service" + "title": "Address Validation Service" }], "annotations": { "backstage.io/managed-by-origin-location": "url:http://localhost:9080/service-repository/api/backstage/catalog-info.yaml", diff --git a/backstage/examples/billing-service/catalog.json b/backstage/examples/billing-service/catalog.json index 73b9bf1..37b3c03 100644 --- a/backstage/examples/billing-service/catalog.json +++ b/backstage/examples/billing-service/catalog.json @@ -6,7 +6,7 @@ "name": "billing-service", "links": [{ "url": "http://billing.ok-cluster.azure.cloud.openknowledge.services/webjars/swagger-ui/index.html", - "title": "Customer Service" + "title": "Billing Service" }], "annotations": { "backstage.io/managed-by-origin-location": "url:http://localhost:9080/service-repository/api/backstage/catalog-info.yaml", diff --git a/backstage/examples/delivery-service/catalog.json b/backstage/examples/delivery-service/catalog.json index a6d9d18..bb3be36 100644 --- a/backstage/examples/delivery-service/catalog.json +++ b/backstage/examples/delivery-service/catalog.json @@ -6,7 +6,7 @@ "name": "delivery-service", "links": [{ "url": "http://delivery.ok-cluster.azure.cloud.openknowledge.services/webjars/swagger-ui/index.html", - "title": "Customer Service" + "title": "Delivery Service" }], "annotations": { "backstage.io/managed-by-origin-location": "url:http://localhost:9080/service-repository/api/backstage/catalog-info.yaml", diff --git a/billing-service/src/main/java/de/openknowledge/sample/swaggerui/SwaggerUiResource.java b/billing-service/src/main/java/de/openknowledge/sample/swaggerui/SwaggerUiResource.java index ff4d22e..f4270dd 100644 --- a/billing-service/src/main/java/de/openknowledge/sample/swaggerui/SwaggerUiResource.java +++ b/billing-service/src/main/java/de/openknowledge/sample/swaggerui/SwaggerUiResource.java @@ -19,11 +19,7 @@ import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; import static javax.ws.rs.core.Response.Status.NOT_FOUND; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StringWriter; +import java.io.*; import java.util.logging.Logger; import javax.enterprise.context.ApplicationScoped; @@ -45,11 +41,12 @@ public class SwaggerUiResource { public Response getWebJarsResource(@PathParam("path") String path) { try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(String.format("META-INF/resources/%s", path)); BufferedReader buffer = new BufferedReader(new InputStreamReader(inputStream)); - StringWriter content = new StringWriter()) { - buffer.lines().forEach(content::write); + StringWriter writer = new StringWriter(); + PrintWriter content = new PrintWriter(writer)) { + buffer.lines().forEach(content::println); String mediaType = path.endsWith(".js") ? "application/javascript" : "text/" + path.substring(path.lastIndexOf('.') + 1); - return Response.ok(content.toString()).type(mediaType).build(); + return Response.ok(writer.toString()).type(mediaType).build(); } catch (NullPointerException e) { LOG.log(WARNING, "Could not find resource [{0}]", path); return Response.status(NOT_FOUND).build(); diff --git a/billing-service/src/main/resources/META-INF/resources/webjars/swagger-ui/v1.yaml b/billing-service/src/main/resources/META-INF/resources/webjars/swagger-ui/v1.yaml index ced7da8..cfa8993 100644 --- a/billing-service/src/main/resources/META-INF/resources/webjars/swagger-ui/v1.yaml +++ b/billing-service/src/main/resources/META-INF/resources/webjars/swagger-ui/v1.yaml @@ -1,7 +1,7 @@ openapi: "3.0.1" info: title: Billing Service V1 - version: 1.1.0 + version: "1.1.1" components: schemas: Address: @@ -64,6 +64,10 @@ paths: schema: type: "object" $ref: "#/components/schemas/Address" + application/vnd.de.openknowledge.sample.address.v1+json: + schema: + type: "object" + $ref: "#/components/schemas/Address" description: "default response" default: content: @@ -71,6 +75,10 @@ paths: schema: type: "object" $ref: "#/components/schemas/Address" + application/vnd.de.openknowledge.sample.address.v1+json: + schema: + type: "object" + $ref: "#/components/schemas/Address" description: "default response" post: parameters: @@ -92,6 +100,11 @@ paths: properties: {} type: "object" nullable: true + application/vnd.de.openknowledge.sample.address.v1+json: + schema: + properties: {} + type: "object" + nullable: true description: "default response" default: content: @@ -100,6 +113,11 @@ paths: properties: {} type: "object" nullable: true + application/vnd.de.openknowledge.sample.address.v1+json: + schema: + properties: { } + type: "object" + nullable: true description: "default response" requestBody: content: @@ -108,3 +126,7 @@ paths: type: "object" $ref: "#/components/schemas/Address" required: true + application/vnd.de.openknowledge.sample.address.v1+json: + schema: + type: "object" + $ref: "#/components/schemas/Address"