Skip to content

Commit 3deb7ad

Browse files
chore(upgrade): Migrate to openapi swagger spec (#1046)
Co-authored-by: christosarvanitis <[email protected]>
1 parent 6f4cc55 commit 3deb7ad

File tree

34 files changed

+350
-343
lines changed

34 files changed

+350
-343
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
orcaVersion=8.57.0
1+
orcaVersion=8.58.0
22
org.gradle.parallel=true
33
spinnakerGradleVersion=8.32.1
44
targetJava17=true

kayenta-atlas/src/main/java/com/netflix/kayenta/atlas/controllers/AtlasFetchController.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import com.netflix.kayenta.metrics.SynchronousQueryProcessor;
2424
import com.netflix.kayenta.security.AccountCredentials;
2525
import com.netflix.kayenta.security.AccountCredentialsRepository;
26-
import io.swagger.annotations.ApiParam;
26+
import io.swagger.v3.oas.annotations.Parameter;
2727
import java.io.IOException;
2828
import java.time.Instant;
2929
import java.util.Collections;
@@ -55,14 +55,14 @@ public AtlasFetchController(
5555
public Map queryMetrics(
5656
@RequestParam(required = false) final String metricsAccountName,
5757
@RequestParam(required = false) final String storageAccountName,
58-
@ApiParam(defaultValue = "name,CpuRawUser,:eq,:sum") @RequestParam String q,
59-
@ApiParam(defaultValue = "cpu") @RequestParam String metricSetName,
60-
@ApiParam(defaultValue = "cluster") @RequestParam String type,
58+
@Parameter(example = "name,CpuRawUser,:eq,:sum") @RequestParam String q,
59+
@Parameter(example = "cpu") @RequestParam String metricSetName,
60+
@Parameter(example = "cluster") @RequestParam String type,
6161
@RequestParam String scope,
62-
@ApiParam(defaultValue = "us-east-1") @RequestParam String location,
63-
@ApiParam(defaultValue = "2000-01-01T00:00:00Z") @RequestParam Instant start,
64-
@ApiParam(defaultValue = "2000-01-01T04:00:00Z") @RequestParam Instant end,
65-
@ApiParam(defaultValue = "300") @RequestParam Long step)
62+
@Parameter(example = "us-east-1") @RequestParam String location,
63+
@Parameter(example = "2000-01-01T00:00:00Z") @RequestParam Instant start,
64+
@Parameter(example = "2000-01-01T04:00:00Z") @RequestParam Instant end,
65+
@Parameter(example = "300") @RequestParam Long step)
6666
throws IOException {
6767
String resolvedMetricsAccountName =
6868
accountCredentialsRepository

kayenta-core/kayenta-core.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ dependencies {
55
api "io.spinnaker.kork:kork-retrofit"
66
api "com.netflix.spectator:spectator-api"
77

8-
api "io.swagger:swagger-annotations"
9-
108
api "io.spinnaker.orca:orca-core"
119
api "io.spinnaker.orca:orca-retrofit"
1210

@@ -16,6 +14,7 @@ dependencies {
1614
api "net.logstash.logback:logstash-logback-encoder"
1715

1816
api "javax.validation:validation-api"
17+
api "io.swagger.core.v3:swagger-annotations"
1918

2019
testImplementation "io.spinnaker.kork:kork-jedis-test"
2120
}

kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierConfig.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
package com.netflix.kayenta.canary;
1818

1919
import com.fasterxml.jackson.annotation.JsonInclude;
20-
import io.swagger.annotations.ApiModel;
21-
import io.swagger.annotations.ApiModelProperty;
20+
import io.swagger.v3.oas.annotations.media.Schema;
2221
import java.util.Map;
2322
import javax.validation.constraints.NotNull;
2423
import lombok.*;
@@ -28,19 +27,19 @@
2827
@NoArgsConstructor
2928
@AllArgsConstructor
3029
@JsonInclude(JsonInclude.Include.NON_NULL)
31-
@ApiModel(description = "The classification configuration, such as group weights.")
30+
@Schema(description = "The classification configuration, such as group weights.")
3231
public class CanaryClassifierConfig {
3332

34-
@ApiModelProperty(
35-
value =
33+
@Schema(
34+
description =
3635
"List of each metrics group along with its corresponding weight. Weights must total 100.",
3736
example = "{\"pod-group\": 70, \"app-group\": 30}")
3837
@NotNull
3938
@Singular
4039
@Getter
4140
private Map<String, Double> groupWeights;
4241

43-
@ApiModelProperty(hidden = true)
42+
@Schema(hidden = true)
4443
@Getter
4544
private CanaryClassifierThresholdsConfig scoreThresholds;
4645
}

kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryClassifierThresholdsConfig.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
package com.netflix.kayenta.canary;
1818

1919
import com.fasterxml.jackson.annotation.JsonInclude;
20-
import io.swagger.annotations.ApiModel;
21-
import io.swagger.annotations.ApiModelProperty;
20+
import io.swagger.v3.oas.annotations.media.Schema;
2221
import javax.validation.constraints.NotNull;
2322
import lombok.*;
2423

@@ -27,18 +26,19 @@
2726
@NoArgsConstructor
2827
@AllArgsConstructor
2928
@JsonInclude(JsonInclude.Include.NON_NULL)
30-
@ApiModel(description = "Sets thresholds for canary score.")
29+
@Schema(description = "Sets thresholds for canary score.")
3130
public class CanaryClassifierThresholdsConfig {
3231

33-
@ApiModelProperty(
34-
value = "If canary score is higher than this value -- canary is considered successful.",
32+
@Schema(
33+
description = "If canary score is higher than this value -- canary is considered successful.",
3534
example = "75.0")
3635
@NotNull
3736
@Getter
3837
private Double pass;
3938

40-
@ApiModelProperty(
41-
value = "If canary score is lower than this value -- canary is considered marginal (failed).",
39+
@Schema(
40+
description =
41+
"If canary score is lower than this value -- canary is considered marginal (failed).",
4242
example = "50.0")
4343
@NotNull
4444
@Getter

kayenta-core/src/main/java/com/netflix/kayenta/canary/CanaryJudgeConfig.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
package com.netflix.kayenta.canary;
1818

1919
import com.fasterxml.jackson.annotation.JsonInclude;
20-
import io.swagger.annotations.ApiModel;
21-
import io.swagger.annotations.ApiModelProperty;
20+
import io.swagger.v3.oas.annotations.media.Schema;
2221
import java.util.Map;
2322
import javax.validation.constraints.NotNull;
2423
import lombok.*;
@@ -28,19 +27,19 @@
2827
@NoArgsConstructor
2928
@AllArgsConstructor
3029
@JsonInclude(JsonInclude.Include.NON_NULL)
31-
@ApiModel(description = "Judge configuration.")
30+
@Schema(description = "Judge configuration.")
3231
public class CanaryJudgeConfig {
3332

34-
@ApiModelProperty(
35-
value = "Judge to use, as of right now there is only `NetflixACAJudge-v1.0`.",
33+
@Schema(
34+
description = "Judge to use, as of right now there is only `NetflixACAJudge-v1.0`.",
3635
example = "NetflixACAJudge-v1.0",
3736
required = true)
3837
@NotNull
3938
@Getter
4039
private String name;
4140

42-
@ApiModelProperty(
43-
value =
41+
@Schema(
42+
description =
4443
"Additional judgement configuration. As of right now, this should always be an empty object.",
4544
example = "{}",
4645
required = true)

kayenta-datadog/src/main/java/com/netflix/kayenta/datadog/controller/DatadogFetchController.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import com.netflix.kayenta.metrics.SynchronousQueryProcessor;
2626
import com.netflix.kayenta.security.AccountCredentials;
2727
import com.netflix.kayenta.security.AccountCredentialsRepository;
28-
import io.swagger.annotations.ApiParam;
28+
import io.swagger.v3.oas.annotations.Parameter;
29+
import io.swagger.v3.oas.annotations.media.Schema;
2930
import java.io.IOException;
3031
import java.time.Instant;
3132
import java.util.Map;
@@ -61,18 +62,21 @@ public DatadogFetchController(
6162
public Map queryMetrics(
6263
@RequestParam(required = false) final String metricsAccountName,
6364
@RequestParam(required = false) final String storageAccountName,
64-
@ApiParam(defaultValue = "cpu") @RequestParam String metricSetName,
65-
@ApiParam(defaultValue = "avg:system.cpu.user") @RequestParam String metricName,
66-
@ApiParam(value = "The scope of the Datadog query. e.g. autoscaling_group:myapp-prod-v002")
65+
@Parameter(example = "cpu") @RequestParam String metricSetName,
66+
@Parameter(example = "avg:system.cpu.user") @RequestParam String metricName,
67+
@Parameter(
68+
description =
69+
"The scope of the Datadog query. e.g. autoscaling_group:myapp-prod-v002")
6770
@RequestParam(required = false)
6871
String scope,
69-
@ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z")
72+
@Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z")
7073
@RequestParam(required = false)
7174
String start,
72-
@ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z")
75+
@Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z")
7376
@RequestParam(required = false)
7477
String end,
75-
@ApiParam(defaultValue = "false") @RequestParam(required = false) final boolean dryRun)
78+
@Parameter(schema = @Schema(defaultValue = "false")) @RequestParam(required = false)
79+
final boolean dryRun)
7680
throws IOException {
7781
// Apply defaults.
7882
scope =

kayenta-graphite/src/main/java/com/netflix/kayenta/graphite/controller/GraphiteFetchController.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import com.netflix.kayenta.metrics.SynchronousQueryProcessor;
2626
import com.netflix.kayenta.security.AccountCredentials;
2727
import com.netflix.kayenta.security.AccountCredentialsRepository;
28-
import io.swagger.annotations.ApiParam;
28+
import io.swagger.v3.oas.annotations.Parameter;
2929
import java.io.IOException;
3030
import java.time.Instant;
3131
import java.util.Collections;
@@ -63,25 +63,25 @@ public GraphiteFetchController(
6363
public Map queryMetrics(
6464
@RequestParam(required = false) final String metricsAccountName,
6565
@RequestParam(required = false) final String storageAccountName,
66-
@ApiParam(defaultValue = "cpu") @RequestParam String metricSetName,
67-
@ApiParam(defaultValue = "system.$location.$scope") @RequestParam String metricName,
68-
@ApiParam(
69-
value =
66+
@Parameter(example = "cpu") @RequestParam String metricSetName,
67+
@Parameter(example = "system.$location.$scope") @RequestParam String metricName,
68+
@Parameter(
69+
description =
7070
"The name of the resource to use when scoping the query. "
7171
+ "This parameter will replace $scope in metricName")
7272
@RequestParam(required = false)
7373
String scope,
74-
@ApiParam(
75-
value =
74+
@Parameter(
75+
description =
7676
"The name of the resource to use when locating the query. "
7777
+ "This parameter will replace $location in metricName")
7878
@RequestParam(required = false)
7979
String location,
80-
@ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam
80+
@Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam
8181
String start,
82-
@ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam
82+
@Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam
8383
String end,
84-
@ApiParam(defaultValue = "false") @RequestParam(required = false) final boolean dryRun)
84+
@Parameter(example = "false") @RequestParam(required = false) final boolean dryRun)
8585
throws IOException {
8686

8787
start =

kayenta-influxdb/src/main/java/com/netflix/kayenta/influxdb/controller/InfluxDbFetchController.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.netflix.kayenta.metrics.SynchronousQueryProcessor;
2828
import com.netflix.kayenta.security.AccountCredentials;
2929
import com.netflix.kayenta.security.AccountCredentialsRepository;
30-
import io.swagger.annotations.ApiParam;
30+
import io.swagger.v3.oas.annotations.Parameter;
3131
import java.io.IOException;
3232
import java.time.Instant;
3333
import java.util.Collections;
@@ -64,21 +64,23 @@ public InfluxDbFetchController(
6464
public Map<String, String> queryMetrics(
6565
@RequestParam(required = false) final String metricsAccountName,
6666
@RequestParam(required = false) final String storageAccountName,
67-
@ApiParam(defaultValue = "cpu") @RequestParam String metricSetName,
68-
@ApiParam(defaultValue = "temperature") @RequestParam String metricName,
69-
@ApiParam(value = "Fields that are being queried. e.g. internal, external")
67+
@Parameter(example = "cpu") @RequestParam String metricSetName,
68+
@Parameter(example = "temperature") @RequestParam String metricName,
69+
@Parameter(description = "Fields that are being queried. e.g. internal, external")
7070
@RequestParam(required = false)
7171
List<String> fields,
72-
@ApiParam(value = "The scope of the Influxdb query. e.g. autoscaling_group:myapp-prod-v002")
72+
@Parameter(
73+
description =
74+
"The scope of the Influxdb query. e.g. autoscaling_group:myapp-prod-v002")
7375
@RequestParam(required = false)
7476
String scope,
75-
@ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z")
77+
@Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z")
7678
@RequestParam(required = false)
7779
String start,
78-
@ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z")
80+
@Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z")
7981
@RequestParam(required = false)
8082
String end,
81-
@ApiParam(defaultValue = "60", value = "seconds") @RequestParam Long step)
83+
@Parameter(example = "60", description = "seconds") @RequestParam Long step)
8284
throws IOException {
8385
// Apply defaults.
8486
scope =

kayenta-newrelic-insights/src/main/java/com/netflix/kayenta/newrelic/controller/NewRelicFetchController.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import com.netflix.kayenta.newrelic.config.NewRelicConfigurationTestControllerDefaultProperties;
2626
import com.netflix.kayenta.security.AccountCredentials;
2727
import com.netflix.kayenta.security.AccountCredentialsRepository;
28-
import io.swagger.annotations.ApiParam;
28+
import io.swagger.v3.oas.annotations.Parameter;
29+
import io.swagger.v3.oas.annotations.media.Schema;
2930
import java.io.IOException;
3031
import java.time.Instant;
3132
import java.util.Map;
@@ -62,22 +63,25 @@ public NewRelicFetchController(
6263
public Map queryMetrics(
6364
@RequestParam(required = false) final String metricsAccountName,
6465
@RequestParam(required = false) final String storageAccountName,
65-
@ApiParam(required = true) @Valid @RequestBody NewRelicFetchRequest newRelicFetchRequest,
66-
@ApiParam(value = "The scope of the NewRelic query. e.g. autoscaling_group:myapp-prod-v002")
66+
@Parameter(required = true) @Valid @RequestBody NewRelicFetchRequest newRelicFetchRequest,
67+
@Parameter(
68+
description =
69+
"The scope of the NewRelic query. e.g. autoscaling_group:myapp-prod-v002")
6770
@RequestParam(required = false)
6871
String scope,
69-
@ApiParam(value = "The location of the NewRelic query. e.g. us-west-2")
72+
@Parameter(description = "The location of the NewRelic query. e.g. us-west-2")
7073
@RequestParam(required = false)
7174
String location,
72-
@ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam
75+
@Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam
7376
String start,
74-
@ApiParam(value = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam
77+
@Parameter(description = "An ISO format timestamp, e.g.: 2018-03-15T01:23:45Z") @RequestParam
7578
String end,
76-
@ApiParam(defaultValue = "60", value = "seconds") @RequestParam Long step,
77-
@ApiParam(defaultValue = "0", value = "canary config metrics index")
79+
@Parameter(example = "60", description = "seconds") @RequestParam Long step,
80+
@Parameter(schema = @Schema(defaultValue = "0"), description = "canary config metrics index")
7881
@RequestParam(required = false)
7982
Integer metricIndex,
80-
@ApiParam(defaultValue = "false") @RequestParam(required = false) final boolean dryRun)
83+
@Parameter(schema = @Schema(defaultValue = "false")) @RequestParam(required = false)
84+
final boolean dryRun)
8185
throws IOException {
8286

8387
// Apply defaults.

0 commit comments

Comments
 (0)