Skip to content

Commit

Permalink
refactor: openshift-model-console generated from OpenAPI schemas
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored Oct 1, 2024
1 parent 6406b88 commit 7ee6a4c
Show file tree
Hide file tree
Showing 42 changed files with 207 additions and 1,433 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ func resolveType(typ *types.Type) string {
isList := false
isObject := false
for _, m := range typ.Members {
if m.Type.Name == listMeta {
if m.Embedded == true && m.Type.Name == listMeta {
isList = true
// stop iterating, if it's a list then it's not an object
break
} else if m.Type.Name == typeMeta {
} else if m.Embedded == true && m.Type.Name == typeMeta {
isObject = true
// keep iterating, maybe it's a list
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34178,7 +34178,7 @@
}
},
"x-fabric8-info": {
"Type": "object",
"Type": "nested",
"Group": "console.openshift.io",
"Version": "v1",
"Kind": "ConsoleYAMLSampleSpec",
Expand Down
6 changes: 1 addition & 5 deletions kubernetes-model-generator/openshift-model-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,8 @@
<configuration >
<settings combine.self="append">
<schemas>
<schema>${openapi.schema.openshift-latest}</schema>
<schema>${openapi.schema.openshift-generated}</schema>
</schemas>
<packageMappings combine.self="append">
<io.k8s.api>io.fabric8.kubernetes.api.model</io.k8s.api>
<io.openshift.console>io.fabric8.openshift.api.model.console</io.openshift.console>
</packageMappings>
<includeGenerationRegexes>
<includeGenerationRegex>^io\.openshift\.console\..*$</includeGenerationRegex>
</includeGenerationRegexes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
@BuildableReference(PersistentVolumeClaim.class)
})
@Generated("jsonschema2pojo")
public class ConsoleLinkSpecApplicationMenu implements Editable<ConsoleLinkSpecApplicationMenuBuilder> , KubernetesResource
public class ApplicationMenuSpec implements Editable<ApplicationMenuSpecBuilder> , KubernetesResource
{

@JsonProperty("imageURL")
Expand All @@ -66,10 +66,10 @@ public class ConsoleLinkSpecApplicationMenu implements Editable<ConsoleLinkSpecA
* No args constructor for use in serialization
*
*/
public ConsoleLinkSpecApplicationMenu() {
public ApplicationMenuSpec() {
}

public ConsoleLinkSpecApplicationMenu(String imageURL, String section) {
public ApplicationMenuSpec(String imageURL, String section) {
super();
this.imageURL = imageURL;
this.section = section;
Expand All @@ -96,12 +96,12 @@ public void setSection(String section) {
}

@JsonIgnore
public ConsoleLinkSpecApplicationMenuBuilder edit() {
return new ConsoleLinkSpecApplicationMenuBuilder(this);
public ApplicationMenuSpecBuilder edit() {
return new ApplicationMenuSpecBuilder(this);
}

@JsonIgnore
public ConsoleLinkSpecApplicationMenuBuilder toBuilder() {
public ApplicationMenuSpecBuilder toBuilder() {
return edit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
@BuildableReference(PersistentVolumeClaim.class)
})
@Generated("jsonschema2pojo")
public class ConsoleCLIDownloadSpecLinks implements Editable<ConsoleCLIDownloadSpecLinksBuilder> , KubernetesResource
public class CLIDownloadLink implements Editable<CLIDownloadLinkBuilder> , KubernetesResource
{

@JsonProperty("href")
Expand All @@ -66,10 +66,10 @@ public class ConsoleCLIDownloadSpecLinks implements Editable<ConsoleCLIDownloadS
* No args constructor for use in serialization
*
*/
public ConsoleCLIDownloadSpecLinks() {
public CLIDownloadLink() {
}

public ConsoleCLIDownloadSpecLinks(String href, String text) {
public CLIDownloadLink(String href, String text) {
super();
this.href = href;
this.text = text;
Expand All @@ -96,12 +96,12 @@ public void setText(String text) {
}

@JsonIgnore
public ConsoleCLIDownloadSpecLinksBuilder edit() {
return new ConsoleCLIDownloadSpecLinksBuilder(this);
public CLIDownloadLinkBuilder edit() {
return new CLIDownloadLinkBuilder(this);
}

@JsonIgnore
public ConsoleCLIDownloadSpecLinksBuilder toBuilder() {
public CLIDownloadLinkBuilder toBuilder() {
return edit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class ConsoleCLIDownloadSpec implements Editable<ConsoleCLIDownloadSpecBu
private String displayName;
@JsonProperty("links")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<ConsoleCLIDownloadSpecLinks> links = new ArrayList<>();
private List<CLIDownloadLink> links = new ArrayList<>();
@JsonIgnore
private Map<String, Object> additionalProperties = new LinkedHashMap<String, Object>();

Expand All @@ -75,7 +75,7 @@ public class ConsoleCLIDownloadSpec implements Editable<ConsoleCLIDownloadSpecBu
public ConsoleCLIDownloadSpec() {
}

public ConsoleCLIDownloadSpec(String description, String displayName, List<ConsoleCLIDownloadSpecLinks> links) {
public ConsoleCLIDownloadSpec(String description, String displayName, List<CLIDownloadLink> links) {
super();
this.description = description;
this.displayName = displayName;
Expand Down Expand Up @@ -104,12 +104,12 @@ public void setDisplayName(String displayName) {

@JsonProperty("links")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public List<ConsoleCLIDownloadSpecLinks> getLinks() {
public List<CLIDownloadLink> getLinks() {
return links;
}

@JsonProperty("links")
public void setLinks(List<ConsoleCLIDownloadSpecLinks> links) {
public void setLinks(List<CLIDownloadLink> links) {
this.links = links;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ public class ConsoleLinkSpec implements Editable<ConsoleLinkSpecBuilder> , Kuber
{

@JsonProperty("applicationMenu")
private ConsoleLinkSpecApplicationMenu applicationMenu;
private ApplicationMenuSpec applicationMenu;
@JsonProperty("href")
private String href;
@JsonProperty("location")
private String location;
@JsonProperty("namespaceDashboard")
private ConsoleLinkSpecNamespaceDashboard namespaceDashboard;
private NamespaceDashboardSpec namespaceDashboard;
@JsonProperty("text")
private String text;
@JsonIgnore
Expand All @@ -78,7 +78,7 @@ public class ConsoleLinkSpec implements Editable<ConsoleLinkSpecBuilder> , Kuber
public ConsoleLinkSpec() {
}

public ConsoleLinkSpec(ConsoleLinkSpecApplicationMenu applicationMenu, String href, String location, ConsoleLinkSpecNamespaceDashboard namespaceDashboard, String text) {
public ConsoleLinkSpec(ApplicationMenuSpec applicationMenu, String href, String location, NamespaceDashboardSpec namespaceDashboard, String text) {
super();
this.applicationMenu = applicationMenu;
this.href = href;
Expand All @@ -88,12 +88,12 @@ public ConsoleLinkSpec(ConsoleLinkSpecApplicationMenu applicationMenu, String hr
}

@JsonProperty("applicationMenu")
public ConsoleLinkSpecApplicationMenu getApplicationMenu() {
public ApplicationMenuSpec getApplicationMenu() {
return applicationMenu;
}

@JsonProperty("applicationMenu")
public void setApplicationMenu(ConsoleLinkSpecApplicationMenu applicationMenu) {
public void setApplicationMenu(ApplicationMenuSpec applicationMenu) {
this.applicationMenu = applicationMenu;
}

Expand All @@ -118,12 +118,12 @@ public void setLocation(String location) {
}

@JsonProperty("namespaceDashboard")
public ConsoleLinkSpecNamespaceDashboard getNamespaceDashboard() {
public NamespaceDashboardSpec getNamespaceDashboard() {
return namespaceDashboard;
}

@JsonProperty("namespaceDashboard")
public void setNamespaceDashboard(ConsoleLinkSpecNamespaceDashboard namespaceDashboard) {
public void setNamespaceDashboard(NamespaceDashboardSpec namespaceDashboard) {
this.namespaceDashboard = namespaceDashboard;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class ConsoleNotificationSpec implements Editable<ConsoleNotificationSpec
@JsonProperty("color")
private String color;
@JsonProperty("link")
private ConsoleNotificationSpecLink link;
private Link link;
@JsonProperty("location")
private String location;
@JsonProperty("text")
Expand All @@ -78,7 +78,7 @@ public class ConsoleNotificationSpec implements Editable<ConsoleNotificationSpec
public ConsoleNotificationSpec() {
}

public ConsoleNotificationSpec(String backgroundColor, String color, ConsoleNotificationSpecLink link, String location, String text) {
public ConsoleNotificationSpec(String backgroundColor, String color, Link link, String location, String text) {
super();
this.backgroundColor = backgroundColor;
this.color = color;
Expand Down Expand Up @@ -108,12 +108,12 @@ public void setColor(String color) {
}

@JsonProperty("link")
public ConsoleNotificationSpecLink getLink() {
public Link getLink() {
return link;
}

@JsonProperty("link")
public void setLink(ConsoleNotificationSpecLink link) {
public void setLink(Link link) {
this.link = link;
}

Expand Down
Loading

0 comments on commit 7ee6a4c

Please sign in to comment.