|
26 | 26 | import io.swagger.v3.oas.models.responses.ApiResponse;
|
27 | 27 | import io.swagger.v3.oas.models.servers.Server;
|
28 | 28 | import io.swagger.v3.parser.util.SchemaTypeUtil;
|
| 29 | +import java.util.stream.Collectors; |
29 | 30 | import org.openapitools.codegen.*;
|
30 | 31 | import org.openapitools.codegen.meta.features.DocumentationFeature;
|
31 | 32 | import org.openapitools.codegen.meta.features.SecurityFeature;
|
32 | 33 | import org.openapitools.codegen.model.ModelMap;
|
33 | 34 | import org.openapitools.codegen.model.ModelsMap;
|
34 |
| -import org.openapitools.codegen.model.OperationMap; |
35 | 35 | import org.openapitools.codegen.model.OperationsMap;
|
36 | 36 | import org.openapitools.codegen.templating.mustache.IndentedLambda;
|
37 | 37 | import org.openapitools.codegen.utils.ModelUtils;
|
@@ -986,6 +986,8 @@ private static String getItemsDataType(CodegenProperty items) {
|
986 | 986 | class ExtendedCodegenParameter extends CodegenParameter {
|
987 | 987 | public String dataTypeAlternate;
|
988 | 988 | public boolean isUniqueId; // this parameter represents a unique id (x-isUniqueId: true)
|
| 989 | + public List<CodegenProperty> readOnlyVars; // a list of read-only properties |
| 990 | + public boolean hasReadOnly = false; // indicates the type has at least one read-only property |
989 | 991 |
|
990 | 992 | public boolean itemsAreUniqueId() {
|
991 | 993 | return TypeScriptFetchClientCodegen.itemsAreUniqueId(this.items);
|
@@ -1081,8 +1083,11 @@ public ExtendedCodegenParameter(CodegenParameter cp) {
|
1081 | 1083 | this.minItems = cp.minItems;
|
1082 | 1084 | this.uniqueItems = cp.uniqueItems;
|
1083 | 1085 | this.multipleOf = cp.multipleOf;
|
| 1086 | + this.setHasVars(cp.getHasVars()); |
| 1087 | + this.setHasRequired(cp.getHasRequired()); |
1084 | 1088 | this.setMaxProperties(cp.getMaxProperties());
|
1085 | 1089 | this.setMinProperties(cp.getMinProperties());
|
| 1090 | + setReadOnlyVars(); |
1086 | 1091 | }
|
1087 | 1092 |
|
1088 | 1093 | @Override
|
@@ -1123,6 +1128,11 @@ public String toString() {
|
1123 | 1128 | sb.append(", dataTypeAlternate='").append(dataTypeAlternate).append('\'');
|
1124 | 1129 | return sb.toString();
|
1125 | 1130 | }
|
| 1131 | + |
| 1132 | + private void setReadOnlyVars() { |
| 1133 | + readOnlyVars = vars.stream().filter(v -> v.isReadOnly).collect(Collectors.toList()); |
| 1134 | + hasReadOnly = !readOnlyVars.isEmpty(); |
| 1135 | + } |
1126 | 1136 | }
|
1127 | 1137 |
|
1128 | 1138 | class ExtendedCodegenProperty extends CodegenProperty {
|
|
0 commit comments