Skip to content

Commit

Permalink
fix(api): fix type mismatch regression with Pipeline boolean properti…
Browse files Browse the repository at this point in the history
…es (#1046)
  • Loading branch information
mochacat committed Jul 23, 2021
1 parent 32eafa5 commit b082bae
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class Pipeline implements Timestamped {
private String lastModified;

@Getter @Setter private String email;
@Getter @Setter private Boolean disabled;
@Getter @Setter private String disabled;
@Getter @Setter private Map<String, Object> template;
@Getter @Setter private List<String> roles;
@Getter @Setter private String serviceAccount;
Expand All @@ -51,8 +51,8 @@ public class Pipeline implements Timestamped {
@Getter @Setter private List<Map<String, Object>> stages;
@Getter @Setter private Map<String, Object> constraints;
@Getter @Setter private Map<String, Object> payloadConstraints;
@Getter @Setter private Boolean keepWaitingPipelines;
@Getter @Setter private Boolean limitConcurrent;
@Getter @Setter private String keepWaitingPipelines;
@Getter @Setter private String limitConcurrent;
@Getter @Setter private List<Map<String, Object>> parameterConfig;
@Getter @Setter private String spelEvaluator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public abstract class PipelineMixins {
@JsonInclude(Include.NON_NULL)
@Getter
@Setter
private Boolean disabled;
private String disabled;

@JsonInclude(Include.NON_NULL)
@Getter
Expand Down Expand Up @@ -137,12 +137,12 @@ public abstract class PipelineMixins {
@JsonInclude(Include.NON_NULL)
@Getter
@Setter
private Boolean keepWaitingPipelines;
private String keepWaitingPipelines;

@JsonInclude(Include.NON_NULL)
@Getter
@Setter
private Boolean limitConcurrent;
private String limitConcurrent;

@JsonInclude(Include.NON_NULL)
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ class PipelineSpec extends Specification {
pipeline == pipelineJSON
}

def 'boolean properties should be strings'() {
given:
String pipelineJSON = '{"id":"1","schema":"1","triggers":[],"disabled":"true","keepWaitingPipelines":"true","limitConcurrent":"true"}'
Pipeline pipelineObj = objectMapper.readValue(pipelineJSON, Pipeline.class)
String pipeline = objectMapper.writeValueAsString(pipelineObj)

expect:
pipeline == pipelineJSON
}

def 'should grab triggers after deserializing JSON into Pipeline'() {
given:
String pipelineJSON = '{"triggers": [{"type": "cron", "id": "a"}, {"type": "cron", "id": "b"}]}'
Expand Down

0 comments on commit b082bae

Please sign in to comment.