@@ -8,32 +8,15 @@ import io.swagger.v3.oas.models.security.OAuthFlows
88import io.swagger.v3.oas.models.security.Scopes
99import io.swagger.v3.parser.OpenAPIV3Parser
1010import java.io.BufferedReader
11- import org.springdoc.core.customizers.OperationCustomizer
1211import org.springframework.beans.factory.annotation.Value
13- import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
1412import org.springframework.context.annotation.Bean
1513import org.springframework.context.annotation.Configuration
16- import org.springframework.context.annotation.Primary
1714
1815@Configuration
19- @ConditionalOnProperty(name = [" csm.cliapplication" ], havingValue = " false" , matchIfMissing = true )
2016open class CsmOpenAPIConfiguration (val csmPlatformProperties : CsmPlatformProperties ) {
2117
2218 @Value(" \$ {api.version:?}" ) private lateinit var apiVersion: String
2319
24- // TODO For some reason, all operation IDs exposed are suffixed with "_1" by SpringDoc.
25- // This removes such suffix dynamically, until we find a better strategy
26- @Bean
27- open fun csmOpenAPIOperationCustomizer (): OperationCustomizer {
28- return OperationCustomizer { operation, _ ->
29- if (operation.operationId?.endsWith(" _1" ) == true ) {
30- operation.operationId = operation.operationId.substringBefore(" _1" )
31- }
32- operation
33- }
34- }
35-
36- @Primary
3720 @Bean
3821 open fun csmOpenAPI (): OpenAPI {
3922 val openApiYamlInputStream =
@@ -55,20 +38,11 @@ open class CsmOpenAPIConfiguration(val csmPlatformProperties: CsmPlatformPropert
5538
5639 openAPI.info.version = apiVersion
5740
58- if (openAPI.info.description .isNullOrBlank()) {
59- openAPI.info.description = " Cosmo Tech Platform API "
41+ if (! csmPlatformProperties.vcsRef .isNullOrBlank()) {
42+ openAPI.info.description + = " / ${csmPlatformProperties.vcsRef} "
6043 }
6144 if (! csmPlatformProperties.commitId.isNullOrBlank()) {
62- if (csmPlatformProperties.vcsRef.isNullOrBlank()) {
63- openAPI.info.description + = " (${csmPlatformProperties.commitId} )"
64- } else {
65- openAPI.info.description + =
66- " (${csmPlatformProperties.vcsRef} / ${csmPlatformProperties.commitId} )"
67- }
68- } else {
69- if (! csmPlatformProperties.vcsRef.isNullOrBlank()) {
70- openAPI.info.description + = " (${csmPlatformProperties.vcsRef} )"
71- }
45+ openAPI.info.description + = " / ${csmPlatformProperties.commitId} "
7246 }
7347
7448 // Remove any set of servers already defined in the input openapi.yaml,
0 commit comments