Skip to content

Commit

Permalink
feat(specs): only use shortname in the source input [skip-bc] (genera…
Browse files Browse the repository at this point in the history
…ted)

algolia/api-clients-automation#4287

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
algolia-bot and millotp committed Jan 8, 2025
1 parent 998f0ac commit bc18ca1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 195 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,23 @@
@JsonDeserialize(as = SourceDocker.class)
public class SourceDocker implements SourceInput {

@JsonProperty("imageType")
private DockerImageType imageType;

@JsonProperty("registry")
private DockerRegistry registry;

@JsonProperty("image")
private String image;

@JsonProperty("version")
private String version;

@JsonProperty("configuration")
private Object configuration;

public SourceDocker setImageType(DockerImageType imageType) {
this.imageType = imageType;
return this;
}

/** Get imageType */
@javax.annotation.Nonnull
public DockerImageType getImageType() {
return imageType;
}

public SourceDocker setRegistry(DockerRegistry registry) {
this.registry = registry;
return this;
}

/** Get registry */
@javax.annotation.Nonnull
public DockerRegistry getRegistry() {
return registry;
}

public SourceDocker setImage(String image) {
this.image = image;
return this;
}

/** Docker image name. */
/** Shortname of the image, as returned by the referential. */
@javax.annotation.Nonnull
public String getImage() {
return image;
}

public SourceDocker setVersion(String version) {
this.version = version;
return this;
}

/** Docker image version. */
@javax.annotation.Nullable
public String getVersion() {
return version;
}

public SourceDocker setConfiguration(Object configuration) {
this.configuration = configuration;
return this;
Expand All @@ -90,28 +48,19 @@ public boolean equals(Object o) {
return false;
}
SourceDocker sourceDocker = (SourceDocker) o;
return (
Objects.equals(this.imageType, sourceDocker.imageType) &&
Objects.equals(this.registry, sourceDocker.registry) &&
Objects.equals(this.image, sourceDocker.image) &&
Objects.equals(this.version, sourceDocker.version) &&
Objects.equals(this.configuration, sourceDocker.configuration)
);
return Objects.equals(this.image, sourceDocker.image) && Objects.equals(this.configuration, sourceDocker.configuration);
}

@Override
public int hashCode() {
return Objects.hash(imageType, registry, image, version, configuration);
return Objects.hash(image, configuration);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SourceDocker {\n");
sb.append(" imageType: ").append(toIndentedString(imageType)).append("\n");
sb.append(" registry: ").append(toIndentedString(registry)).append("\n");
sb.append(" image: ").append(toIndentedString(image)).append("\n");
sb.append(" version: ").append(toIndentedString(version)).append("\n");
sb.append(" configuration: ").append(toIndentedString(configuration)).append("\n");
sb.append("}");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ class Deserializer extends JsonDeserializer<SourceInput> {
@Override
public SourceInput deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonNode tree = jp.readValueAsTree();
// deserialize SourceDocker
if (tree.isObject() && tree.has("registry") && tree.has("image") && tree.has("imageType") && tree.has("configuration")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(SourceDocker.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf SourceDocker (error: " + e.getMessage() + ") (type: SourceDocker)");
}
}
// deserialize SourceGA4BigQueryExport
if (tree.isObject() && tree.has("projectID") && tree.has("datasetID") && tree.has("tablePrefix")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
Expand All @@ -41,6 +32,15 @@ public SourceInput deserialize(JsonParser jp, DeserializationContext ctxt) throw
);
}
}
// deserialize SourceDocker
if (tree.isObject() && tree.has("image") && tree.has("configuration")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
return parser.readValueAs(SourceDocker.class);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf SourceDocker (error: " + e.getMessage() + ") (type: SourceDocker)");
}
}
// deserialize SourceCommercetools
if (tree.isObject() && tree.has("projectKey")) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,9 @@
@JsonDeserialize(as = SourceUpdateDocker.class)
public class SourceUpdateDocker implements SourceUpdateInput {

@JsonProperty("registry")
private DockerRegistry registry;

@JsonProperty("image")
private String image;

@JsonProperty("version")
private String version;

@JsonProperty("configuration")
private Object configuration;

public SourceUpdateDocker setRegistry(DockerRegistry registry) {
this.registry = registry;
return this;
}

/** Get registry */
@javax.annotation.Nullable
public DockerRegistry getRegistry() {
return registry;
}

public SourceUpdateDocker setImage(String image) {
this.image = image;
return this;
}

/** Docker image name. */
@javax.annotation.Nullable
public String getImage() {
return image;
}

public SourceUpdateDocker setVersion(String version) {
this.version = version;
return this;
}

/** Docker image version. */
@javax.annotation.Nullable
public String getVersion() {
return version;
}

public SourceUpdateDocker setConfiguration(Object configuration) {
this.configuration = configuration;
return this;
Expand All @@ -76,26 +34,18 @@ public boolean equals(Object o) {
return false;
}
SourceUpdateDocker sourceUpdateDocker = (SourceUpdateDocker) o;
return (
Objects.equals(this.registry, sourceUpdateDocker.registry) &&
Objects.equals(this.image, sourceUpdateDocker.image) &&
Objects.equals(this.version, sourceUpdateDocker.version) &&
Objects.equals(this.configuration, sourceUpdateDocker.configuration)
);
return Objects.equals(this.configuration, sourceUpdateDocker.configuration);
}

@Override
public int hashCode() {
return Objects.hash(registry, image, version, configuration);
return Objects.hash(configuration);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SourceUpdateDocker {\n");
sb.append(" registry: ").append(toIndentedString(registry)).append("\n");
sb.append(" image: ").append(toIndentedString(image)).append("\n");
sb.append(" version: ").append(toIndentedString(version)).append("\n");
sb.append(" configuration: ").append(toIndentedString(configuration)).append("\n");
sb.append("}");
return sb.toString();
Expand Down

0 comments on commit bc18ca1

Please sign in to comment.