diff --git a/accelerator.yaml b/accelerator.yaml index a7eba54d..3cf1a9c9 100644 --- a/accelerator.yaml +++ b/accelerator.yaml @@ -1,12 +1,14 @@ accelerator: - displayName: Tanzu Java Web App - description: A sample Spring Boot web application built with Tanzu supply-chain + displayName: Tanzu Java Spring Api Provider (40) + description: A sample Spring Boot web application built with Tanzu supply-chain that uses sprindocs to generate an openAPI document. iconUrl: https://github.com/sample-accelerators/icons/raw/master/icon-boot.png tags: - java - spring - web - tanzu + - openAPI + - api options: - name: repositoryPrefix @@ -14,11 +16,16 @@ accelerator: label: Prefix for the container image repository defaultValue: dev.local required: true + - name: exposeOpenAPIEndpoint + label: Expose OpenAPI endpoint? + display: true + dataType: boolean + defaultValue: false engine: merge: - include: [ "**/*" ] - exclude: [ "config/*.yaml", "Tiltfile", "README.md", "grype.yaml", "catalog/*.yaml", ".github/workflows/**" ] + exclude: [ "config/*.yaml", "Tiltfile", "README.md", "grype.yaml", "catalog/*.yaml", ".github/workflows/**", "pom.xml" ] - include: [ "config/*.yaml", "Tiltfile" ] chain: - type: ReplaceText @@ -43,3 +50,15 @@ engine: with: "#artifactId" - type: RewritePath rewriteTo: "#filename" + - include: [ "pom.xml" ] + chain: + - type: ReplaceText + condition: "#exposeOpenAPIEndpoint" + substitutions: + - text: + with: "'\n org.springdoc\n springdoc-openapi-ui\n 1.6.9\n '" + - type: ReplaceText + condition: "!#exposeOpenAPIEndpoint" + substitutions: + - text: + with: "''" diff --git a/config/workload.yaml b/config/workload.yaml index 218e13d7..5ee1553f 100644 --- a/config/workload.yaml +++ b/config/workload.yaml @@ -5,11 +5,21 @@ metadata: labels: apps.tanzu.vmware.com/workload-type: web app.kubernetes.io/part-of: tanzu-java-web-app + app.tanzu.vmware.com/register-api: "true" + apps.tanzu.vmware.com/has-tests: "true" + apis.apps.tanzu.vmware.com/register-api: "true" spec: params: - name: annotations value: autoscaling.knative.dev/minScale: "1" + - name: api_descriptor + value: + type: openapi + location: + path: "/v3/api-docs" + owner: team-petclinic + description: "A set of API endpoints to manage the resources within the petclinic app." source: git: url: https://github.com/sample-accelerators/tanzu-java-web-app diff --git a/pom.xml b/pom.xml index 2f9fff47..fe094192 100644 --- a/pom.xml +++ b/pom.xml @@ -49,6 +49,8 @@ true + + diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 03ce5d08..d614a3a5 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -8,4 +8,5 @@ management: include: "*" endpoint: health: - show-details: always \ No newline at end of file + show-details: always +