@@ -169,24 +169,83 @@ export namespace ISwaggerSchema {
169169 * Path of the endpoint.
170170 */
171171 path : string ;
172-
173- /**
174- * Function returning transformed values using JMESPath expression.
175- *
176- * `Prerequisite.Props.jmesPath` is a string typed property that extracts desired values
177- * from the prerequisite API response using a JMESPath expression. This property simplifies
178- * and replaces the `label`, `value`, and `array` properties.
179- *
180- * JMESPath expressions are used to extract the desired data based on the API response.
181- * The expression must always be a valid JMESPath syntax.
182- *
183- * - Type: `jmesPath: string`
184- * - Example: `"members[*].data.title"`
185- * - Usage: `jmespath.search(response, jmesPath)`
186- *
187- * Note: The `label`, `value`, and `array` properties are no longer in use.
188- */
189- jmesPath : string ;
190- } ;
172+ } & (
173+ | {
174+ /**
175+ * Function returning transformed values using JMESPath expression.
176+ *
177+ * `Prerequisite.Props.jmesPath` is a string typed property that extracts desired values
178+ * from the prerequisite API response using a JMESPath expression. This property simplifies
179+ * and replaces the `label`, `value`, and `array` properties.
180+ *
181+ * JMESPath expressions are used to extract the desired data based on the API response.
182+ * The expression must always be a valid JMESPath syntax.
183+ *
184+ * - Type: `jmesPath: string`
185+ * - Example: `"members[*].data.title"`
186+ * - Usage: `jmespath.search(response, jmesPath)`
187+ *
188+ * Note: The `label`, `value`, and `array` properties are no longer in use.
189+ */
190+ jmesPath : string ;
191+ }
192+ | {
193+ /**
194+ * Transform function returning label.
195+ *
196+ * `Prerequisite.Props.label` is a string typed property representing
197+ * a function returning the label from the element instance of the
198+ * prerequisite API respond array.
199+ *
200+ * The function script must be a string value that can be parsed by
201+ * `new Function(string)` statement. Also, its parameter names are
202+ * always `elem`, `index` and `array`. Of course, the function's
203+ * return type must be always `string`.
204+ *
205+ * - type: `label: (elem: Element, index: number, array: Element[]) => string`
206+ * - example: `return elem.title`
207+ * - how to use: `new Function("elem", "index", "array", labelScript)(...)`
208+ */
209+ label : string ;
210+
211+ /**
212+ * Transform function returning target value.
213+ *
214+ * `Prerequisite.Props.value` is a string typed property representing
215+ * a function returning the target value from the element instance of
216+ * the prerequisite API respond array. If you've defined this `Prerequisite`
217+ * type to a `number` type, the returned value must be actual number type.
218+ *
219+ * The function script must be a string value that can be parsed by
220+ * `new Function(string)` statement. Also, its parameter names are always
221+ * `elem`, `index` and `array`.
222+ *
223+ * - type: `value: (elem: Element, index: number, array: Element[]) => Value`
224+ * - example: `return elem.no`
225+ * - how to use: `new Function("elem", "index", "array", valueScript)(...)`
226+ */
227+ value : string ;
228+
229+ /**
230+ * Transform function returning array instance.
231+ *
232+ * `Prerequisite.Props.array` is a string typed property representing
233+ * a function returning an array instance from the response of the
234+ * prerequisite API.
235+ *
236+ * The function script must be a string value that can be parsed by
237+ * `new Function(string)` statement. Also, its parameter name is
238+ * always `response`.
239+ *
240+ * If the prerequisite API responses an array and it is the desired one,
241+ * you don't need to specify this property.
242+ *
243+ * - type: `array: (response: Response) => Elemenet[]`
244+ * - example: `return response.members.map(m => m.data)`
245+ * - how to use: `new Function("response", arrayScript)(response)`
246+ */
247+ array ?: string ;
248+ }
249+ ) ;
191250 }
192251}
0 commit comments