diff --git a/.github/workflows/auto-commit-client-updates.yml b/.github/workflows/auto-commit-client-updates.yml new file mode 100644 index 0000000..81586a6 --- /dev/null +++ b/.github/workflows/auto-commit-client-updates.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Auto commit client updates + +on: + workflow_dispatch: + push: + branches: [ "**" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + + - name: Set git user and generate files + run: | + git config --global user.name 'equinix-labs@auto-commit-workflow' + git config --global user.email 'bot@equinix.noreply.github.com' + git config advice.addIgnoredFile false + git fetch + echo -e "\nThis is executing for branch: ${GITHUB_REF##*/}." + git checkout ${GITHUB_REF##*/} + make generate + + - name: Commit to branch. + run: | + git add . + echo -e "\nGit status:" + echo `git status` + cdate=`date` + cmsg="Auto commit generated client changes - $cdate" + echo -e "\nCommit message created : $cmsg" + echo -e "\nCommitting if there are files to update in client dir:" + echo `git commit -m "$cmsg"` + echo `git push` diff --git a/equinix-openapi-fabric/src/main/java/com/equinix/openapi/fabric/JSON.java b/equinix-openapi-fabric/src/main/java/com/equinix/openapi/fabric/JSON.java index 0de995c..6bec3d0 100644 --- a/equinix-openapi-fabric/src/main/java/com/equinix/openapi/fabric/JSON.java +++ b/equinix-openapi-fabric/src/main/java/com/equinix/openapi/fabric/JSON.java @@ -446,9 +446,9 @@ public static String serialize(Object obj) { /** * Deserialize the given JSON string to Java object. - * - * @param Type - * @param body The JSON string +* +* @param Type + * @param body The JSON string * @param returnType The type to deserialize into * @return The deserialized Java object */ @@ -458,7 +458,7 @@ public static T deserialize(String body, Type returnType) { if (isLenientOnJson) { JsonReader jsonReader = new JsonReader(new StringReader(body)); // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) - jsonReader.setLenient(true); + jsonReader.setLenient(true); return gson.fromJson(jsonReader, returnType); } else { return gson.fromJson(body, returnType); @@ -468,11 +468,11 @@ public static T deserialize(String body, Type returnType) { // return the response body string directly for the String return type; if (returnType.equals(String.class)) { return (T) body; - } else { - throw (e); - } + } else { + throw (e); + } + } } - } /** * Gson TypeAdapter for Byte Array type @@ -484,7 +484,7 @@ public void write(JsonWriter out, byte[] value) throws IOException { if (value == null) { out.nullValue(); } else { - out.value(ByteString.of(value).base64()); + out.value(ByteString.of(value).base64()); } } @@ -507,11 +507,11 @@ public byte[] read(JsonReader in) throws IOException { */ public static class OffsetDateTimeTypeAdapter extends TypeAdapter { - private DateTimeFormatter formatter; + private DateTimeFormatter formatter; - public OffsetDateTimeTypeAdapter() { - this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); - } + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { this.formatter = formatter; @@ -553,9 +553,9 @@ public static class LocalDateTypeAdapter extends TypeAdapter { private DateTimeFormatter formatter; - public LocalDateTypeAdapter() { - this(DateTimeFormatter.ISO_LOCAL_DATE); - } + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } public LocalDateTypeAdapter(DateTimeFormatter formatter) { this.formatter = formatter;