-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mgmt, fix child with parent flatten (#3004)
* bump core * add fluent test * bump core * bump core * sync-test
- Loading branch information
1 parent
90d9987
commit c5e58aa
Showing
19 changed files
with
1,025 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
typespec-tests/src/main/java/tsptest/armstreamstyleserialization/fluent/FunctionsClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Code generated by Microsoft (R) TypeSpec Code Generator. | ||
|
||
package tsptest.armstreamstyleserialization.fluent; | ||
|
||
import com.azure.core.annotation.ReturnType; | ||
import com.azure.core.annotation.ServiceMethod; | ||
import com.azure.core.http.rest.Response; | ||
import com.azure.core.util.Context; | ||
import tsptest.armstreamstyleserialization.fluent.models.FunctionInner; | ||
|
||
/** | ||
* An instance of this class provides access to all the operations defined in FunctionsClient. | ||
*/ | ||
public interface FunctionsClient { | ||
/** | ||
* The createFunction operation. | ||
* | ||
* @param function The function parameter. | ||
* @param context The context to associate with this operation. | ||
* @throws IllegalArgumentException thrown if parameters fail the validation. | ||
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. | ||
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
* @return the response body along with {@link Response}. | ||
*/ | ||
@ServiceMethod(returns = ReturnType.SINGLE) | ||
Response<FunctionInner> createFunctionWithResponse(FunctionInner function, Context context); | ||
|
||
/** | ||
* The createFunction operation. | ||
* | ||
* @param function The function parameter. | ||
* @throws IllegalArgumentException thrown if parameters fail the validation. | ||
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. | ||
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. | ||
* @return the response. | ||
*/ | ||
@ServiceMethod(returns = ReturnType.SINGLE) | ||
FunctionInner createFunction(FunctionInner function); | ||
} |
121 changes: 121 additions & 0 deletions
121
...rc/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Code generated by Microsoft (R) TypeSpec Code Generator. | ||
|
||
package tsptest.armstreamstyleserialization.fluent.models; | ||
|
||
import com.azure.core.annotation.Fluent; | ||
import com.azure.json.JsonReader; | ||
import com.azure.json.JsonSerializable; | ||
import com.azure.json.JsonToken; | ||
import com.azure.json.JsonWriter; | ||
import java.io.IOException; | ||
|
||
/** | ||
* The FunctionConfiguration model. | ||
*/ | ||
@Fluent | ||
public final class FunctionConfiguration implements JsonSerializable<FunctionConfiguration> { | ||
/* | ||
* The input property. | ||
*/ | ||
private String input; | ||
|
||
/* | ||
* The output property. | ||
*/ | ||
private String output; | ||
|
||
/** | ||
* Creates an instance of FunctionConfiguration class. | ||
*/ | ||
public FunctionConfiguration() { | ||
} | ||
|
||
/** | ||
* Get the input property: The input property. | ||
* | ||
* @return the input value. | ||
*/ | ||
public String input() { | ||
return this.input; | ||
} | ||
|
||
/** | ||
* Set the input property: The input property. | ||
* | ||
* @param input the input value to set. | ||
* @return the FunctionConfiguration object itself. | ||
*/ | ||
public FunctionConfiguration withInput(String input) { | ||
this.input = input; | ||
return this; | ||
} | ||
|
||
/** | ||
* Get the output property: The output property. | ||
* | ||
* @return the output value. | ||
*/ | ||
public String output() { | ||
return this.output; | ||
} | ||
|
||
/** | ||
* Set the output property: The output property. | ||
* | ||
* @param output the output value to set. | ||
* @return the FunctionConfiguration object itself. | ||
*/ | ||
public FunctionConfiguration withOutput(String output) { | ||
this.output = output; | ||
return this; | ||
} | ||
|
||
/** | ||
* Validates the instance. | ||
* | ||
* @throws IllegalArgumentException thrown if the instance is not valid. | ||
*/ | ||
public void validate() { | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { | ||
jsonWriter.writeStartObject(); | ||
jsonWriter.writeStringField("input", this.input); | ||
jsonWriter.writeStringField("output", this.output); | ||
return jsonWriter.writeEndObject(); | ||
} | ||
|
||
/** | ||
* Reads an instance of FunctionConfiguration from the JsonReader. | ||
* | ||
* @param jsonReader The JsonReader being read. | ||
* @return An instance of FunctionConfiguration if the JsonReader was pointing to an instance of it, or null if it | ||
* was pointing to JSON null. | ||
* @throws IOException If an error occurs while reading the FunctionConfiguration. | ||
*/ | ||
public static FunctionConfiguration fromJson(JsonReader jsonReader) throws IOException { | ||
return jsonReader.readObject(reader -> { | ||
FunctionConfiguration deserializedFunctionConfiguration = new FunctionConfiguration(); | ||
while (reader.nextToken() != JsonToken.END_OBJECT) { | ||
String fieldName = reader.getFieldName(); | ||
reader.nextToken(); | ||
|
||
if ("input".equals(fieldName)) { | ||
deserializedFunctionConfiguration.input = reader.getString(); | ||
} else if ("output".equals(fieldName)) { | ||
deserializedFunctionConfiguration.output = reader.getString(); | ||
} else { | ||
reader.skipChildren(); | ||
} | ||
} | ||
|
||
return deserializedFunctionConfiguration; | ||
}); | ||
} | ||
} |
104 changes: 104 additions & 0 deletions
104
...-tests/src/main/java/tsptest/armstreamstyleserialization/fluent/models/FunctionInner.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
// Code generated by Microsoft (R) TypeSpec Code Generator. | ||
|
||
package tsptest.armstreamstyleserialization.fluent.models; | ||
|
||
import com.azure.core.annotation.Fluent; | ||
import com.azure.core.util.logging.ClientLogger; | ||
import com.azure.json.JsonReader; | ||
import com.azure.json.JsonSerializable; | ||
import com.azure.json.JsonToken; | ||
import com.azure.json.JsonWriter; | ||
import java.io.IOException; | ||
import tsptest.armstreamstyleserialization.models.FunctionProperties; | ||
|
||
/** | ||
* The Function model. | ||
*/ | ||
@Fluent | ||
public final class FunctionInner implements JsonSerializable<FunctionInner> { | ||
/* | ||
* The properties property. | ||
*/ | ||
private FunctionProperties properties; | ||
|
||
/** | ||
* Creates an instance of FunctionInner class. | ||
*/ | ||
public FunctionInner() { | ||
} | ||
|
||
/** | ||
* Get the properties property: The properties property. | ||
* | ||
* @return the properties value. | ||
*/ | ||
public FunctionProperties properties() { | ||
return this.properties; | ||
} | ||
|
||
/** | ||
* Set the properties property: The properties property. | ||
* | ||
* @param properties the properties value to set. | ||
* @return the FunctionInner object itself. | ||
*/ | ||
public FunctionInner withProperties(FunctionProperties properties) { | ||
this.properties = properties; | ||
return this; | ||
} | ||
|
||
/** | ||
* Validates the instance. | ||
* | ||
* @throws IllegalArgumentException thrown if the instance is not valid. | ||
*/ | ||
public void validate() { | ||
if (properties() == null) { | ||
throw LOGGER.atError() | ||
.log(new IllegalArgumentException("Missing required property properties in model FunctionInner")); | ||
} else { | ||
properties().validate(); | ||
} | ||
} | ||
|
||
private static final ClientLogger LOGGER = new ClientLogger(FunctionInner.class); | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { | ||
jsonWriter.writeStartObject(); | ||
jsonWriter.writeJsonField("properties", this.properties); | ||
return jsonWriter.writeEndObject(); | ||
} | ||
|
||
/** | ||
* Reads an instance of FunctionInner from the JsonReader. | ||
* | ||
* @param jsonReader The JsonReader being read. | ||
* @return An instance of FunctionInner if the JsonReader was pointing to an instance of it, or null if it was | ||
* pointing to JSON null. | ||
* @throws IllegalStateException If the deserialized JSON object was missing any required properties. | ||
* @throws IOException If an error occurs while reading the FunctionInner. | ||
*/ | ||
public static FunctionInner fromJson(JsonReader jsonReader) throws IOException { | ||
return jsonReader.readObject(reader -> { | ||
FunctionInner deserializedFunctionInner = new FunctionInner(); | ||
while (reader.nextToken() != JsonToken.END_OBJECT) { | ||
String fieldName = reader.getFieldName(); | ||
reader.nextToken(); | ||
|
||
if ("properties".equals(fieldName)) { | ||
deserializedFunctionInner.properties = FunctionProperties.fromJson(reader); | ||
} else { | ||
reader.skipChildren(); | ||
} | ||
} | ||
|
||
return deserializedFunctionInner; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.