@digi-frontend/dgate-api-documentation 1.0.52 → 1.0.53

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digi-frontend/dgate-api-documentation",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "main": "dist/src/index.js",
5
5
  "module": "dist/src/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -100,7 +100,13 @@ const MethodsAccordion = ({
100
100
  id: `header_${index}`,
101
101
  paramName: item,
102
102
  paramType: capitalize('header'),
103
- schemaType: capitalize(data?.schema?.type) || '',
103
+ schemaType: `${capitalize(data?.schema?.type) || ''} ${
104
+ data?.schema?.type?.toLowerCase() == 'array' &&
105
+ data?.schema?.items &&
106
+ data?.schema?.items?.type
107
+ ? ` _ ${capitalize(data?.schema?.items?.type)}`
108
+ : ''
109
+ }`,
104
110
  required: (
105
111
  <>
106
112
  {readOnly ? (
@@ -177,7 +183,6 @@ const MethodsAccordion = ({
177
183
  maxLength={120}
178
184
  onChange={(value) => {
179
185
  if (value === '' || regex.ASCII.test(value)) {
180
- // onResponseTableChange('description', value, item, indexRef.current)
181
186
  setFieldValue(
182
187
  `responses[${indexRef.current}].headers[${item}].description`,
183
188
  value
@@ -362,15 +367,18 @@ const MethodsAccordion = ({
362
367
  }
363
368
 
364
369
  const generateTableData = (items, isForRequest?: boolean) => {
365
- const data = isForRequest
366
- ? items.filter((item) => item.in && item.in.toLowerCase() != 'header')
367
- : items.filter((item) => item.in && item.in.toLowerCase() == 'header')
368
- return data.map((item, index) => {
370
+ return items?.map((item, index) => {
369
371
  return {
370
372
  id: index,
371
373
  paramName: item.name,
372
374
  paramType: capitalize(item.in),
373
- schemaType: capitalize(item.schema?.type) || '',
375
+ schemaType: `${capitalize(item?.schema?.type) || ''} ${
376
+ item?.schema?.type?.toLowerCase() == 'array' &&
377
+ item?.schema?.items &&
378
+ item?.schema?.items?.type
379
+ ? ` _ ${capitalize(item?.schema?.items?.type)}`
380
+ : ''
381
+ }`,
374
382
  required: (
375
383
  <>
376
384
  {readOnly ? (
@@ -652,7 +660,6 @@ const MethodsAccordion = ({
652
660
  }
653
661
 
654
662
  const saveNewResponseRow = (value) => {
655
- // setTableResponseData([...tableResponseData, values])
656
663
  setFieldValue(`responses[${indexRef.current}].headers[${value.name}]`, value)
657
664
  }
658
665
 
@@ -15,6 +15,12 @@ div.endBtnIcon {
15
15
  width: 16.875rem !important;
16
16
  }
17
17
 
18
+ .select-inputs {
19
+ display: flex;
20
+ flex-direction: row;
21
+ gap: .625rem;
22
+ }
23
+
18
24
  .addEnumButton {
19
25
  color: #4d75d8 !important;
20
26
  display: flex;
@@ -186,7 +186,10 @@ const ParamterTable = ({
186
186
  </td>
187
187
 
188
188
  <td key={'parameter schema type'}>
189
- <div data-id="TEXT_DESCRIPTION" className="tableData">
189
+ <div
190
+ data-id="TEXT_DESCRIPTION"
191
+ className="tableData select-inputs"
192
+ >
190
193
  <SelectGroupV2
191
194
  disabled={readOnly}
192
195
  clearable={false}
@@ -211,41 +214,36 @@ const ParamterTable = ({
211
214
  isMultiple={false}
212
215
  withSearch={false}
213
216
  />{' '}
214
- </div>
215
- </td>
216
-
217
- <td key={'parameter array schema type'}>
218
- <div data-id="TEXT_DESCRIPTION" className="tableData">
219
- {values.schema && values.schema?.type?.toLowerCase() == 'array' ? (
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
- />
217
+ {!!values?.schema?.type && values?.schema?.type.toLowerCase() === 'array' ? (
218
+ <SelectGroupV2
219
+ disabled={readOnly}
220
+ clearable={false}
221
+ value={{
222
+ label: capitalize(values?.schema?.items?.type),
223
+ value: values.schema?.items?.type,
224
+ }}
225
+ errorMsg={!!errors?.schema?.items?.type && errors?.schema?.items?.type}
226
+ onChange={(item) =>
227
+ setFieldValue('schema.items.type', item?.value?.toLowerCase())
228
+ } // Updates state on selection
229
+ options={[
230
+ {
231
+ list: [
232
+ { label: 'String', value: 'string' },
233
+ { label: 'Integer', value: 'integer' },
234
+ { label: 'Boolean', value: 'boolean' },
235
+ { label: 'Object', value: 'object' },
236
+ { label: 'Array', value: 'array' },
237
+ { label: 'Number', value: 'number' },
238
+ ],
239
+ },
240
+ ]}
241
+ isMultiple={false}
242
+ withSearch={false}
243
+ />
246
244
  ) : (
247
- '-'
248
- )}{' '}
245
+ ''
246
+ )}
249
247
  </div>
250
248
  </td>
251
249
 
@@ -70,7 +70,7 @@ export const paramsTableHeaders = [
70
70
  },
71
71
  { id: 'paramType', label: 'In', sortable: false, classes: 'requiredParam' },
72
72
  { id: 'schemaType', label: 'Schema-Type', sortable: false, classes: 'requiredParam' },
73
- { id: 'arraySchemaType', label: 'Array Schema Type', sortable: false },
73
+ // { id: 'arraySchemaType', label: 'Array Schema Type', sortable: false },
74
74
  { id: 'enum', label: 'Enum', sortable: false },
75
75
  { id: 'required', label: 'Required', sortable: false, classes: 'requiredParam' },
76
76
  { id: 'description', label: 'Description', sortable: false },
@@ -119,13 +119,7 @@ const validateBodyForResponse = (content, method) => {
119
119
  return {}
120
120
  }
121
121
  let _content = JSON.parse((content?.schema as any)?.properties as string)
122
- // if (method == 'get') {
123
- // if (!_content?.body) {
124
- // _content = {
125
- // body: _content,
126
- // }
127
- // }
128
- // }
122
+
129
123
  return _content
130
124
  }
131
125
 
@@ -177,7 +177,7 @@ export const EndpointPage = ({ data }) => {
177
177
  </tr>
178
178
  </thead>
179
179
  <tbody>
180
- {Object.keys(headersList).map((key, index) => (
180
+ {!!headersList && Object.keys(headersList) && Object.keys(headersList).map((key, index) => (
181
181
  <tr>
182
182
  <td>{key}</td>
183
183
  <td>{headersList[key]?.required.toString()}</td>
@@ -45,7 +45,6 @@ const DocsLayout = ({ apis }: ILayoutProps): JSX.Element => {
45
45
  const [expandedSections, setExpandedSections] = useState({})
46
46
  const allData = useRef([]);
47
47
  const [pending, setPending] = useState(true)
48
- console.log({ apis, transformedOpenApis, activeItemData })
49
48
  useEffect(() => {
50
49
  if (transformedOpenApis.length === 0) {
51
50
  const t = structuredClone(apis)
@@ -57,7 +57,7 @@ const Layout = ({
57
57
  }
58
58
  }, [dirty])
59
59
 
60
- // keep it here until production
60
+ // TODO: keep it here until production
61
61
  useEffect(() => {
62
62
  console.log({ values, errors })
63
63
  }, [values])