Skip to content

Commit e5048d9

Browse files
mpg, remove namingOverride and set output-immutable to true (#2700)
* remove namingOverride;output-immutable * re-generate test code * comment out --------- Co-authored-by: actions-user <[email protected]>
1 parent 4748dde commit e5048d9

File tree

11 files changed

+99
-235
lines changed

11 files changed

+99
-235
lines changed

typespec-extension/src/main/java/com/azure/autorest/fluent/TypeSpecFluentPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public TypeSpecFluentPlugin(EmitterOptions emitterOptions, boolean sdkIntegratio
5050
SETTINGS_MAP.put("fluent", "lite");
5151
}
5252
SETTINGS_MAP.put("sdk-integration", sdkIntegration);
53+
SETTINGS_MAP.put("output-model-immutable", true);
5354
// SETTINGS_MAP.put("stream-style-serialization", emitterOptions.getStreamStyleSerialization());
5455

5556
JavaSettingsAccessor.setHost(this);
@@ -111,7 +112,7 @@ protected FluentMapper getFluentMapper() {
111112
SETTINGS_MAP.put("sync-methods", "all");
112113
SETTINGS_MAP.put("client-side-validations", true);
113114
SETTINGS_MAP.put("stream-style-serialization", false);
114-
SETTINGS_MAP.put("pipeline.fluentgen.naming.override", getNamingOverrides());
115+
// SETTINGS_MAP.put("pipeline.fluentgen.naming.override", getNamingOverrides());
115116
}
116117

117118
private static Map<String, String> getNamingOverrides() {

typespec-tests/src/main/java/com/cadl/armresourceprovider/fluent/models/OperationInner.java

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package com.cadl.armresourceprovider.fluent.models;
66

7-
import com.azure.core.annotation.Fluent;
7+
import com.azure.core.annotation.Immutable;
88
import com.cadl.armresourceprovider.models.ActionType;
99
import com.cadl.armresourceprovider.models.OperationDisplay;
1010
import com.cadl.armresourceprovider.models.Origin;
@@ -13,7 +13,7 @@
1313
/**
1414
* Details of a REST API operation, returned from the Resource Provider Operations API.
1515
*/
16-
@Fluent
16+
@Immutable
1717
public final class OperationInner {
1818
/*
1919
* The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action"
@@ -48,7 +48,7 @@ public final class OperationInner {
4848
/**
4949
* Creates an instance of OperationInner class.
5050
*/
51-
public OperationInner() {
51+
private OperationInner() {
5252
}
5353

5454
/**
@@ -80,17 +80,6 @@ public OperationDisplay display() {
8080
return this.display;
8181
}
8282

83-
/**
84-
* Set the display property: Localized display information for this particular operation.
85-
*
86-
* @param display the display value to set.
87-
* @return the OperationInner object itself.
88-
*/
89-
public OperationInner withDisplay(OperationDisplay display) {
90-
this.display = display;
91-
return this;
92-
}
93-
9483
/**
9584
* Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and
9685
* audit logs UX. Default value is "user,system".
@@ -111,18 +100,6 @@ public ActionType actionType() {
111100
return this.actionType;
112101
}
113102

114-
/**
115-
* Set the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal
116-
* only APIs.
117-
*
118-
* @param actionType the actionType value to set.
119-
* @return the OperationInner object itself.
120-
*/
121-
public OperationInner withActionType(ActionType actionType) {
122-
this.actionType = actionType;
123-
return this;
124-
}
125-
126103
/**
127104
* Validates the instance.
128105
*

typespec-tests/src/main/java/com/cadl/armresourceprovider/fluent/models/TopLevelArmResourceInner.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,25 @@ public List<String> configurationEndpoints() {
8282
}
8383

8484
/**
85-
* Get the username property: The userName property.
85+
* Get the userName property: The userName property.
8686
*
87-
* @return the username value.
87+
* @return the userName value.
8888
*/
89-
public String username() {
90-
return this.innerProperties() == null ? null : this.innerProperties().username();
89+
public String userName() {
90+
return this.innerProperties() == null ? null : this.innerProperties().userName();
9191
}
9292

9393
/**
94-
* Set the username property: The userName property.
94+
* Set the userName property: The userName property.
9595
*
96-
* @param username the username value to set.
96+
* @param userName the userName value to set.
9797
* @return the TopLevelArmResourceInner object itself.
9898
*/
99-
public TopLevelArmResourceInner withUsername(String username) {
99+
public TopLevelArmResourceInner withUserName(String userName) {
100100
if (this.innerProperties() == null) {
101101
this.innerProperties = new TopLevelArmResourceProperties();
102102
}
103-
this.innerProperties().withUsername(username);
103+
this.innerProperties().withUserName(userName);
104104
return this;
105105
}
106106

@@ -151,25 +151,25 @@ public TopLevelArmResourceInner withAccuserName(String accuserName) {
151151
}
152152

153153
/**
154-
* Get the startTimestamp property: The startTimeStamp property.
154+
* Get the startTimeStamp property: The startTimeStamp property.
155155
*
156-
* @return the startTimestamp value.
156+
* @return the startTimeStamp value.
157157
*/
158-
public OffsetDateTime startTimestamp() {
159-
return this.innerProperties() == null ? null : this.innerProperties().startTimestamp();
158+
public OffsetDateTime startTimeStamp() {
159+
return this.innerProperties() == null ? null : this.innerProperties().startTimeStamp();
160160
}
161161

162162
/**
163-
* Set the startTimestamp property: The startTimeStamp property.
163+
* Set the startTimeStamp property: The startTimeStamp property.
164164
*
165-
* @param startTimestamp the startTimestamp value to set.
165+
* @param startTimeStamp the startTimeStamp value to set.
166166
* @return the TopLevelArmResourceInner object itself.
167167
*/
168-
public TopLevelArmResourceInner withStartTimestamp(OffsetDateTime startTimestamp) {
168+
public TopLevelArmResourceInner withStartTimeStamp(OffsetDateTime startTimeStamp) {
169169
if (this.innerProperties() == null) {
170170
this.innerProperties = new TopLevelArmResourceProperties();
171171
}
172-
this.innerProperties().withStartTimestamp(startTimestamp);
172+
this.innerProperties().withStartTimeStamp(startTimeStamp);
173173
return this;
174174
}
175175

typespec-tests/src/main/java/com/cadl/armresourceprovider/fluent/models/TopLevelArmResourceProperties.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public final class TopLevelArmResourceProperties {
2626
* The userName property.
2727
*/
2828
@JsonProperty(value = "userName", required = true)
29-
private String username;
29+
private String userName;
3030

3131
/*
3232
* The userNames property.
@@ -44,7 +44,7 @@ public final class TopLevelArmResourceProperties {
4444
* The startTimeStamp property.
4545
*/
4646
@JsonProperty(value = "startTimeStamp", required = true)
47-
private OffsetDateTime startTimestamp;
47+
private OffsetDateTime startTimeStamp;
4848

4949
/*
5050
* The status of the last operation.
@@ -68,22 +68,22 @@ public List<String> configurationEndpoints() {
6868
}
6969

7070
/**
71-
* Get the username property: The userName property.
71+
* Get the userName property: The userName property.
7272
*
73-
* @return the username value.
73+
* @return the userName value.
7474
*/
75-
public String username() {
76-
return this.username;
75+
public String userName() {
76+
return this.userName;
7777
}
7878

7979
/**
80-
* Set the username property: The userName property.
80+
* Set the userName property: The userName property.
8181
*
82-
* @param username the username value to set.
82+
* @param userName the userName value to set.
8383
* @return the TopLevelArmResourceProperties object itself.
8484
*/
85-
public TopLevelArmResourceProperties withUsername(String username) {
86-
this.username = username;
85+
public TopLevelArmResourceProperties withUserName(String userName) {
86+
this.userName = userName;
8787
return this;
8888
}
8989

@@ -128,22 +128,22 @@ public TopLevelArmResourceProperties withAccuserName(String accuserName) {
128128
}
129129

130130
/**
131-
* Get the startTimestamp property: The startTimeStamp property.
131+
* Get the startTimeStamp property: The startTimeStamp property.
132132
*
133-
* @return the startTimestamp value.
133+
* @return the startTimeStamp value.
134134
*/
135-
public OffsetDateTime startTimestamp() {
136-
return this.startTimestamp;
135+
public OffsetDateTime startTimeStamp() {
136+
return this.startTimeStamp;
137137
}
138138

139139
/**
140-
* Set the startTimestamp property: The startTimeStamp property.
140+
* Set the startTimeStamp property: The startTimeStamp property.
141141
*
142-
* @param startTimestamp the startTimestamp value to set.
142+
* @param startTimeStamp the startTimeStamp value to set.
143143
* @return the TopLevelArmResourceProperties object itself.
144144
*/
145-
public TopLevelArmResourceProperties withStartTimestamp(OffsetDateTime startTimestamp) {
146-
this.startTimestamp = startTimestamp;
145+
public TopLevelArmResourceProperties withStartTimeStamp(OffsetDateTime startTimeStamp) {
146+
this.startTimeStamp = startTimeStamp;
147147
return this;
148148
}
149149

@@ -162,10 +162,10 @@ public ProvisioningState provisioningState() {
162162
* @throws IllegalArgumentException thrown if the instance is not valid.
163163
*/
164164
public void validate() {
165-
if (username() == null) {
165+
if (userName() == null) {
166166
throw LOGGER.atError()
167167
.log(new IllegalArgumentException(
168-
"Missing required property username in model TopLevelArmResourceProperties"));
168+
"Missing required property userName in model TopLevelArmResourceProperties"));
169169
}
170170
if (userNames() == null) {
171171
throw LOGGER.atError()
@@ -177,10 +177,10 @@ public void validate() {
177177
.log(new IllegalArgumentException(
178178
"Missing required property accuserName in model TopLevelArmResourceProperties"));
179179
}
180-
if (startTimestamp() == null) {
180+
if (startTimeStamp() == null) {
181181
throw LOGGER.atError()
182182
.log(new IllegalArgumentException(
183-
"Missing required property startTimestamp in model TopLevelArmResourceProperties"));
183+
"Missing required property startTimeStamp in model TopLevelArmResourceProperties"));
184184
}
185185
}
186186

typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/TopLevelArmResourceImpl.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ public List<String> configurationEndpoints() {
6161
}
6262
}
6363

64-
public String username() {
65-
return this.innerModel().username();
64+
public String userName() {
65+
return this.innerModel().userName();
6666
}
6767

6868
public String userNames() {
@@ -73,8 +73,8 @@ public String accuserName() {
7373
return this.innerModel().accuserName();
7474
}
7575

76-
public OffsetDateTime startTimestamp() {
77-
return this.innerModel().startTimestamp();
76+
public OffsetDateTime startTimeStamp() {
77+
return this.innerModel().startTimeStamp();
7878
}
7979

8080
public ProvisioningState provisioningState() {
@@ -198,8 +198,8 @@ public TopLevelArmResourceImpl withTags(Map<String, String> tags) {
198198
}
199199
}
200200

201-
public TopLevelArmResourceImpl withUsername(String username) {
202-
this.innerModel().withUsername(username);
201+
public TopLevelArmResourceImpl withUserName(String userName) {
202+
this.innerModel().withUserName(userName);
203203
return this;
204204
}
205205

@@ -213,8 +213,8 @@ public TopLevelArmResourceImpl withAccuserName(String accuserName) {
213213
return this;
214214
}
215215

216-
public TopLevelArmResourceImpl withStartTimestamp(OffsetDateTime startTimestamp) {
217-
this.innerModel().withStartTimestamp(startTimestamp);
216+
public TopLevelArmResourceImpl withStartTimeStamp(OffsetDateTime startTimeStamp) {
217+
this.innerModel().withStartTimeStamp(startTimeStamp);
218218
return this;
219219
}
220220

typespec-tests/src/main/java/com/cadl/armresourceprovider/implementation/models/ChildResourceListResult.java

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
package com.cadl.armresourceprovider.implementation.models;
66

7-
import com.azure.core.annotation.Fluent;
7+
import com.azure.core.annotation.Immutable;
88
import com.azure.core.util.logging.ClientLogger;
99
import com.cadl.armresourceprovider.fluent.models.ChildResourceInner;
1010
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -13,7 +13,7 @@
1313
/**
1414
* The response of a ChildResource list operation.
1515
*/
16-
@Fluent
16+
@Immutable
1717
public final class ChildResourceListResult {
1818
/*
1919
* The ChildResource items on this page
@@ -30,7 +30,7 @@ public final class ChildResourceListResult {
3030
/**
3131
* Creates an instance of ChildResourceListResult class.
3232
*/
33-
public ChildResourceListResult() {
33+
private ChildResourceListResult() {
3434
}
3535

3636
/**
@@ -42,17 +42,6 @@ public List<ChildResourceInner> value() {
4242
return this.value;
4343
}
4444

45-
/**
46-
* Set the value property: The ChildResource items on this page.
47-
*
48-
* @param value the value value to set.
49-
* @return the ChildResourceListResult object itself.
50-
*/
51-
public ChildResourceListResult withValue(List<ChildResourceInner> value) {
52-
this.value = value;
53-
return this;
54-
}
55-
5645
/**
5746
* Get the nextLink property: The link to the next page of items.
5847
*
@@ -62,17 +51,6 @@ public String nextLink() {
6251
return this.nextLink;
6352
}
6453

65-
/**
66-
* Set the nextLink property: The link to the next page of items.
67-
*
68-
* @param nextLink the nextLink value to set.
69-
* @return the ChildResourceListResult object itself.
70-
*/
71-
public ChildResourceListResult withNextLink(String nextLink) {
72-
this.nextLink = nextLink;
73-
return this;
74-
}
75-
7654
/**
7755
* Validates the instance.
7856
*

0 commit comments

Comments
 (0)