Browse Source
Copied the PSSaaS approach, did try inheritance on the `git` class for `scanChainGit` but caused problems with deserialization not matching `Component` so hack was to duplicate it, will need to sort out the structures at some point see #1118-scanchain-endpoint
4 changed files with 97 additions and 1 deletions
@ -1,4 +1,35 @@ |
|||||||
package com.redhat.pctsec.model.api.request; |
package com.redhat.pctsec.model.api.request; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||||
|
import com.fasterxml.jackson.annotation.JsonPropertyDescription; |
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
||||||
|
import jakarta.validation.Valid; |
||||||
|
import jakarta.validation.constraints.NotNull; |
||||||
|
import jakarta.validation.constraints.Size; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
|
||||||
public class scanChain { |
public class scanChain { |
||||||
|
|
||||||
|
@JsonProperty("product_name") |
||||||
|
@JsonPropertyDescription("The product name associated with the scan.") |
||||||
|
@NotNull |
||||||
|
public String productName; |
||||||
|
|
||||||
|
@JsonProperty("urls") |
||||||
|
@JsonDeserialize(as = java.util.LinkedHashSet.class) |
||||||
|
@JsonPropertyDescription("List of source urls to be scanned") |
||||||
|
@Size(min = 1) |
||||||
|
@Valid |
||||||
|
@NotNull |
||||||
|
public Set<scanChainGit> urls; |
||||||
|
|
||||||
|
@JsonProperty("requestor") |
||||||
|
@JsonPropertyDescription("The requesting user") |
||||||
|
@NotNull |
||||||
|
public String requestor; |
||||||
} |
} |
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,34 @@ |
|||||||
|
package com.redhat.pctsec.model.api.request; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||||
|
import jakarta.validation.constraints.NotNull; |
||||||
|
|
||||||
|
import java.net.URI; |
||||||
|
|
||||||
|
|
||||||
|
public class scanChainGit { |
||||||
|
|
||||||
|
|
||||||
|
private URI repo; |
||||||
|
private String ref; |
||||||
|
public scanChainGit(@NotNull URI repo, @NotNull String ref) { |
||||||
|
this.repo = repo; |
||||||
|
this.ref = ref; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@NotNull |
||||||
|
@JsonProperty("url") |
||||||
|
public URI getRepo() { |
||||||
|
return this.repo; |
||||||
|
} |
||||||
|
|
||||||
|
@NotNull |
||||||
|
@JsonProperty("branch") |
||||||
|
public String getRef() { |
||||||
|
|
||||||
|
return this.ref; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue