You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java
+12-4Lines changed: 12 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,18 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege
99
99
publicRustAxumServerCodegen() {
100
100
super();
101
101
102
+
// The `#[validate(nested)]` macro relies on an internal field named `errors` to accumulate validation results. Therefore, defining a struct like this will fail:
103
+
//
104
+
// ```rust
105
+
// struct A {
106
+
// #[validate(nested)]
107
+
// errors: B,
108
+
// }
109
+
// ```
110
+
//
111
+
// To avoid this, either rename the field to something other than "errors", or reserve it.
112
+
this.reservedWords.add("errors");
113
+
102
114
modifyFeatureSet(features -> features
103
115
.wireFormatFeatures(EnumSet.of(
104
116
WireFormatFeature.JSON,
@@ -1192,10 +1204,6 @@ public String toVarName(String name) {
1192
1204
if (varName.startsWith("r#"))
1193
1205
return"r_" + varName.substring(2);
1194
1206
1195
-
// Special case: validate(nested) macros has internal field errors, thus, result in compilation error
0 commit comments