Skip to content

Commit

Permalink
tsp, bug fix on kind (doc) and patch (#2625)
Browse files Browse the repository at this point in the history
  • Loading branch information
weidongxu-microsoft authored Mar 18, 2024
1 parent 922eef6 commit ec6c18e
Show file tree
Hide file tree
Showing 41 changed files with 222 additions and 218 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public PagedFlux<BinaryData> getOperations(RequestOptions requestOptions) {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* kind: String (Optional)
* kind: String (Required)
* operationId: String (Required)
* status: String(notStarted/running/failed/succeeded/canceled) (Required)
* percentCompleted: Integer (Optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ public PagedIterable<BinaryData> getOperations(RequestOptions requestOptions) {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* kind: String (Optional)
* kind: String (Required)
* operationId: String (Required)
* status: String(notStarted/running/failed/succeeded/canceled) (Required)
* percentCompleted: Integer (Optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,7 @@ public PagedIterable<BinaryData> getOperations(RequestOptions requestOptions) {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* kind: String (Optional)
* kind: String (Required)
* operationId: String (Required)
* status: String(notStarted/running/failed/succeeded/canceled) (Required)
* percentCompleted: Integer (Optional)
Expand Down Expand Up @@ -1805,7 +1805,7 @@ public Mono<Response<BinaryData>> getOperationWithResponseAsync(String operation
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* kind: String (Optional)
* kind: String (Required)
* operationId: String (Required)
* status: String(notStarted/running/failed/succeeded/canceled) (Required)
* percentCompleted: Integer (Optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ public ClientModel map(ObjectSchema compositeType) {
builder.needsFlatten(needsFlatten);
builder.imports(new ArrayList<>(modelImports));

final boolean isJsonMergePatch = usages.contains(ImplementationDetails.Usage.JSON_MERGE_PATCH);
final boolean mutablePropertyAsOptional = usages.contains(ImplementationDetails.Usage.JSON_MERGE_PATCH) && settings.isStreamStyleSerialization();
List<ClientModelPropertyReference> propertyReferences = new ArrayList<>();
for (Property property : compositeTypeProperties) {
ClientModelProperty modelProperty = Mappers.getModelPropertyMapper().map(property, isJsonMergePatch);
ClientModelProperty modelProperty = Mappers.getModelPropertyMapper().map(property, mutablePropertyAsOptional);
if (Objects.equals(polymorphicDiscriminator, modelProperty.getSerializedName())) {
// Discriminator is defined both as the discriminator and a property in the model.
// Make the discriminator property required if the property is required. But don't add the property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private static void bodySchemaJavadoc(IType type, JavaJavadocComment commentBloc
Map<String, ClientModelProperty> properties = new LinkedHashMap<>();
traverseProperties(model, properties);
for (ClientModelProperty property : properties.values()) {
bodySchemaJavadoc(property.getWireType(), commentBlock, nextIndent, property.getSerializedName(), typesInJavadoc, property.isRequired(), property.isRequiredForCreate(),false);
bodySchemaJavadoc(property.getWireType(), commentBlock, nextIndent, property.getSerializedName(), typesInJavadoc, property.isRequired() || property.isPolymorphicDiscriminator(), property.isRequiredForCreate(),false);
}
commentBlock.line(indent + "}");
} else if (typesInJavadoc.contains(type)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class FlattencomplexAsyncClient {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* kind: String(Kind1) (Optional)
* kind: String(Kind1) (Required)
* propB1: String (Optional)
* helper (Optional): {
* propBH1: String (Optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class FlattencomplexClient {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* kind: String(Kind1) (Optional)
* kind: String(Kind1) (Required)
* propB1: String (Optional)
* helper (Optional): {
* propBH1: String (Optional)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class PolymorphicrecursiveAsyncClient {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand All @@ -68,7 +68,7 @@ public Mono<Response<BinaryData>> getValidWithResponse(RequestOptions requestOpt
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class PolymorphicrecursiveClient {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand All @@ -67,7 +67,7 @@ public Response<BinaryData> getValidWithResponse(RequestOptions requestOptions)
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public final class PolymorphismAsyncClient {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand All @@ -68,7 +68,7 @@ public Mono<Response<BinaryData>> getValidWithResponse(RequestOptions requestOpt
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down Expand Up @@ -128,7 +128,7 @@ public Mono<Response<Void>> putValidWithResponse(BinaryData complexBody, Request
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* }
* }</pre>
Expand All @@ -152,7 +152,7 @@ public Mono<Response<BinaryData>> getDotSyntaxWithResponse(RequestOptions reques
* <pre>{@code
* {
* sampleSalmon (Optional): {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* location: String (Optional)
* iswild: Boolean (Optional)
Expand All @@ -161,7 +161,7 @@ public Mono<Response<BinaryData>> getDotSyntaxWithResponse(RequestOptions reques
* (recursive schema, see above)
* ]
* sampleFish (Optional): {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* }
* fishes (Optional): [
Expand Down Expand Up @@ -189,7 +189,7 @@ public Mono<Response<BinaryData>> getComposedWithDiscriminatorWithResponse(Reque
* <pre>{@code
* {
* sampleSalmon (Optional): {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* location: String (Optional)
* iswild: Boolean (Optional)
Expand All @@ -198,7 +198,7 @@ public Mono<Response<BinaryData>> getComposedWithDiscriminatorWithResponse(Reque
* (recursive schema, see above)
* ]
* sampleFish (Optional): {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* }
* fishes (Optional): [
Expand All @@ -225,12 +225,12 @@ public Mono<Response<BinaryData>> getComposedWithoutDiscriminatorWithResponse(Re
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
* (Optional){
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down Expand Up @@ -261,12 +261,12 @@ public Mono<Response<BinaryData>> getComplicatedWithResponse(RequestOptions requ
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
* (Optional){
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down Expand Up @@ -298,12 +298,12 @@ public Mono<Response<Void>> putComplicatedWithResponse(BinaryData complexBody, R
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
* (Optional){
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand All @@ -318,12 +318,12 @@ public Mono<Response<Void>> putComplicatedWithResponse(BinaryData complexBody, R
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
* (Optional){
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down Expand Up @@ -356,7 +356,7 @@ public Mono<Response<BinaryData>> putMissingDiscriminatorWithResponse(BinaryData
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class PolymorphismClient {
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand All @@ -67,7 +67,7 @@ public Response<BinaryData> getValidWithResponse(RequestOptions requestOptions)
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down Expand Up @@ -127,7 +127,7 @@ public Response<Void> putValidWithResponse(BinaryData complexBody, RequestOption
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* }
* }</pre>
Expand All @@ -151,7 +151,7 @@ public Response<BinaryData> getDotSyntaxWithResponse(RequestOptions requestOptio
* <pre>{@code
* {
* sampleSalmon (Optional): {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* location: String (Optional)
* iswild: Boolean (Optional)
Expand All @@ -160,7 +160,7 @@ public Response<BinaryData> getDotSyntaxWithResponse(RequestOptions requestOptio
* (recursive schema, see above)
* ]
* sampleFish (Optional): {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* }
* fishes (Optional): [
Expand Down Expand Up @@ -188,7 +188,7 @@ public Response<BinaryData> getComposedWithDiscriminatorWithResponse(RequestOpti
* <pre>{@code
* {
* sampleSalmon (Optional): {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* location: String (Optional)
* iswild: Boolean (Optional)
Expand All @@ -197,7 +197,7 @@ public Response<BinaryData> getComposedWithDiscriminatorWithResponse(RequestOpti
* (recursive schema, see above)
* ]
* sampleFish (Optional): {
* fish.type: String (Optional)
* fish.type: String (Required)
* species: String (Optional)
* }
* fishes (Optional): [
Expand All @@ -224,12 +224,12 @@ public Response<BinaryData> getComposedWithoutDiscriminatorWithResponse(RequestO
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
* (Optional){
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down Expand Up @@ -260,12 +260,12 @@ public Response<BinaryData> getComplicatedWithResponse(RequestOptions requestOpt
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
* (Optional){
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down Expand Up @@ -297,12 +297,12 @@ public Response<Void> putComplicatedWithResponse(BinaryData complexBody, Request
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
* (Optional){
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand All @@ -317,12 +317,12 @@ public Response<Void> putComplicatedWithResponse(BinaryData complexBody, Request
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
* (Optional){
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down Expand Up @@ -355,7 +355,7 @@ public Response<BinaryData> putMissingDiscriminatorWithResponse(BinaryData compl
* <p><strong>Request Body Schema</strong></p>
* <pre>{@code
* {
* fishtype: String (Optional)
* fishtype: String (Required)
* species: String (Optional)
* length: float (Required)
* siblings (Optional): [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Response<BinaryData> getValidSync(@HostParam("$host") String host, @HeaderParam(
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* kind: String(Kind1) (Optional)
* kind: String(Kind1) (Required)
* propB1: String (Optional)
* helper (Optional): {
* propBH1: String (Optional)
Expand All @@ -117,7 +117,7 @@ public Mono<Response<BinaryData>> getValidWithResponseAsync(RequestOptions reque
* <p><strong>Response Body Schema</strong></p>
* <pre>{@code
* {
* kind: String(Kind1) (Optional)
* kind: String(Kind1) (Required)
* propB1: String (Optional)
* helper (Optional): {
* propBH1: String (Optional)
Expand Down
Loading

0 comments on commit ec6c18e

Please sign in to comment.