Skip to content

Commit

Permalink
Merge pull request #9 from statisticsnorway/add-descriptions
Browse files Browse the repository at this point in the history
Add description and requirements for maxLength and patterns
  • Loading branch information
johnksv authored Jan 18, 2024
2 parents 1af1ccc + fbcbd0c commit 8982fff
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class TeamInfoMetadataSchema implements Serializable
*/
@JsonProperty("team_name")
@JsonPropertyDescription("The (uniform) name of this team")
@Size(min = 1)
@Size(min = 1, max = 16)
private String teamName;
/**
* Name of this resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ public class ArtifactRegistry implements Serializable
@Valid
private List<String> formats = new ArrayList<String>();
/**
* A list of github repos that should be able to push to artifact registry
* A list of github repositories under Statistics Norway-organisation that is allowed to push to Artifact Registry repositories of the team.
*
*/
@JsonProperty("repos")
@JsonPropertyDescription("A list of github repos that should be able to push to artifact registry")
@JsonPropertyDescription("A list of github repositories under Statistics Norway-organisation that is allowed to push to Artifact Registry repositories of the team.")
@Valid
private List<Object> repos = new ArrayList<Object>();
private List<String> repos = new ArrayList<String>();
@JsonIgnore
@Valid
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();
private final static long serialVersionUID = -7592682883344824911L;
private final static long serialVersionUID = -2223012852394825404L;

/**
* No args constructor for use in serialization
Expand All @@ -58,9 +58,9 @@ public ArtifactRegistry() {
* @param formats
* Set of formats - in upper case- to create artifact registries for, as defined in https://cloud.google.com/artifact-registry/docs/supported-formats . Examples is DOCKER, PYTHON.
* @param repos
* A list of github repos that should be able to push to artifact registry.
* A list of github repositories under Statistics Norway-organisation that is allowed to push to Artifact Registry repositories of the team.
*/
public ArtifactRegistry(List<String> formats, List<Object> repos) {
public ArtifactRegistry(List<String> formats, List<String> repos) {
super();
this.formats = formats;
this.repos = repos;
Expand Down Expand Up @@ -89,20 +89,20 @@ public void setFormats(List<String> formats) {
}

/**
* A list of github repos that should be able to push to artifact registry
* A list of github repositories under Statistics Norway-organisation that is allowed to push to Artifact Registry repositories of the team.
*
*/
@JsonProperty("repos")
public List<Object> getRepos() {
public List<String> getRepos() {
return repos;
}

/**
* A list of github repos that should be able to push to artifact registry
* A list of github repositories under Statistics Norway-organisation that is allowed to push to Artifact Registry repositories of the team.
*
*/
@JsonProperty("repos")
public void setRepos(List<Object> repos) {
public void setRepos(List<String> repos) {
this.repos = repos;
}

Expand Down Expand Up @@ -170,7 +170,7 @@ public ArtifactRegistryBuilder() {
super();
}

public ArtifactRegistryBuilder(List<String> formats, List<Object> repos) {
public ArtifactRegistryBuilder(List<String> formats, List<String> repos) {
super(formats, repos);
}

Expand All @@ -189,7 +189,7 @@ public ArtifactRegistryBuilderBase() {
}

@SuppressWarnings("unchecked")
public ArtifactRegistryBuilderBase(List<String> formats, List<Object> repos) {
public ArtifactRegistryBuilderBase(List<String> formats, List<String> repos) {
// Skip initialization when called from subclass
if (this.getClass().equals(ArtifactRegistry.ArtifactRegistryBuilder.class)) {
this.instance = ((T) new ArtifactRegistry(formats, repos));
Expand All @@ -208,7 +208,7 @@ public ArtifactRegistry.ArtifactRegistryBuilderBase withFormats(List<String> for
return this;
}

public ArtifactRegistry.ArtifactRegistryBuilderBase withRepos(List<Object> repos) {
public ArtifactRegistry.ArtifactRegistryBuilderBase withRepos(List<String> repos) {
((ArtifactRegistry) this.instance).repos = repos;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class Atlantis implements Serializable
@NotNull
private String name;
/**
* Which repositories the team atlantis will monitor
* Which repositories under Statistics Norway-organisation this team atlantis instance will monitor.
*
*/
@JsonProperty("repos")
@JsonPropertyDescription("Which repositories the team atlantis will monitor")
@JsonPropertyDescription("Which repositories under Statistics Norway-organisation this team atlantis instance will monitor.")
@Valid
private List<String> repos = new ArrayList<String>();
@JsonIgnore
Expand All @@ -58,7 +58,7 @@ public Atlantis() {
/**
*
* @param repos
* Which repositories the team atlantis will monitor.
* Which repositories under Statistics Norway-organisation this team atlantis instance will monitor.
* @param name
* The name of the atlantis instance.
*/
Expand Down Expand Up @@ -93,7 +93,7 @@ public void setName(String name) {
}

/**
* Which repositories the team atlantis will monitor
* Which repositories under Statistics Norway-organisation this team atlantis instance will monitor.
*
*/
@JsonProperty("repos")
Expand All @@ -102,7 +102,7 @@ public List<String> getRepos() {
}

/**
* Which repositories the team atlantis will monitor
* Which repositories under Statistics Norway-organisation this team atlantis instance will monitor.
*
*/
@JsonProperty("repos")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;


/**
Expand Down Expand Up @@ -43,6 +44,7 @@ public class KubenTeamDefinition implements Serializable
*/
@JsonProperty("uniform_name")
@Pattern(regexp = "^[a-z-]*$")
@Size(max = 16)
@NotNull
private String uniformName;
/**
Expand Down
3 changes: 2 additions & 1 deletion src/partials/v1/team-info-metadata.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"team_name": {
"description": "The (uniform) name of this team",
"type": "string",
"minLength": 1
"minLength": 1,
"maxLength": 16
},
"name": {
"description": "Name of this resource",
Expand Down
14 changes: 10 additions & 4 deletions src/v1/kuben-team-definition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"properties": {
"uniform_name": {
"type": "string",
"pattern": "^[a-z-]*$"
"pattern": "^[a-z-]*$",
"maxLength": 16
},
"display_name": {
"type": "string",
Expand Down Expand Up @@ -82,9 +83,10 @@
},
"repos": {
"type": "array",
"description": "Which repositories the team atlantis will monitor",
"description": "Which repositories under Statistics Norway-organisation this team atlantis instance will monitor.",
"items": {
"type": "string"
"type": "string",
"pattern": "^[a-zA-Z-_.0-9]*$"
}
}
}
Expand All @@ -102,7 +104,11 @@
},
"repos": {
"type": "array",
"description": "A list of github repos that should be able to push to artifact registry"
"description": "A list of github repositories under Statistics Norway-organisation that is allowed to push to Artifact Registry repositories of the team.",
"items": {
"type": "string",
"pattern": "^[a-zA-Z-_.0-9]*$"
}
}
}
}
Expand Down

0 comments on commit 8982fff

Please sign in to comment.