Skip to content

Commit

Permalink
Tweak codegen logic for formatting, documentation and handling of any…
Browse files Browse the repository at this point in the history
…Of (#1152)

* Re-generate code

Signed-off-by: Thomas Farr <[email protected]>

* Improve builder doc comments

Signed-off-by: Thomas Farr <[email protected]>

* Fix list/map isDefined serialize logic

Signed-off-by: Thomas Farr <[email protected]>

* Add support for deprecated enums

Signed-off-by: Thomas Farr <[email protected]>

* Improve isDefined logic

Signed-off-by: Thomas Farr <[email protected]>

* Allow overriding request/response naming

Signed-off-by: Thomas Farr <[email protected]>

* Support anyOf

Signed-off-by: Thomas Farr <[email protected]>

* Update spec

Signed-off-by: Thomas Farr <[email protected]>

* spotlessApply

Signed-off-by: Thomas Farr <[email protected]>

---------

Signed-off-by: Thomas Farr <[email protected]>
  • Loading branch information
Xtansia authored Aug 22, 2024
1 parent c84ad24 commit 7b954af
Show file tree
Hide file tree
Showing 29 changed files with 3,097 additions and 933 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("acknowledged");
generator.write(this.acknowledged);

}

// ---------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public final String type() {
}

/**
* Additional details about the error
* Additional details about the error.
*/
public final Map<String, JsonData> metadata() {
return this.metadata;
Expand All @@ -168,52 +168,42 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
for (Map.Entry<String, JsonData> item0 : this.metadata.entrySet()) {
generator.writeKey(item0.getKey());
item0.getValue().serialize(generator, mapper);

}

if (this.causedBy != null) {
generator.writeKey("caused_by");
this.causedBy.serialize(generator, mapper);

}

if (this.reason != null) {
generator.writeKey("reason");
generator.write(this.reason);

}

if (ApiTypeHelper.isDefined(this.rootCause)) {
generator.writeKey("root_cause");
generator.writeStartArray();
for (ErrorCause item0 : this.rootCause) {
item0.serialize(generator, mapper);

}
generator.writeEnd();

}

if (this.stackTrace != null) {
generator.writeKey("stack_trace");
generator.write(this.stackTrace);

}

if (ApiTypeHelper.isDefined(this.suppressed)) {
generator.writeKey("suppressed");
generator.writeStartArray();
for (ErrorCause item0 : this.suppressed) {
item0.serialize(generator, mapper);

}
generator.writeEnd();

}

generator.writeKey("type");
generator.write(this.type);

}

// ---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -355,15 +345,23 @@ public final Builder type(String value) {
}

/**
* Additional details about the error
* Additional details about the error.
*
* <p>
* Adds all elements of <code>map</code> to <code>metadata</code>.
* </p>
*/
public final Builder metadata(Map<String, JsonData> map) {
this.metadata = _mapPutAll(this.metadata, map);
return this;
}

/**
* Additional details about the error
* Additional details about the error.
*
* <p>
* Adds an entry to <code>metadata</code>.
* </p>
*/
public final Builder metadata(String key, JsonData value) {
this.metadata = _mapPut(this.metadata, key, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartArray();
for (ErrorCause item0 : this.failures) {
item0.serialize(generator, mapper);

}
generator.writeEnd();

}

generator.writeKey("successful");
generator.write(this.successful);

generator.writeKey("total");
generator.write(this.total);

}

// ---------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (this.buildFlavor != null) {
generator.writeKey("build_flavor");
generator.write(this.buildFlavor);

}

generator.writeKey("build_hash");
Expand All @@ -218,7 +217,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("number");
generator.write(this.number);

}

// ---------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("version");
this.version.serialize(generator, mapper);

}

// ---------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,23 +118,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (this.clusterName != null) {
generator.writeKey("cluster_name");
generator.write(this.clusterName);

}

generator.writeKey("dangling_indices");
generator.writeStartArray();
for (DanglingIndex item0 : this.danglingIndices) {
item0.serialize(generator, mapper);

}
generator.writeEnd();

if (this.nodes != null) {
generator.writeKey("_nodes");
this.nodes.serialize(generator, mapper);

}

}

// ---------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
if (this.creationDate != null) {
generator.writeKey("creation_date");
generator.write(this.creationDate);

}

generator.writeKey("creation_date_millis");
Expand All @@ -148,10 +147,8 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeStartArray();
for (String item0 : this.nodeIds) {
generator.write(item0);

}
generator.writeEnd();

}

// ---------------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 7b954af

Please sign in to comment.