@digi-frontend/dgate-api-documentation 1.0.56 → 1.0.57
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/dist/_virtual/index4.js +1 -1
- package/dist/_virtual/index5.js +1 -1
- package/dist/_virtual/index6.js +1 -1
- package/dist/_virtual/index7.js +1 -1
- package/dist/node_modules/toposort/index.js +1 -1
- package/dist/node_modules/yup/index.esm.js +1 -1
- package/dist/src/components/LivePreview/LivePreview.js +1 -1
- package/dist/src/components/LivePreview/LivePreview.js.map +1 -1
- package/dist/src/components/MethodAccordion/MethodAccordion.js +1 -1
- package/dist/src/components/MethodAccordion/MethodAccordion.js.map +1 -1
- package/dist/src/components/table/table.js +1 -1
- package/dist/src/components/table/table.js.map +1 -1
- package/dist/src/components/table/tags-table.js +1 -1
- package/dist/src/components/table/tags-table.js.map +1 -1
- package/dist/styles.css +241 -238
- package/package.json +1 -1
- package/src/components/LivePreview/LivePreview.module.scss +15 -14
- package/src/components/LivePreview/LivePreview.tsx +1 -0
- package/src/components/MethodAccordion/MethodAccordion.tsx +101 -110
- package/src/components/table/table.tsx +39 -32
- package/src/components/table/tags-table.tsx +2 -2
|
@@ -59,7 +59,8 @@ const MethodsAccordion = ({
|
|
|
59
59
|
response: false,
|
|
60
60
|
method: false,
|
|
61
61
|
})
|
|
62
|
-
const [isFormOpen, setIsFormOpen] = useState<
|
|
62
|
+
const [isFormOpen, setIsFormOpen] = useState<boolean>(false)
|
|
63
|
+
const [isHeaderFormOpen, setIsHeaderFormOpen] = useState<boolean>(false)
|
|
63
64
|
const [tooltipRefs, setTooltipRefs] = useState<{ [key: number]: any }>({})
|
|
64
65
|
const [tableData, setTableData] = useState([])
|
|
65
66
|
const [tableResponseData, setTableResponseData] = useState([])
|
|
@@ -248,114 +249,102 @@ const MethodsAccordion = ({
|
|
|
248
249
|
<span className="enumText">{data?.schema?.enum?.join('/\u200B')}</span>
|
|
249
250
|
) : (
|
|
250
251
|
<div data-id="TEXT_DESCRIPTION" className="tableData">
|
|
251
|
-
{
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
/>
|
|
292
|
-
)
|
|
293
|
-
)}
|
|
294
|
-
<p
|
|
295
|
-
className={'addEnumButton'}
|
|
296
|
-
onClick={() => {
|
|
297
|
-
setFieldValue(
|
|
298
|
-
`responses[${currentResponse}].headers[${index}].schema.enum`,
|
|
299
|
-
[...method.responses[responseIndex]?.headers[index]?.schema?.enum, '']
|
|
300
|
-
)
|
|
301
|
-
}}
|
|
302
|
-
>
|
|
303
|
-
<SVGLoader src={PlusSquare} />
|
|
304
|
-
Add New Enum
|
|
305
|
-
</p>
|
|
306
|
-
{!readOnly && (
|
|
307
|
-
<Button
|
|
308
|
-
className={styles.editDescTooltipContent_btn}
|
|
309
|
-
variant="outlined"
|
|
310
|
-
size="small"
|
|
311
|
-
type="button"
|
|
252
|
+
{(() => {
|
|
253
|
+
const schema = method?.responses[currentResponseIndex]?.headers[item]?.schema
|
|
254
|
+
const schemaType = schema?.type?.toLowerCase()
|
|
255
|
+
const isComplex = schemaType === 'array' || schemaType === 'object'
|
|
256
|
+
const enumList = schema?.enum || []
|
|
257
|
+
|
|
258
|
+
if (!schema || isComplex) return '-'
|
|
259
|
+
|
|
260
|
+
return (
|
|
261
|
+
<Tooltip
|
|
262
|
+
disabled={isComplex}
|
|
263
|
+
arrowWithBorder
|
|
264
|
+
placement="bottom-end"
|
|
265
|
+
type="function"
|
|
266
|
+
trigger="click"
|
|
267
|
+
delay={[0, 0]}
|
|
268
|
+
onCreate={(instance) => setTooltipEnumRef(instance)}
|
|
269
|
+
content={
|
|
270
|
+
<div className={styles.editDescTooltipContent}>
|
|
271
|
+
<p className={styles.editDescTooltipContent_header}>Enum</p>
|
|
272
|
+
|
|
273
|
+
{enumList.map((enumVal, enumIndex) => (
|
|
274
|
+
<Input
|
|
275
|
+
key={enumIndex}
|
|
276
|
+
className="methodDescForEnum"
|
|
277
|
+
required
|
|
278
|
+
clearable={false}
|
|
279
|
+
placeholder="Enter Enum value..."
|
|
280
|
+
value={enumVal}
|
|
281
|
+
onChange={(value) => {
|
|
282
|
+
setFieldValue(
|
|
283
|
+
`responses[${currentResponseIndex}].headers["${item}"].schema.enum[${enumIndex}]`,
|
|
284
|
+
value
|
|
285
|
+
)
|
|
286
|
+
}}
|
|
287
|
+
/>
|
|
288
|
+
))}
|
|
289
|
+
|
|
290
|
+
<p
|
|
291
|
+
className="addEnumButton"
|
|
312
292
|
onClick={() => {
|
|
313
293
|
setFieldValue(
|
|
314
|
-
`responses[${
|
|
315
|
-
[...
|
|
294
|
+
`responses[${currentResponseIndex}].headers["${item}"].schema.enum`,
|
|
295
|
+
[...enumList, '']
|
|
316
296
|
)
|
|
317
|
-
setEnumFields([])
|
|
318
|
-
tooltipEnumRef?.hide()
|
|
319
297
|
}}
|
|
320
|
-
disabled={
|
|
321
|
-
(enumFields.length > 0 &&
|
|
322
|
-
enumFields?.filter((item) => !item).length) ||
|
|
323
|
-
(method?.parameters[index]?.schema?.enum &&
|
|
324
|
-
method?.parameters[index]?.schema?.enum?.length > 0 &&
|
|
325
|
-
method?.parameters[index]?.schema?.enum?.filter((item) => !item)
|
|
326
|
-
.length)
|
|
327
|
-
}
|
|
328
298
|
>
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
299
|
+
<SVGLoader src={PlusSquare} />
|
|
300
|
+
Add New Enum
|
|
301
|
+
</p>
|
|
302
|
+
|
|
303
|
+
{!readOnly && (
|
|
304
|
+
<Button
|
|
305
|
+
className={styles.editDescTooltipContent_btn}
|
|
306
|
+
variant="outlined"
|
|
307
|
+
size="small"
|
|
308
|
+
type="button"
|
|
309
|
+
onClick={() => {
|
|
310
|
+
setFieldValue(
|
|
311
|
+
`responses[${currentResponseIndex}].headers["${item}"].schema.enum`,
|
|
312
|
+
[...enumList]
|
|
313
|
+
)
|
|
314
|
+
setEnumFields([])
|
|
315
|
+
tooltipEnumRef?.hide()
|
|
316
|
+
}}
|
|
317
|
+
disabled={enumList.length === 0 || enumList.some((val) => !val)}
|
|
318
|
+
>
|
|
319
|
+
Apply
|
|
320
|
+
</Button>
|
|
321
|
+
)}
|
|
322
|
+
</div>
|
|
323
|
+
}
|
|
324
|
+
>
|
|
325
|
+
{enumList.length > 0 ? (
|
|
326
|
+
<span className="enumText">{enumList.join('/\u200B')}</span>
|
|
327
|
+
) : (
|
|
328
|
+
<Button
|
|
329
|
+
className={styles.editDescBtn}
|
|
330
|
+
id="EnumButton"
|
|
331
|
+
variant="link"
|
|
332
|
+
color="action"
|
|
333
|
+
endIcon={
|
|
334
|
+
<SVGLoader
|
|
335
|
+
id="enumIcon"
|
|
336
|
+
src={PlusIcon}
|
|
337
|
+
width="1.5rem"
|
|
338
|
+
height="1.5rem"
|
|
339
|
+
/>
|
|
340
|
+
}
|
|
341
|
+
>
|
|
342
|
+
Add
|
|
343
|
+
</Button>
|
|
344
|
+
)}
|
|
345
|
+
</Tooltip>
|
|
346
|
+
)
|
|
347
|
+
})()}
|
|
359
348
|
</div>
|
|
360
349
|
)}
|
|
361
350
|
</>
|
|
@@ -695,9 +684,11 @@ const MethodsAccordion = ({
|
|
|
695
684
|
}
|
|
696
685
|
setCurrentResponseIndex(responseIndex)
|
|
697
686
|
indexRef.current = responseIndex
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
687
|
+
if (responseIndex >= 0) {
|
|
688
|
+
setTableResponseRecords(
|
|
689
|
+
generateResponseTableData(method.responses[responseIndex].headers, responseIndex)
|
|
690
|
+
)
|
|
691
|
+
}
|
|
701
692
|
}
|
|
702
693
|
}, [selectedStatusCode, method.responses, setFieldValue])
|
|
703
694
|
|
|
@@ -830,7 +821,7 @@ const MethodsAccordion = ({
|
|
|
830
821
|
id="paramter-request-table"
|
|
831
822
|
data={tableRecords}
|
|
832
823
|
headCells={paramsTableHeaders}
|
|
833
|
-
isFormOpen={isFormOpen
|
|
824
|
+
isFormOpen={isFormOpen}
|
|
834
825
|
setIsFormOpen={setIsFormOpen}
|
|
835
826
|
saveNewRow={saveNewRow}
|
|
836
827
|
readOnly={readOnly}
|
|
@@ -903,8 +894,8 @@ const MethodsAccordion = ({
|
|
|
903
894
|
id="paramter-response-table"
|
|
904
895
|
data={tableResponseRecords}
|
|
905
896
|
headCells={paramsTableHeaders}
|
|
906
|
-
isFormOpen={
|
|
907
|
-
setIsFormOpen={
|
|
897
|
+
isFormOpen={isHeaderFormOpen}
|
|
898
|
+
setIsFormOpen={setIsHeaderFormOpen}
|
|
908
899
|
saveNewRow={saveNewResponseRow}
|
|
909
900
|
readOnly={readOnly}
|
|
910
901
|
isRequest={false}
|
|
@@ -164,7 +164,12 @@ const ParamterTable = ({
|
|
|
164
164
|
label: capitalize(values.in),
|
|
165
165
|
value: values.in,
|
|
166
166
|
}}
|
|
167
|
-
onChange={(item) =>
|
|
167
|
+
onChange={(item) => {
|
|
168
|
+
setFieldValue('in', item?.value?.toLowerCase())
|
|
169
|
+
if (item?.value == 'in') {
|
|
170
|
+
setFieldValue('required', true)
|
|
171
|
+
}
|
|
172
|
+
}} // Updates state on selection
|
|
168
173
|
options={[
|
|
169
174
|
{
|
|
170
175
|
list: isRequest
|
|
@@ -186,10 +191,7 @@ const ParamterTable = ({
|
|
|
186
191
|
</td>
|
|
187
192
|
|
|
188
193
|
<td key={'parameter schema type'}>
|
|
189
|
-
<div
|
|
190
|
-
data-id="TEXT_DESCRIPTION"
|
|
191
|
-
className="tableData select-inputs"
|
|
192
|
-
>
|
|
194
|
+
<div data-id="TEXT_DESCRIPTION" className="tableData select-inputs">
|
|
193
195
|
<SelectGroupV2
|
|
194
196
|
disabled={readOnly}
|
|
195
197
|
clearable={false}
|
|
@@ -215,32 +217,32 @@ const ParamterTable = ({
|
|
|
215
217
|
withSearch={false}
|
|
216
218
|
/>{' '}
|
|
217
219
|
{!!values?.schema?.type && values?.schema?.type.toLowerCase() === 'array' ? (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
220
|
+
<SelectGroupV2
|
|
221
|
+
disabled={readOnly}
|
|
222
|
+
clearable={false}
|
|
223
|
+
value={{
|
|
224
|
+
label: capitalize(values?.schema?.items?.type),
|
|
225
|
+
value: values.schema?.items?.type,
|
|
226
|
+
}}
|
|
227
|
+
errorMsg={!!errors?.schema?.items?.type && errors?.schema?.items?.type}
|
|
228
|
+
onChange={(item) =>
|
|
229
|
+
setFieldValue('schema.items.type', item?.value?.toLowerCase())
|
|
230
|
+
} // Updates state on selection
|
|
231
|
+
options={[
|
|
232
|
+
{
|
|
233
|
+
list: [
|
|
234
|
+
{ label: 'String', value: 'string' },
|
|
235
|
+
{ label: 'Integer', value: 'integer' },
|
|
236
|
+
{ label: 'Boolean', value: 'boolean' },
|
|
237
|
+
{ label: 'Object', value: 'object' },
|
|
238
|
+
{ label: 'Array', value: 'array' },
|
|
239
|
+
{ label: 'Number', value: 'number' },
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
]}
|
|
243
|
+
isMultiple={false}
|
|
244
|
+
withSearch={false}
|
|
245
|
+
/>
|
|
244
246
|
) : (
|
|
245
247
|
''
|
|
246
248
|
)}
|
|
@@ -362,7 +364,12 @@ const ParamterTable = ({
|
|
|
362
364
|
<>{values.required ? 'True' : 'False'}</>
|
|
363
365
|
) : (
|
|
364
366
|
<Switch
|
|
365
|
-
checked={
|
|
367
|
+
checked={
|
|
368
|
+
values && values.in && values.in.toLowerCase() == 'path'
|
|
369
|
+
? true
|
|
370
|
+
: values.required
|
|
371
|
+
}
|
|
372
|
+
disabled={values && values.in && values.in.toLowerCase() == 'path'}
|
|
366
373
|
onClick={() => {
|
|
367
374
|
if (readOnly) {
|
|
368
375
|
return
|
|
@@ -16,7 +16,7 @@ const TagsTable = ({ id, headCells, data, isFormOpen, setIsFormOpen, saveNewRow,
|
|
|
16
16
|
const [externalUrl, setExternalUrl] = useState('')
|
|
17
17
|
const [tooltipRef, setTooltipRef] = useState(null)
|
|
18
18
|
const [externalTooltipRefs, setExternalTooltipRefs] = useState(null)
|
|
19
|
-
const { values, errors, setFieldValue, isValid, submitForm, resetForm } = useFormik({
|
|
19
|
+
const { values, errors, setFieldValue, isValid, submitForm, resetForm,dirty } = useFormik({
|
|
20
20
|
validateOnMount: true,
|
|
21
21
|
initialValues: {
|
|
22
22
|
name: '',
|
|
@@ -307,7 +307,7 @@ const TagsTable = ({ id, headCells, data, isFormOpen, setIsFormOpen, saveNewRow,
|
|
|
307
307
|
className={_styles.deleteParamBtn}
|
|
308
308
|
variant="link"
|
|
309
309
|
color="success"
|
|
310
|
-
disabled={!isValid}
|
|
310
|
+
disabled={!isValid || !dirty}
|
|
311
311
|
endIcon={<SVGLoader src={AddRow} width="0.125rem" height="0.125rem" />}
|
|
312
312
|
onClick={() => {
|
|
313
313
|
setText('')
|