@autobe/agent 0.30.2 → 0.30.4-dev.20260324
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -661
- package/README.md +261 -0
- package/lib/AutoBeMockAgent.d.ts +2 -1
- package/lib/AutoBeMockAgent.js +37 -18
- package/lib/AutoBeMockAgent.js.map +1 -1
- package/lib/constants/AutoBeConfigConstant.d.ts +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +12 -11
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/index.mjs +497 -71
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeExtractDecisionsHistory.d.ts +18 -0
- package/lib/orchestrate/analyze/histories/transformAnalyzeExtractDecisionsHistory.js +51 -0
- package/lib/orchestrate/analyze/histories/transformAnalyzeExtractDecisionsHistory.js.map +1 -0
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistory.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioHistory.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioReviewHistory.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeScenarioReviewHistory.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeSectionCrossFileReviewHistory.d.ts +1 -0
- package/lib/orchestrate/analyze/histories/transformAnalyzeSectionCrossFileReviewHistory.js +15 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeSectionCrossFileReviewHistory.js.map +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeSectionReviewHistory.js +1 -1
- package/lib/orchestrate/analyze/histories/transformAnalyzeSectionReviewHistory.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +48 -13
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.d.ts +17 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.js +345 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.js.map +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeScenario.js +2 -2
- package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.d.ts +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js +1 -0
- package/lib/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.js.map +1 -1
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.d.ts +91 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.js +3 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.js.map +1 -0
- package/lib/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.d.ts +15 -5
- package/lib/orchestrate/analyze/utils/buildErrorCodeRegistry.d.ts +0 -9
- package/lib/orchestrate/analyze/utils/buildErrorCodeRegistry.js +1 -13
- package/lib/orchestrate/analyze/utils/buildErrorCodeRegistry.js.map +1 -1
- package/lib/orchestrate/analyze/utils/detectDecisionConflicts.d.ts +63 -0
- package/lib/orchestrate/analyze/utils/detectDecisionConflicts.js +105 -0
- package/lib/orchestrate/analyze/utils/detectDecisionConflicts.js.map +1 -0
- package/lib/orchestrate/common/histories/transformPreliminaryHistory.js +1 -1
- package/lib/orchestrate/common/histories/transformPreliminaryHistory.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceActionEndpointReviewHistory.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceActionEndpointReviewHistory.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceBaseEndpointReviewHistory.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceBaseEndpointReviewHistory.js.map +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRefineHistory.js +1 -1
- package/lib/orchestrate/interface/histories/transformInterfaceSchemaRefineHistory.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js +1 -2
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaRefine.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js +1 -2
- package/lib/orchestrate/interface/orchestrateInterfaceSchemaReview.js.map +1 -1
- package/lib/orchestrate/interface/utils/AutoBeJsonSchemaValidator.js +316 -283
- package/lib/orchestrate/interface/utils/AutoBeJsonSchemaValidator.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentReviewHistory.js +2 -2
- package/lib/orchestrate/prisma/histories/transformPrismaComponentReviewHistory.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaComponentsHistory.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaGroupHistory.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaGroupHistory.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaGroupReviewHistory.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaGroupReviewHistory.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaHistory.js.map +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaReviewHistory.js +1 -1
- package/lib/orchestrate/prisma/histories/transformPrismaSchemaReviewHistory.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +1 -1
- package/lib/structures/IAutoBeVendor.d.ts +13 -0
- package/package.json +5 -5
- package/src/AutoBeMockAgent.ts +283 -254
- package/src/constants/AutoBeConfigConstant.ts +1 -1
- package/src/constants/AutoBeSystemPromptConstant.ts +12 -11
- package/src/orchestrate/analyze/histories/transformAnalyzeExtractDecisionsHistory.ts +69 -0
- package/src/orchestrate/analyze/histories/transformAnalyzeSectionCrossFileReviewHistory.ts +20 -0
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +58 -1
- package/src/orchestrate/analyze/orchestrateAnalyzeExtractDecisions.ts +97 -0
- package/src/orchestrate/analyze/orchestrateAnalyzeSectionCrossFileReview.ts +2 -0
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeExtractDecisionsApplication.ts +99 -0
- package/src/orchestrate/analyze/structures/IAutoBeAnalyzeScenarioApplication.ts +15 -5
- package/src/orchestrate/analyze/utils/buildErrorCodeRegistry.ts +0 -20
- package/src/orchestrate/analyze/utils/detectDecisionConflicts.ts +172 -0
- package/src/orchestrate/interface/orchestrateInterfaceSchemaRefine.ts +291 -292
- package/src/orchestrate/interface/orchestrateInterfaceSchemaReview.ts +309 -310
- package/src/orchestrate/interface/utils/AutoBeJsonSchemaValidator.ts +763 -725
- package/src/orchestrate/test/experimental/orchestrateTestCorrect.ast +237 -237
- package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +322 -322
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +52 -52
- package/src/structures/IAutoBeVendor.ts +127 -113
|
@@ -35,6 +35,7 @@ var AutoBeJsonSchemaValidator;
|
|
|
35
35
|
validateReferenceId(props);
|
|
36
36
|
validatePropertyNames(props);
|
|
37
37
|
validateNumericRanges(props);
|
|
38
|
+
// validateEmptyProperties(props);
|
|
38
39
|
vo(props.typeName, props.schema);
|
|
39
40
|
utils_1.AutoBeOpenApiTypeChecker.skim({
|
|
40
41
|
schema: props.schema,
|
|
@@ -61,35 +62,35 @@ var AutoBeJsonSchemaValidator;
|
|
|
61
62
|
path: props.path,
|
|
62
63
|
expected: "At most one dot(.) character allowed in type name",
|
|
63
64
|
value: transform(props.key),
|
|
64
|
-
description: utils_1.StringUtil.trim `
|
|
65
|
-
JSON schema type name allows at most one dot(.) character to separate
|
|
66
|
-
module name and interface name.
|
|
67
|
-
|
|
68
|
-
However, current key name ${transform(JSON.stringify(props.key))}
|
|
69
|
-
contains multiple dot(.) characters (${elements.length - 1} times).
|
|
70
|
-
|
|
71
|
-
Change it to a valid type name with at most one dot(.) character at the next time.
|
|
72
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
65
|
+
description: utils_1.StringUtil.trim `
|
|
66
|
+
JSON schema type name allows at most one dot(.) character to separate
|
|
67
|
+
module name and interface name.
|
|
68
|
+
|
|
69
|
+
However, current key name ${transform(JSON.stringify(props.key))}
|
|
70
|
+
contains multiple dot(.) characters (${elements.length - 1} times).
|
|
71
|
+
|
|
72
|
+
Change it to a valid type name with at most one dot(.) character at the next time.
|
|
73
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
73
74
|
`,
|
|
74
75
|
});
|
|
75
76
|
if (elements.every(utils_2.NamingConvention.variable) === false)
|
|
76
77
|
props.errors.push({
|
|
77
78
|
path: props.path,
|
|
78
|
-
expected: utils_1.StringUtil.trim `
|
|
79
|
-
Valid variable name
|
|
80
|
-
|
|
81
|
-
${elements.map((s) => `- ${s}: ${utils_2.NamingConvention.variable(s) ? "valid" : "invalid"}`).join("\n")}
|
|
79
|
+
expected: utils_1.StringUtil.trim `
|
|
80
|
+
Valid variable name
|
|
81
|
+
|
|
82
|
+
${elements.map((s) => `- ${s}: ${utils_2.NamingConvention.variable(s) ? "valid" : "invalid"}`).join("\n")}
|
|
82
83
|
`,
|
|
83
84
|
value: transform(props.key),
|
|
84
|
-
description: utils_1.StringUtil.trim `
|
|
85
|
-
JSON schema type name must be a valid variable name.
|
|
86
|
-
|
|
87
|
-
Even though JSON schema type name allows dot(.) character, but
|
|
88
|
-
each segment separated by dot(.) must be a valid variable name.
|
|
89
|
-
|
|
90
|
-
Current key name ${transform(JSON.stringify(props.key))} is not valid.
|
|
91
|
-
Change it to a valid variable name at the next time.
|
|
92
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
85
|
+
description: utils_1.StringUtil.trim `
|
|
86
|
+
JSON schema type name must be a valid variable name.
|
|
87
|
+
|
|
88
|
+
Even though JSON schema type name allows dot(.) character, but
|
|
89
|
+
each segment separated by dot(.) must be a valid variable name.
|
|
90
|
+
|
|
91
|
+
Current key name ${transform(JSON.stringify(props.key))} is not valid.
|
|
92
|
+
Change it to a valid variable name at the next time.
|
|
93
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
93
94
|
`,
|
|
94
95
|
});
|
|
95
96
|
if (props.key.endsWith(".IPage")) {
|
|
@@ -98,16 +99,16 @@ var AutoBeJsonSchemaValidator;
|
|
|
98
99
|
path: props.path,
|
|
99
100
|
expected: `"IPage" must be followed by another interface name. Use ${transform(JSON.stringify(expected))} instead.`,
|
|
100
101
|
value: transform(props.key),
|
|
101
|
-
description: utils_1.StringUtil.trim `
|
|
102
|
-
"IPage" is a reserved type name for pagination response.
|
|
103
|
-
The pagination data type name must be post-fixed after "IPage".
|
|
104
|
-
|
|
105
|
-
However, you've defined ${transform(JSON.stringify(props.key))},
|
|
106
|
-
post-fixing ".IPage" after the pagination data type name.
|
|
107
|
-
|
|
108
|
-
Change it to a valid pagination type name to be
|
|
109
|
-
${transform(JSON.stringify(expected))} at the next time.
|
|
110
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
102
|
+
description: utils_1.StringUtil.trim `
|
|
103
|
+
"IPage" is a reserved type name for pagination response.
|
|
104
|
+
The pagination data type name must be post-fixed after "IPage".
|
|
105
|
+
|
|
106
|
+
However, you've defined ${transform(JSON.stringify(props.key))},
|
|
107
|
+
post-fixing ".IPage" after the pagination data type name.
|
|
108
|
+
|
|
109
|
+
Change it to a valid pagination type name to be
|
|
110
|
+
${transform(JSON.stringify(expected))} at the next time.
|
|
111
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
111
112
|
`,
|
|
112
113
|
});
|
|
113
114
|
}
|
|
@@ -116,13 +117,13 @@ var AutoBeJsonSchemaValidator;
|
|
|
116
117
|
path: props.path,
|
|
117
118
|
expected: `"IPageIRequest" is a mistake. Use "IPage.IRequest" instead.`,
|
|
118
119
|
value: transform(props.key),
|
|
119
|
-
description: utils_1.StringUtil.trim `
|
|
120
|
-
You've taken a mistake that defines "${transform("IPageIRequest")}" as a type name.
|
|
121
|
-
However, as you've intended to define a pagination request type,
|
|
122
|
-
the correct type name is "${transform("IPage.IRequest")}" instead of "${transform("IPageIRequest")}".
|
|
123
|
-
|
|
124
|
-
Change it to "${transform("IPage.IRequest")}" at the next time.
|
|
125
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
120
|
+
description: utils_1.StringUtil.trim `
|
|
121
|
+
You've taken a mistake that defines "${transform("IPageIRequest")}" as a type name.
|
|
122
|
+
However, as you've intended to define a pagination request type,
|
|
123
|
+
the correct type name is "${transform("IPage.IRequest")}" instead of "${transform("IPageIRequest")}".
|
|
124
|
+
|
|
125
|
+
Change it to "${transform("IPage.IRequest")}" at the next time.
|
|
126
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
126
127
|
`,
|
|
127
128
|
});
|
|
128
129
|
if (props.key.startsWith("IPage") &&
|
|
@@ -138,19 +139,19 @@ var AutoBeJsonSchemaValidator;
|
|
|
138
139
|
path: props.path,
|
|
139
140
|
expected: `Interface name starting with 'I' even after 'IPage': ${JSON.stringify(expected)}`,
|
|
140
141
|
value: transform(props.key),
|
|
141
|
-
description: utils_1.StringUtil.trim `
|
|
142
|
-
JSON schema type name must be an interface name starting with 'I'.
|
|
143
|
-
Even though JSON schema type name allows dot(.) character, but
|
|
144
|
-
each segment separated by dot(.) must be an interface name starting
|
|
145
|
-
with 'I'.
|
|
146
|
-
|
|
147
|
-
Even in the case of pagination response, after 'IPage' prefix,
|
|
148
|
-
the remaining part must be an interface name starting with 'I'.
|
|
149
|
-
|
|
150
|
-
Current key name ${JSON.stringify(props.key)} is not valid. Change
|
|
151
|
-
it to a valid interface name to be ${JSON.stringify(expected)},
|
|
152
|
-
or change it to another valid interface name at the next time.
|
|
153
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
142
|
+
description: utils_1.StringUtil.trim `
|
|
143
|
+
JSON schema type name must be an interface name starting with 'I'.
|
|
144
|
+
Even though JSON schema type name allows dot(.) character, but
|
|
145
|
+
each segment separated by dot(.) must be an interface name starting
|
|
146
|
+
with 'I'.
|
|
147
|
+
|
|
148
|
+
Even in the case of pagination response, after 'IPage' prefix,
|
|
149
|
+
the remaining part must be an interface name starting with 'I'.
|
|
150
|
+
|
|
151
|
+
Current key name ${JSON.stringify(props.key)} is not valid. Change
|
|
152
|
+
it to a valid interface name to be ${JSON.stringify(expected)},
|
|
153
|
+
or change it to another valid interface name at the next time.
|
|
154
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
154
155
|
`,
|
|
155
156
|
});
|
|
156
157
|
}
|
|
@@ -162,17 +163,17 @@ var AutoBeJsonSchemaValidator;
|
|
|
162
163
|
path: props.path,
|
|
163
164
|
expected: `Interface name starting with 'I': ${JSON.stringify(expected)}`,
|
|
164
165
|
value: transform(props.key),
|
|
165
|
-
description: utils_1.StringUtil.trim `
|
|
166
|
-
JSON schema type name must be an interface name starting with 'I'.
|
|
167
|
-
Even though JSON schema type name allows dot(.) character, but
|
|
168
|
-
each segment separated by dot(.) must be an interface name starting
|
|
169
|
-
with 'I'.
|
|
170
|
-
|
|
171
|
-
Current key name ${transform(JSON.stringify(props.key))} is not valid.
|
|
172
|
-
Change it to a valid interface name to be ${transform(JSON.stringify(expected))},
|
|
173
|
-
or change it to another valid interface name at the next time.
|
|
174
|
-
|
|
175
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
166
|
+
description: utils_1.StringUtil.trim `
|
|
167
|
+
JSON schema type name must be an interface name starting with 'I'.
|
|
168
|
+
Even though JSON schema type name allows dot(.) character, but
|
|
169
|
+
each segment separated by dot(.) must be an interface name starting
|
|
170
|
+
with 'I'.
|
|
171
|
+
|
|
172
|
+
Current key name ${transform(JSON.stringify(props.key))} is not valid.
|
|
173
|
+
Change it to a valid interface name to be ${transform(JSON.stringify(expected))},
|
|
174
|
+
or change it to another valid interface name at the next time.
|
|
175
|
+
|
|
176
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
176
177
|
`,
|
|
177
178
|
});
|
|
178
179
|
}
|
|
@@ -186,27 +187,27 @@ var AutoBeJsonSchemaValidator;
|
|
|
186
187
|
path: props.path,
|
|
187
188
|
expected: JSON.stringify(`${elements[0].replace("Session", "")}.${elements[1]}`),
|
|
188
189
|
value: transform(props.key),
|
|
189
|
-
description: utils_1.StringUtil.trim `
|
|
190
|
-
You have attached ${elements[1]} to a Session type ${transform(JSON.stringify(props.key))},
|
|
191
|
-
but this is architecturally incorrect.
|
|
192
|
-
|
|
193
|
-
In production authentication systems, Actor and Session are separate concepts:
|
|
194
|
-
- **Actor** (e.g., User, Seller, Admin): The persistent user identity that performs
|
|
195
|
-
authentication actions - joining (registering), logging in, and receiving authorized tokens.
|
|
196
|
-
- **Session** (e.g., UserSession, SellerSession): The temporary authentication state that
|
|
197
|
-
tracks active login instances. Sessions are CREATED as a result of join/login operations,
|
|
198
|
-
but they do not perform these actions themselves.
|
|
199
|
-
|
|
200
|
-
Think about it semantically: An ACTOR joins the system and logs in. A SESSION is merely
|
|
201
|
-
a record that gets created when the actor authenticates. It makes no sense for a session
|
|
202
|
-
to "join" or "login" - only actors do that.
|
|
203
|
-
|
|
204
|
-
Therefore, authentication-related DTO types (IJoin, ILogin, IAuthorized, IRefresh) MUST
|
|
205
|
-
be attached to the Actor type, NEVER to the Session type.
|
|
206
|
-
|
|
207
|
-
Change ${transform(JSON.stringify(props.key))} to ${transform(JSON.stringify(`${elements[0].replace("Session", "")}.${elements[1]}`))} at the next time.
|
|
208
|
-
|
|
209
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
190
|
+
description: utils_1.StringUtil.trim `
|
|
191
|
+
You have attached ${elements[1]} to a Session type ${transform(JSON.stringify(props.key))},
|
|
192
|
+
but this is architecturally incorrect.
|
|
193
|
+
|
|
194
|
+
In production authentication systems, Actor and Session are separate concepts:
|
|
195
|
+
- **Actor** (e.g., User, Seller, Admin): The persistent user identity that performs
|
|
196
|
+
authentication actions - joining (registering), logging in, and receiving authorized tokens.
|
|
197
|
+
- **Session** (e.g., UserSession, SellerSession): The temporary authentication state that
|
|
198
|
+
tracks active login instances. Sessions are CREATED as a result of join/login operations,
|
|
199
|
+
but they do not perform these actions themselves.
|
|
200
|
+
|
|
201
|
+
Think about it semantically: An ACTOR joins the system and logs in. A SESSION is merely
|
|
202
|
+
a record that gets created when the actor authenticates. It makes no sense for a session
|
|
203
|
+
to "join" or "login" - only actors do that.
|
|
204
|
+
|
|
205
|
+
Therefore, authentication-related DTO types (IJoin, ILogin, IAuthorized, IRefresh) MUST
|
|
206
|
+
be attached to the Actor type, NEVER to the Session type.
|
|
207
|
+
|
|
208
|
+
Change ${transform(JSON.stringify(props.key))} to ${transform(JSON.stringify(`${elements[0].replace("Session", "")}.${elements[1]}`))} at the next time.
|
|
209
|
+
|
|
210
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
210
211
|
`,
|
|
211
212
|
});
|
|
212
213
|
};
|
|
@@ -267,20 +268,20 @@ var AutoBeJsonSchemaValidator;
|
|
|
267
268
|
.map((s) => JSON.stringify(`#/components/schemas/${s}`))
|
|
268
269
|
.join(" | "),
|
|
269
270
|
value: key,
|
|
270
|
-
description: utils_1.StringUtil.trim `
|
|
271
|
-
You've referenced an authorization-related type ${JSON.stringify(key)}
|
|
272
|
-
that is not used in any operation's requestBody or responseBody.
|
|
273
|
-
|
|
274
|
-
Authorization-related types must be used in at least one operation's
|
|
275
|
-
requestBody or responseBody. Make sure to use the type appropriately
|
|
276
|
-
in your API design.
|
|
277
|
-
|
|
278
|
-
Existing authorization-related types used in operations are:
|
|
271
|
+
description: utils_1.StringUtil.trim `
|
|
272
|
+
You've referenced an authorization-related type ${JSON.stringify(key)}
|
|
273
|
+
that is not used in any operation's requestBody or responseBody.
|
|
274
|
+
|
|
275
|
+
Authorization-related types must be used in at least one operation's
|
|
276
|
+
requestBody or responseBody. Make sure to use the type appropriately
|
|
277
|
+
in your API design.
|
|
278
|
+
|
|
279
|
+
Existing authorization-related types used in operations are:
|
|
279
280
|
- ${Array.from(candidates)
|
|
280
281
|
.map((s) => `#/components/schemas/${s}`)
|
|
281
|
-
.join("\n- ")}
|
|
282
|
-
|
|
283
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
282
|
+
.join("\n- ")}
|
|
283
|
+
|
|
284
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
284
285
|
`,
|
|
285
286
|
});
|
|
286
287
|
},
|
|
@@ -295,61 +296,61 @@ var AutoBeJsonSchemaValidator;
|
|
|
295
296
|
});
|
|
296
297
|
if (utils_1.AutoBeOpenApiTypeChecker.isReference(props.schema) &&
|
|
297
298
|
props.schema.$ref === `#/components/schemas/${props.typeName}`)
|
|
298
|
-
report(utils_1.StringUtil.trim `
|
|
299
|
-
You have defined a nonsensible type like below:
|
|
300
|
-
|
|
301
|
-
\`\`\`typescript
|
|
302
|
-
type ${props.typeName} = ${props.typeName};
|
|
303
|
-
\`\`\`
|
|
304
|
-
|
|
305
|
-
This is an infinite recursive type definition that cannot exist in any
|
|
306
|
-
programming language. A type cannot be defined as itself - this creates
|
|
307
|
-
a circular definition with no base case, making the type impossible to
|
|
308
|
-
instantiate or validate.
|
|
309
|
-
|
|
310
|
-
If you need tree or graph structures, use explicit relationships with
|
|
311
|
-
ID references (e.g., parentId: string) instead of recursive type definitions.
|
|
312
|
-
Remove the self-reference and redesign the schema at the next time.
|
|
313
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
299
|
+
report(utils_1.StringUtil.trim `
|
|
300
|
+
You have defined a nonsensible type like below:
|
|
301
|
+
|
|
302
|
+
\`\`\`typescript
|
|
303
|
+
type ${props.typeName} = ${props.typeName};
|
|
304
|
+
\`\`\`
|
|
305
|
+
|
|
306
|
+
This is an infinite recursive type definition that cannot exist in any
|
|
307
|
+
programming language. A type cannot be defined as itself - this creates
|
|
308
|
+
a circular definition with no base case, making the type impossible to
|
|
309
|
+
instantiate or validate.
|
|
310
|
+
|
|
311
|
+
If you need tree or graph structures, use explicit relationships with
|
|
312
|
+
ID references (e.g., parentId: string) instead of recursive type definitions.
|
|
313
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
314
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
314
315
|
`);
|
|
315
316
|
else if (utils_1.AutoBeOpenApiTypeChecker.isArray(props.schema) &&
|
|
316
317
|
utils_1.AutoBeOpenApiTypeChecker.isReference(props.schema.items) &&
|
|
317
318
|
props.schema.items.$ref === `#/components/schemas/${props.typeName}`)
|
|
318
|
-
report(utils_1.StringUtil.trim `
|
|
319
|
-
You have defined a nonsensible type like below:
|
|
320
|
-
|
|
321
|
-
\`\`\`typescript
|
|
322
|
-
type ${props.typeName} = Array<${props.typeName}>;
|
|
323
|
-
\`\`\`
|
|
324
|
-
|
|
325
|
-
This is an infinite recursive array type that cannot exist in any
|
|
326
|
-
programming language. An array of itself creates a circular definition
|
|
327
|
-
with no base case, making the type impossible to instantiate or validate.
|
|
328
|
-
|
|
329
|
-
If you need nested structures, define explicit depth levels with separate
|
|
330
|
-
types, or use parent-child relationships with ID references.
|
|
331
|
-
Remove the self-reference and redesign the schema at the next time.
|
|
332
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
319
|
+
report(utils_1.StringUtil.trim `
|
|
320
|
+
You have defined a nonsensible type like below:
|
|
321
|
+
|
|
322
|
+
\`\`\`typescript
|
|
323
|
+
type ${props.typeName} = Array<${props.typeName}>;
|
|
324
|
+
\`\`\`
|
|
325
|
+
|
|
326
|
+
This is an infinite recursive array type that cannot exist in any
|
|
327
|
+
programming language. An array of itself creates a circular definition
|
|
328
|
+
with no base case, making the type impossible to instantiate or validate.
|
|
329
|
+
|
|
330
|
+
If you need nested structures, define explicit depth levels with separate
|
|
331
|
+
types, or use parent-child relationships with ID references.
|
|
332
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
333
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
333
334
|
`);
|
|
334
335
|
else if (utils_1.AutoBeOpenApiTypeChecker.isOneOf(props.schema) &&
|
|
335
336
|
props.schema.oneOf.some((v) => utils_1.AutoBeOpenApiTypeChecker.isReference(v) &&
|
|
336
337
|
v.$ref === `#/components/schemas/${props.typeName}`) === true)
|
|
337
|
-
report(utils_1.StringUtil.trim `
|
|
338
|
-
You have defined a nonsensible type like below:
|
|
339
|
-
|
|
340
|
-
\`\`\`typescript
|
|
341
|
-
type ${props.typeName} = ${props.typeName} | ...;
|
|
342
|
-
\`\`\`
|
|
343
|
-
|
|
344
|
-
This is an infinite recursive union type that cannot exist in any
|
|
345
|
-
programming language. A union that includes itself as a variant creates
|
|
346
|
-
a circular definition with no base case, making the type impossible to
|
|
347
|
-
instantiate or validate.
|
|
348
|
-
|
|
349
|
-
If you need polymorphic hierarchies, define separate concrete types for
|
|
350
|
-
each variant without including the union type itself as a variant.
|
|
351
|
-
Remove the self-reference and redesign the schema at the next time.
|
|
352
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
338
|
+
report(utils_1.StringUtil.trim `
|
|
339
|
+
You have defined a nonsensible type like below:
|
|
340
|
+
|
|
341
|
+
\`\`\`typescript
|
|
342
|
+
type ${props.typeName} = ${props.typeName} | ...;
|
|
343
|
+
\`\`\`
|
|
344
|
+
|
|
345
|
+
This is an infinite recursive union type that cannot exist in any
|
|
346
|
+
programming language. A union that includes itself as a variant creates
|
|
347
|
+
a circular definition with no base case, making the type impossible to
|
|
348
|
+
instantiate or validate.
|
|
349
|
+
|
|
350
|
+
If you need polymorphic hierarchies, define separate concrete types for
|
|
351
|
+
each variant without including the union type itself as a variant.
|
|
352
|
+
Remove the self-reference and redesign the schema at the next time.
|
|
353
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
353
354
|
`);
|
|
354
355
|
else if (utils_1.AutoBeOpenApiTypeChecker.isObject(props.schema) &&
|
|
355
356
|
props.schema.properties &&
|
|
@@ -357,28 +358,28 @@ var AutoBeJsonSchemaValidator;
|
|
|
357
358
|
Object.entries(props.schema.properties).some(([k, v]) => utils_1.AutoBeOpenApiTypeChecker.isReference(v) &&
|
|
358
359
|
v.$ref === `#/components/schemas/${props.typeName}` &&
|
|
359
360
|
props.schema.required.includes(k)))
|
|
360
|
-
report(utils_1.StringUtil.trim `
|
|
361
|
-
You have defined a nonsensible type like below:
|
|
362
|
-
|
|
363
|
-
\`\`\`typescript
|
|
364
|
-
interface ${props.typeName} {
|
|
365
|
-
someProperty: ${props.typeName}; // required, non-nullable
|
|
366
|
-
}
|
|
367
|
-
\`\`\`
|
|
368
|
-
|
|
369
|
-
This is an infinite recursive object type that cannot exist in any
|
|
370
|
-
programming language. A required non-nullable property referencing its
|
|
371
|
-
own type creates a circular definition with no base case, making the
|
|
372
|
-
type impossible to instantiate.
|
|
373
|
-
|
|
374
|
-
To create an instance of ${props.typeName}, you would need an instance of ${props.typeName},
|
|
375
|
-
which requires another instance of ${props.typeName}, infinitely. This is logically
|
|
376
|
-
impossible.
|
|
377
|
-
|
|
378
|
-
If you need parent-child or graph relationships, make the self-referencing
|
|
379
|
-
property either nullable or optional, or use ID references (e.g., parentId: string).
|
|
380
|
-
Remove the required self-reference and redesign the schema at the next time.
|
|
381
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
361
|
+
report(utils_1.StringUtil.trim `
|
|
362
|
+
You have defined a nonsensible type like below:
|
|
363
|
+
|
|
364
|
+
\`\`\`typescript
|
|
365
|
+
interface ${props.typeName} {
|
|
366
|
+
someProperty: ${props.typeName}; // required, non-nullable
|
|
367
|
+
}
|
|
368
|
+
\`\`\`
|
|
369
|
+
|
|
370
|
+
This is an infinite recursive object type that cannot exist in any
|
|
371
|
+
programming language. A required non-nullable property referencing its
|
|
372
|
+
own type creates a circular definition with no base case, making the
|
|
373
|
+
type impossible to instantiate.
|
|
374
|
+
|
|
375
|
+
To create an instance of ${props.typeName}, you would need an instance of ${props.typeName},
|
|
376
|
+
which requires another instance of ${props.typeName}, infinitely. This is logically
|
|
377
|
+
impossible.
|
|
378
|
+
|
|
379
|
+
If you need parent-child or graph relationships, make the self-referencing
|
|
380
|
+
property either nullable or optional, or use ID references (e.g., parentId: string).
|
|
381
|
+
Remove the required self-reference and redesign the schema at the next time.
|
|
382
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
382
383
|
`);
|
|
383
384
|
};
|
|
384
385
|
const validateObjectType = (props) => {
|
|
@@ -397,23 +398,23 @@ var AutoBeJsonSchemaValidator;
|
|
|
397
398
|
path: props.path,
|
|
398
399
|
expected: `AutoBeOpenApi.IJsonSchemaDescriptive.IObject`,
|
|
399
400
|
value: schema,
|
|
400
|
-
description: utils_1.StringUtil.trim `
|
|
401
|
-
Root schema types (used in requestBody or responseBody of operations)
|
|
402
|
-
must be defined as object types.
|
|
403
|
-
|
|
404
|
-
This is the rule enforced to ensure consistent API design and to facilitate easier data handling.
|
|
405
|
-
Even though you think that defining a non-object type is more convenient for your specific use case,
|
|
406
|
-
just follow the rule without any resistance.
|
|
407
|
-
|
|
408
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
409
|
-
|
|
410
|
-
If current type is hard to be defined as an object type, just wrap it in an object type like below:
|
|
411
|
-
|
|
412
|
-
\`\`\`typescript
|
|
413
|
-
{
|
|
414
|
-
value: T;
|
|
415
|
-
}
|
|
416
|
-
\`\`\`
|
|
401
|
+
description: utils_1.StringUtil.trim `
|
|
402
|
+
Root schema types (used in requestBody or responseBody of operations)
|
|
403
|
+
must be defined as object types.
|
|
404
|
+
|
|
405
|
+
This is the rule enforced to ensure consistent API design and to facilitate easier data handling.
|
|
406
|
+
Even though you think that defining a non-object type is more convenient for your specific use case,
|
|
407
|
+
just follow the rule without any resistance.
|
|
408
|
+
|
|
409
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
410
|
+
|
|
411
|
+
If current type is hard to be defined as an object type, just wrap it in an object type like below:
|
|
412
|
+
|
|
413
|
+
\`\`\`typescript
|
|
414
|
+
{
|
|
415
|
+
value: T;
|
|
416
|
+
}
|
|
417
|
+
\`\`\`
|
|
417
418
|
`,
|
|
418
419
|
});
|
|
419
420
|
else if (key.endsWith(".IRequest") ||
|
|
@@ -428,22 +429,22 @@ var AutoBeJsonSchemaValidator;
|
|
|
428
429
|
path: props.path,
|
|
429
430
|
expected: `AutoBeOpenApi.IJsonSchemaDescriptive.IObject`,
|
|
430
431
|
value: schema,
|
|
431
|
-
description: utils_1.StringUtil.trim `
|
|
432
|
-
DTO type of .${key.split(".").pop()} suffix must be defined as an object type.
|
|
433
|
-
|
|
434
|
-
This is the rule enforced to ensure consistent API design and to facilitate easier data handling.
|
|
435
|
-
Even though you think that defining a non-object type is more convenient for your specific use case,
|
|
436
|
-
just follow the rule without any resistance.
|
|
437
|
-
|
|
438
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
439
|
-
|
|
440
|
-
If current type is hard to be defined as an object type, just wrap it in an object type like below:
|
|
441
|
-
|
|
442
|
-
\`\`\`typescript
|
|
443
|
-
{
|
|
444
|
-
value: T;
|
|
445
|
-
}
|
|
446
|
-
\`\`\`
|
|
432
|
+
description: utils_1.StringUtil.trim `
|
|
433
|
+
DTO type of .${key.split(".").pop()} suffix must be defined as an object type.
|
|
434
|
+
|
|
435
|
+
This is the rule enforced to ensure consistent API design and to facilitate easier data handling.
|
|
436
|
+
Even though you think that defining a non-object type is more convenient for your specific use case,
|
|
437
|
+
just follow the rule without any resistance.
|
|
438
|
+
|
|
439
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
440
|
+
|
|
441
|
+
If current type is hard to be defined as an object type, just wrap it in an object type like below:
|
|
442
|
+
|
|
443
|
+
\`\`\`typescript
|
|
444
|
+
{
|
|
445
|
+
value: T;
|
|
446
|
+
}
|
|
447
|
+
\`\`\`
|
|
447
448
|
`,
|
|
448
449
|
});
|
|
449
450
|
};
|
|
@@ -462,27 +463,27 @@ var AutoBeJsonSchemaValidator;
|
|
|
462
463
|
if (inspect(value) === false)
|
|
463
464
|
props.errors.push({
|
|
464
465
|
path: accessor,
|
|
465
|
-
expected: utils_1.StringUtil.trim `
|
|
466
|
-
| { type: "string"; format: "uuid"; description: string; }
|
|
467
|
-
| {
|
|
468
|
-
oneOf: [
|
|
469
|
-
{ type: "string"; format: "uuid"; },
|
|
470
|
-
{ type: "null"; },
|
|
471
|
-
];
|
|
472
|
-
description: string;
|
|
466
|
+
expected: utils_1.StringUtil.trim `
|
|
467
|
+
| { type: "string"; format: "uuid"; description: string; }
|
|
468
|
+
| {
|
|
469
|
+
oneOf: [
|
|
470
|
+
{ type: "string"; format: "uuid"; },
|
|
471
|
+
{ type: "null"; },
|
|
472
|
+
];
|
|
473
|
+
description: string;
|
|
473
474
|
}`,
|
|
474
475
|
value,
|
|
475
|
-
description: utils_1.StringUtil.trim `
|
|
476
|
-
Property names "id" or ending with "_id" must be defined as
|
|
477
|
-
UUID string type, or nullable UUID string type.
|
|
478
|
-
|
|
479
|
-
This is the rule enforced to ensure consistent identification of
|
|
480
|
-
resources across the API. Even though you think that defining a
|
|
481
|
-
different type is more convenient for your specific use case,
|
|
482
|
-
just follow the rule without any resistance.
|
|
483
|
-
|
|
484
|
-
Note that, this is not a recommendation, but an instruction you
|
|
485
|
-
must follow.
|
|
476
|
+
description: utils_1.StringUtil.trim `
|
|
477
|
+
Property names "id" or ending with "_id" must be defined as
|
|
478
|
+
UUID string type, or nullable UUID string type.
|
|
479
|
+
|
|
480
|
+
This is the rule enforced to ensure consistent identification of
|
|
481
|
+
resources across the API. Even though you think that defining a
|
|
482
|
+
different type is more convenient for your specific use case,
|
|
483
|
+
just follow the rule without any resistance.
|
|
484
|
+
|
|
485
|
+
Note that, this is not a recommendation, but an instruction you
|
|
486
|
+
must follow.
|
|
486
487
|
`,
|
|
487
488
|
});
|
|
488
489
|
}
|
|
@@ -496,17 +497,17 @@ var AutoBeJsonSchemaValidator;
|
|
|
496
497
|
path: `${props.path}.properties${utils_2.NamingConvention.variable(key) ? `.${key}` : `[${JSON.stringify(key)}]`}`,
|
|
497
498
|
expected: `none system reserved word`,
|
|
498
499
|
value: key,
|
|
499
|
-
description: utils_1.StringUtil.trim `
|
|
500
|
-
Property name ${JSON.stringify(key)} is a system reserved word.
|
|
501
|
-
|
|
502
|
-
Avoid using system reserved words as property names to prevent
|
|
503
|
-
potential conflicts and ensure clarity in your API design.
|
|
504
|
-
|
|
505
|
-
Change the property name ${JSON.stringify(key)} to a non-reserved
|
|
506
|
-
word at the next time.
|
|
507
|
-
|
|
508
|
-
Note that, this is not a recommendation, but an instruction you
|
|
509
|
-
must follow.
|
|
500
|
+
description: utils_1.StringUtil.trim `
|
|
501
|
+
Property name ${JSON.stringify(key)} is a system reserved word.
|
|
502
|
+
|
|
503
|
+
Avoid using system reserved words as property names to prevent
|
|
504
|
+
potential conflicts and ensure clarity in your API design.
|
|
505
|
+
|
|
506
|
+
Change the property name ${JSON.stringify(key)} to a non-reserved
|
|
507
|
+
word at the next time.
|
|
508
|
+
|
|
509
|
+
Note that, this is not a recommendation, but an instruction you
|
|
510
|
+
must follow.
|
|
510
511
|
`,
|
|
511
512
|
});
|
|
512
513
|
else if (utils_2.NamingConvention.variable(key) === false)
|
|
@@ -514,18 +515,18 @@ var AutoBeJsonSchemaValidator;
|
|
|
514
515
|
path: `${props.path}.properties${utils_2.NamingConvention.variable(key) ? `.${key}` : `[${JSON.stringify(key)}]`}`,
|
|
515
516
|
expected: `valid variable name`,
|
|
516
517
|
value: key,
|
|
517
|
-
description: utils_1.StringUtil.trim `
|
|
518
|
-
Property name ${JSON.stringify(key)} must be a valid variable name.
|
|
519
|
-
|
|
520
|
-
Valid variable names start with a letter, underscore (_), or dollar sign ($),
|
|
521
|
-
followed by letters, digits, underscores, or dollar signs. They cannot
|
|
522
|
-
contain spaces or special characters.
|
|
523
|
-
|
|
524
|
-
Change the property name ${JSON.stringify(key)} to a valid variable
|
|
525
|
-
name at the next time.
|
|
526
|
-
|
|
527
|
-
Note that, this is not a recommendation, but an instruction you
|
|
528
|
-
must follow.
|
|
518
|
+
description: utils_1.StringUtil.trim `
|
|
519
|
+
Property name ${JSON.stringify(key)} must be a valid variable name.
|
|
520
|
+
|
|
521
|
+
Valid variable names start with a letter, underscore (_), or dollar sign ($),
|
|
522
|
+
followed by letters, digits, underscores, or dollar signs. They cannot
|
|
523
|
+
contain spaces or special characters.
|
|
524
|
+
|
|
525
|
+
Change the property name ${JSON.stringify(key)} to a valid variable
|
|
526
|
+
name at the next time.
|
|
527
|
+
|
|
528
|
+
Note that, this is not a recommendation, but an instruction you
|
|
529
|
+
must follow.
|
|
529
530
|
`,
|
|
530
531
|
});
|
|
531
532
|
}
|
|
@@ -545,12 +546,12 @@ var AutoBeJsonSchemaValidator;
|
|
|
545
546
|
path: accessor,
|
|
546
547
|
expected: "minimum <= maximum",
|
|
547
548
|
value: schema,
|
|
548
|
-
description: utils_1.StringUtil.trim `
|
|
549
|
-
Invalid numeric range: minimum (${minimum}) is greater than maximum (${maximum}).
|
|
550
|
-
|
|
551
|
-
This creates an impossible range where no value can satisfy both constraints.
|
|
552
|
-
Either increase maximum or decrease minimum to create a valid range.
|
|
553
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
549
|
+
description: utils_1.StringUtil.trim `
|
|
550
|
+
Invalid numeric range: minimum (${minimum}) is greater than maximum (${maximum}).
|
|
551
|
+
|
|
552
|
+
This creates an impossible range where no value can satisfy both constraints.
|
|
553
|
+
Either increase maximum or decrease minimum to create a valid range.
|
|
554
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
554
555
|
`,
|
|
555
556
|
});
|
|
556
557
|
// Case 2: exclusiveMinimum >= exclusiveMaximum
|
|
@@ -561,13 +562,13 @@ var AutoBeJsonSchemaValidator;
|
|
|
561
562
|
path: accessor,
|
|
562
563
|
expected: "exclusiveMinimum < exclusiveMaximum",
|
|
563
564
|
value: schema,
|
|
564
|
-
description: utils_1.StringUtil.trim `
|
|
565
|
-
Invalid numeric range: exclusiveMinimum (${exclusiveMinimum}) is greater than
|
|
566
|
-
or equal to exclusiveMaximum (${exclusiveMaximum}).
|
|
567
|
-
|
|
568
|
-
This creates an impossible range where no value can satisfy both constraints.
|
|
569
|
-
Either increase exclusiveMaximum or decrease exclusiveMinimum to create a valid range.
|
|
570
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
565
|
+
description: utils_1.StringUtil.trim `
|
|
566
|
+
Invalid numeric range: exclusiveMinimum (${exclusiveMinimum}) is greater than
|
|
567
|
+
or equal to exclusiveMaximum (${exclusiveMaximum}).
|
|
568
|
+
|
|
569
|
+
This creates an impossible range where no value can satisfy both constraints.
|
|
570
|
+
Either increase exclusiveMaximum or decrease exclusiveMinimum to create a valid range.
|
|
571
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
571
572
|
`,
|
|
572
573
|
});
|
|
573
574
|
// Case 3: minimum >= exclusiveMaximum
|
|
@@ -578,14 +579,14 @@ var AutoBeJsonSchemaValidator;
|
|
|
578
579
|
path: accessor,
|
|
579
580
|
expected: "minimum < exclusiveMaximum",
|
|
580
581
|
value: schema,
|
|
581
|
-
description: utils_1.StringUtil.trim `
|
|
582
|
-
Invalid numeric range: minimum (${minimum}) is greater than or equal to
|
|
583
|
-
exclusiveMaximum (${exclusiveMaximum}).
|
|
584
|
-
|
|
585
|
-
This creates an impossible range. A value cannot be >= ${minimum} and < ${exclusiveMaximum}
|
|
586
|
-
at the same time when minimum >= exclusiveMaximum.
|
|
587
|
-
Either increase exclusiveMaximum or decrease minimum to create a valid range.
|
|
588
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
582
|
+
description: utils_1.StringUtil.trim `
|
|
583
|
+
Invalid numeric range: minimum (${minimum}) is greater than or equal to
|
|
584
|
+
exclusiveMaximum (${exclusiveMaximum}).
|
|
585
|
+
|
|
586
|
+
This creates an impossible range. A value cannot be >= ${minimum} and < ${exclusiveMaximum}
|
|
587
|
+
at the same time when minimum >= exclusiveMaximum.
|
|
588
|
+
Either increase exclusiveMaximum or decrease minimum to create a valid range.
|
|
589
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
589
590
|
`,
|
|
590
591
|
});
|
|
591
592
|
// Case 4: exclusiveMinimum >= maximum
|
|
@@ -596,14 +597,14 @@ var AutoBeJsonSchemaValidator;
|
|
|
596
597
|
path: accessor,
|
|
597
598
|
expected: "exclusiveMinimum < maximum",
|
|
598
599
|
value: schema,
|
|
599
|
-
description: utils_1.StringUtil.trim `
|
|
600
|
-
Invalid numeric range: exclusiveMinimum (${exclusiveMinimum}) is greater than
|
|
601
|
-
or equal to maximum (${maximum}).
|
|
602
|
-
|
|
603
|
-
This creates an impossible range. A value cannot be > ${exclusiveMinimum} and <= ${maximum}
|
|
604
|
-
at the same time when exclusiveMinimum >= maximum.
|
|
605
|
-
Either increase maximum or decrease exclusiveMinimum to create a valid range.
|
|
606
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
600
|
+
description: utils_1.StringUtil.trim `
|
|
601
|
+
Invalid numeric range: exclusiveMinimum (${exclusiveMinimum}) is greater than
|
|
602
|
+
or equal to maximum (${maximum}).
|
|
603
|
+
|
|
604
|
+
This creates an impossible range. A value cannot be > ${exclusiveMinimum} and <= ${maximum}
|
|
605
|
+
at the same time when exclusiveMinimum >= maximum.
|
|
606
|
+
Either increase maximum or decrease exclusiveMinimum to create a valid range.
|
|
607
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
607
608
|
`,
|
|
608
609
|
});
|
|
609
610
|
// Case 5: minimum === maximum with exclusive constraints
|
|
@@ -615,14 +616,14 @@ var AutoBeJsonSchemaValidator;
|
|
|
615
616
|
path: accessor,
|
|
616
617
|
expected: "no exclusive constraints when minimum equals maximum",
|
|
617
618
|
value: schema,
|
|
618
|
-
description: utils_1.StringUtil.trim `
|
|
619
|
-
Invalid numeric range: minimum equals maximum (${minimum}), but exclusive
|
|
620
|
-
constraints are also defined.
|
|
621
|
-
|
|
622
|
-
When minimum === maximum, the only valid value is exactly ${minimum}.
|
|
623
|
-
Adding exclusiveMinimum or exclusiveMaximum makes this impossible.
|
|
624
|
-
Remove the exclusive constraints or adjust minimum/maximum to create a valid range.
|
|
625
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
619
|
+
description: utils_1.StringUtil.trim `
|
|
620
|
+
Invalid numeric range: minimum equals maximum (${minimum}), but exclusive
|
|
621
|
+
constraints are also defined.
|
|
622
|
+
|
|
623
|
+
When minimum === maximum, the only valid value is exactly ${minimum}.
|
|
624
|
+
Adding exclusiveMinimum or exclusiveMaximum makes this impossible.
|
|
625
|
+
Remove the exclusive constraints or adjust minimum/maximum to create a valid range.
|
|
626
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
626
627
|
`,
|
|
627
628
|
});
|
|
628
629
|
// Case 6: negative multipleOf
|
|
@@ -631,16 +632,48 @@ var AutoBeJsonSchemaValidator;
|
|
|
631
632
|
path: accessor,
|
|
632
633
|
expected: "multipleOf > 0",
|
|
633
634
|
value: schema,
|
|
634
|
-
description: utils_1.StringUtil.trim `
|
|
635
|
-
Invalid multipleOf value: ${schema.multipleOf}.
|
|
636
|
-
|
|
637
|
-
The multipleOf constraint must be a positive number greater than zero.
|
|
638
|
-
Change multipleOf to a positive value.
|
|
639
|
-
Note that, this is not a recommendation, but an instruction you must follow.
|
|
635
|
+
description: utils_1.StringUtil.trim `
|
|
636
|
+
Invalid multipleOf value: ${schema.multipleOf}.
|
|
637
|
+
|
|
638
|
+
The multipleOf constraint must be a positive number greater than zero.
|
|
639
|
+
Change multipleOf to a positive value.
|
|
640
|
+
Note that, this is not a recommendation, but an instruction you must follow.
|
|
640
641
|
`,
|
|
641
642
|
});
|
|
642
643
|
},
|
|
643
644
|
});
|
|
644
645
|
};
|
|
646
|
+
// const validateEmptyProperties = (props: IProps): void => {
|
|
647
|
+
// if (AutoBeOpenApiTypeChecker.isObject(props.schema) === false) return;
|
|
648
|
+
// if (Object.keys(props.schema.properties).length !== 0) return;
|
|
649
|
+
// if (
|
|
650
|
+
// isObjectType({
|
|
651
|
+
// operations: props.operations,
|
|
652
|
+
// typeName: props.typeName,
|
|
653
|
+
// }) === false
|
|
654
|
+
// )
|
|
655
|
+
// return;
|
|
656
|
+
// props.errors.push({
|
|
657
|
+
// path: `${props.path}.properties`,
|
|
658
|
+
// expected: "At least 1 property in properties",
|
|
659
|
+
// value: props.schema.properties,
|
|
660
|
+
// description: StringUtil.trim`
|
|
661
|
+
// Schema ${JSON.stringify(props.typeName)} has zero properties but is used
|
|
662
|
+
// as a request body or response body in API operations.
|
|
663
|
+
// Empty properties will cause TypeScript compilation errors (TS2339) in the
|
|
664
|
+
// downstream Realize stage because implementation code will try to access
|
|
665
|
+
// properties that don't exist on the type.
|
|
666
|
+
// You MUST define at least one property in the schema. Load the database
|
|
667
|
+
// schema and add the appropriate properties based on the DTO type:
|
|
668
|
+
// - ICreate: User-provided business fields (exclude id, timestamps, actor FKs)
|
|
669
|
+
// - IUpdate: All mutable business fields (all optional)
|
|
670
|
+
// - ISummary: Essential display fields for list views
|
|
671
|
+
// - IEntity (root): All public fields including relations
|
|
672
|
+
// - IRequest: Pagination and filter parameters
|
|
673
|
+
// - IJoin/ILogin: Credentials and session context fields
|
|
674
|
+
// Note that, this is not a recommendation, but an instruction you must follow.
|
|
675
|
+
// `,
|
|
676
|
+
// });
|
|
677
|
+
// };
|
|
645
678
|
})(AutoBeJsonSchemaValidator || (exports.AutoBeJsonSchemaValidator = AutoBeJsonSchemaValidator = {}));
|
|
646
679
|
//# sourceMappingURL=AutoBeJsonSchemaValidator.js.map
|