From ad190cf9a5c0dfabbda6a5ed2f0cfabd242b2eb9 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Fri, 12 Apr 2024 13:25:46 -0700 Subject: [PATCH] Java code sample improved for endpoints, version changed to 4.2.1 (#423) * Java endpoint code samples updated * Version updated to 4.2.1 --- pom.xml | 2 +- .../apis/paths/Fakemultipleresponsebodies.md | 8 +++---- .../docs/apis/paths/Fakewildcardresponses.md | 16 ++++++------- .../petstore/java/docs/apis/tags/Fake.md | 24 +++++++++---------- .../FakemultipleresponsebodiesGet.md | 8 +++---- .../FakewildcardresponsesGet.md | 16 ++++++------- .../path/verb/_OperationDocCodeSample.hbs | 6 +++-- 7 files changed, 41 insertions(+), 39 deletions(-) diff --git a/pom.xml b/pom.xml index 0895436d3dd..099238379f8 100644 --- a/pom.xml +++ b/pom.xml @@ -446,7 +446,7 @@ - 4.2.0 + 4.2.1 UTF-8 11 diff --git a/samples/client/petstore/java/docs/apis/paths/Fakemultipleresponsebodies.md b/samples/client/petstore/java/docs/apis/paths/Fakemultipleresponsebodies.md index 71f6ad6a82e..8b1bd750cd5 100644 --- a/samples/client/petstore/java/docs/apis/paths/Fakemultipleresponsebodies.md +++ b/samples/client/petstore/java/docs/apis/paths/Fakemultipleresponsebodies.md @@ -98,12 +98,12 @@ try { throw e; } if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { -FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else { FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; -FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } ``` [[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/java/docs/apis/paths/Fakewildcardresponses.md b/samples/client/petstore/java/docs/apis/paths/Fakewildcardresponses.md index 1cc837aac8d..63b99413ddb 100644 --- a/samples/client/petstore/java/docs/apis/paths/Fakewildcardresponses.md +++ b/samples/client/petstore/java/docs/apis/paths/Fakewildcardresponses.md @@ -105,18 +105,18 @@ try { throw e; } if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { -FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { -FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { -FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else { FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; -FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } ``` [[Back to top]](#top) [[Back to README]](../../../README.md) diff --git a/samples/client/petstore/java/docs/apis/tags/Fake.md b/samples/client/petstore/java/docs/apis/tags/Fake.md index 0ab9ed08dff..69b4c83b6d9 100644 --- a/samples/client/petstore/java/docs/apis/tags/Fake.md +++ b/samples/client/petstore/java/docs/apis/tags/Fake.md @@ -776,18 +776,18 @@ try { throw e; } if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { -FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { -FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { -FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else { FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; -FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } ``` ### bodyWithQueryParams @@ -3728,12 +3728,12 @@ try { throw e; } if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { -FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else { FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; -FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } ``` ### responseWithoutSchema diff --git a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md index f95220fcb65..dc5be34e68f 100644 --- a/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md +++ b/samples/client/petstore/java/docs/paths/fakemultipleresponsebodies/FakemultipleresponsebodiesGet.md @@ -91,12 +91,12 @@ try { throw e; } if (response instanceof FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode200Response castResponse) { -FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else { FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response castResponse = (FakemultipleresponsebodiesGetResponses.EndpointFakemultipleresponsebodiesGetCode202Response) response; -FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody deserializedBody = (FakemultipleresponsebodiesGetCode202Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } ``` ### Constructor Summary diff --git a/samples/client/petstore/java/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md b/samples/client/petstore/java/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md index 63c02dda3dd..f0e232db0bd 100644 --- a/samples/client/petstore/java/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md +++ b/samples/client/petstore/java/docs/paths/fakewildcardresponses/FakewildcardresponsesGet.md @@ -98,18 +98,18 @@ try { throw e; } if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode1XXResponse castResponse) { -FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode1XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode2XXResponse castResponse) { -FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode2XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else if (response instanceof FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode200Response castResponse) { -FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode200Response.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } else { FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse castResponse = (FakewildcardresponsesGetResponses.EndpointFakewildcardresponsesGetCode3XXResponse) response; -FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; -// handle deserialized body here + FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody deserializedBody = (FakewildcardresponsesGetCode3XXResponse.ApplicationjsonResponseBody) castResponse.body; + // handle deserialized body here } ``` ### Constructor Summary diff --git a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs index 75914534712..b52fe3e72ae 100644 --- a/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs +++ b/src/main/resources/java/src/main/java/packagename/paths/path/verb/_OperationDocCodeSample.hbs @@ -259,10 +259,12 @@ if (response instanceof {{responses.jsonPathPiece.pascalCase}}.Endpoint{{jsonPat {{/if}} {{/if}} {{#if hasContentSchema}} -{{> src/main/java/packagename/paths/path/verb/_OperationDocResBodyCodeSample }} + {{> src/main/java/packagename/paths/path/verb/_OperationDocResBodyCodeSample }} {{/if}} - {{/each}} + {{#if @last}} } + {{/if}} + {{/each}} {{/eq}} {{/if}} ``` \ No newline at end of file