Skip to content

Commit 451ecf5

Browse files
authored
BE: Contracts: Enable openapi contracts validator (#1250)
1 parent 4656684 commit 451ecf5

File tree

3 files changed

+34
-17
lines changed

3 files changed

+34
-17
lines changed

contract/build.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
33
plugins {
44
id "java-library"
55
alias(libs.plugins.openapi.generator)
6+
alias(libs.plugins.openapi.validator)
67
}
78

89

@@ -60,6 +61,21 @@ tasks.register('generateBackendApi', GenerateTask) {
6061
"""]
6162
}
6263

64+
openAPIStyleValidator {
65+
inputFile = "${project.projectDir}/src/main/resources/swagger/kafbat-ui-api.yaml"
66+
validateModelPropertiesDescription = false
67+
validateModelPropertiesExample = false
68+
parameterNamingConvention = "UnderscoreCase"
69+
propertyNamingConvention = "camelCase"
70+
queryParamNamingConvention = "camelCase"
71+
pathParamNamingConvention = "camelCase"
72+
validateOperationDescription = false
73+
validateInfoLicense = false
74+
validateInfoDescription = false
75+
validateInfoContact = false
76+
}
77+
78+
6379
tasks.register('generateConnectClient', GenerateTask) {
6480
generatorName = "java"
6581
inputSpec = specDir.file("kafka-connect-api.yaml").asFile.absolutePath

contract/src/main/resources/swagger/kafbat-ui-api.yaml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2157,7 +2157,7 @@ paths:
21572157
204:
21582158
description: Existing quota deleted
21592159

2160-
/api/clusters/{clusterName}/acl/streamApp:
2160+
/api/clusters/{clusterName}/acl/streamapp:
21612161
post:
21622162
tags:
21632163
- Acls
@@ -2486,7 +2486,6 @@ components:
24862486
- KAFKA_ACL_EDIT # create & delete ACLs
24872487
- CLIENT_QUOTA_MANAGEMENT
24882488
required:
2489-
- id
24902489
- name
24912490
- status
24922491

@@ -3237,7 +3236,6 @@ components:
32373236
type: integer
32383237
format: int64
32393238
required:
3240-
- topic
32413239
- partition
32423240
- offsetMax
32433241
- offsetMin
@@ -3439,16 +3437,16 @@ components:
34393437
type: string
34403438
address:
34413439
type: string
3442-
connectors_count:
3440+
connectorsCount:
34433441
type: integer
34443442
nullable: true
3445-
failed_connectors_count:
3443+
failedConnectorsCount:
34463444
type: integer
34473445
nullable: true
3448-
tasks_count:
3446+
tasksCount:
34493447
type: integer
34503448
nullable: true
3451-
failed_tasks_count:
3449+
failedTasksCount:
34523450
type: integer
34533451
nullable: true
34543452
required:
@@ -3567,21 +3565,21 @@ components:
35673565
type: integer
35683566
state:
35693567
$ref: '#/components/schemas/ConnectorTaskStatus'
3570-
worker_id:
3568+
workerId:
35713569
type: string
35723570
trace:
35733571
type: string
35743572
required:
35753573
- id
35763574
- state
3577-
- worker_id
3575+
- workerId
35783576

35793577
ConnectorStatus:
35803578
type: object
35813579
properties:
35823580
state:
35833581
$ref: '#/components/schemas/ConnectorState'
3584-
worker_id:
3582+
workerId:
35853583
type: string
35863584
required:
35873585
- state
@@ -3646,7 +3644,7 @@ components:
36463644
- STRING
36473645
required:
36483646
type: boolean
3649-
default_value:
3647+
defaultValue:
36503648
type: string
36513649
importance:
36523650
type: string
@@ -3665,7 +3663,7 @@ components:
36653663
- MEDIUM
36663664
- LONG
36673665
- NONE
3668-
display_name:
3666+
displayName:
36693667
type: string
36703668
dependents:
36713669
type: array
@@ -3681,7 +3679,7 @@ components:
36813679
type: string
36823680
value:
36833681
type: string
3684-
recommended_values:
3682+
recommendedValues:
36853683
type: array
36863684
items:
36873685
type: string
@@ -3705,7 +3703,7 @@ components:
37053703
properties:
37063704
name:
37073705
type: string
3708-
error_count:
3706+
errorCount:
37093707
type: integer
37103708
groups:
37113709
type: array
@@ -3791,7 +3789,7 @@ components:
37913789
type: string
37923790
name:
37933791
type: string
3794-
connector_class:
3792+
connectorClass:
37953793
type: string
37963794
type:
37973795
$ref: '#/components/schemas/ConnectorType'
@@ -3801,9 +3799,9 @@ components:
38013799
type: string
38023800
status:
38033801
$ref: '#/components/schemas/ConnectorStatus'
3804-
tasks_count:
3802+
tasksCount:
38053803
type: integer
3806-
failed_tasks_count:
3804+
failedTasksCount:
38073805
type: integer
38083806
required:
38093807
- name

gradle/libs.versions.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,16 @@ spring-boot = { id = 'org.springframework.boot', version.ref = 'spring-boot' }
4646
spring-dependency-management = { id = 'io.spring.dependency-management', version = '1.1.3' }
4747
git-properties = { id = 'com.gorylenko.gradle-git-properties', version = '2.4.2' }
4848
openapi-generator = { id = 'org.openapi.generator', version = '7.9.0' }
49+
openapi-validator = {id = "org.openapitools.openapistylevalidator", version = "1.10" }
4950
allure = { id = 'io.qameta.allure', version = '2.10.0' }
5051
nexus-publish-plugin = { id = 'io.github.gradle-nexus.publish-plugin', version = '1.1.0' }
5152
node-gradle = { id = 'com.github.node-gradle.node', version = '7.1.0' }
5253
#jib = { id = 'com.google.cloud.tools.jib', version = '3.4.4' }
5354
docker-remote-api = { id = 'com.bmuschko.docker-remote-api', version = '9.4.0' }
5455
sonarqube = { id = "org.sonarqube", version = "6.0.1.5171" }
5556

57+
58+
5659
[libraries]
5760
spring-starter-actuator = { module = 'org.springframework.boot:spring-boot-starter-actuator', version.ref = 'spring-boot' }
5861
spring-starter-test = { module = 'org.springframework.boot:spring-boot-starter-test', version.ref = 'spring-boot' }

0 commit comments

Comments
 (0)