@digi-frontend/dgate-api-documentation 1.0.34 → 1.0.38

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.34",
3
+ "version": "1.0.38",
4
4
  "main": "dist/src/index.js",
5
5
  "module": "dist/src/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -187,7 +187,9 @@ const InfoForm = ({ readOnly }: { readOnly?: boolean }) => {
187
187
  {values.tags[index].externalDocs?.description && values.tags[index].externalDocs?.url && (
188
188
  <a
189
189
  className={styles.externalDocsLink}
190
- href={values.tags[index].externalDocs?.url}
190
+ href={values.tags[index]?.externalDocs?.url && values.tags[index]?.externalDocs?.url?.indexOf('http') > -1
191
+ ? values.tags[index]?.externalDocs?.url
192
+ : `https://${values.tags[index]?.externalDocs?.url}`}
191
193
  target="_blank"
192
194
  style={
193
195
  !values.tags[index].externalDocs?.description
@@ -443,7 +443,6 @@ const MethodsAccordion = ({
443
443
  const currentResIndex = method.responses.findIndex(
444
444
  (res) => res.code === currentResponse.code
445
445
  )
446
-
447
446
  if (currentResIndex !== -1) {
448
447
  setFieldValue(
449
448
  `responses[${currentResIndex}].content.schema.properties`,
@@ -466,7 +465,7 @@ const MethodsAccordion = ({
466
465
  setFieldValue('responses', clonedResponses)
467
466
  }
468
467
  }}
469
- onValidation={() => null}
468
+ onValidation={(valid) => null}
470
469
  />
471
470
  }
472
471
  />
@@ -113,6 +113,18 @@ export const transformPathsToArray = (paths: OpenAPIFile['paths']): TransformedP
113
113
  return transformedPaths
114
114
  }
115
115
 
116
+ const validateBodyForResponse = (content, method) => {
117
+ let _content = JSON.parse((content?.schema as any)?.properties as string)
118
+ if (method == 'get') {
119
+ if (!_content?.body) {
120
+ _content = {
121
+ body: _content,
122
+ }
123
+ }
124
+ }
125
+ return _content
126
+ }
127
+
116
128
  export const transformPathsArrayToOrigin = (paths: TransformedPathsArray): OpenAPIFile['paths'] => {
117
129
  return paths.reduce((acc, { path, methods }) => {
118
130
  acc[path] = methods.reduce((methodAcc, { type, tags, responses, requestBody, ...rest }) => {
@@ -128,7 +140,7 @@ export const transformPathsArrayToOrigin = (paths: TransformedPathsArray): OpenA
128
140
  [content.contentType]: {
129
141
  schema: {
130
142
  ...(content.schema as object),
131
- properties: JSON.parse((content?.schema as any)?.properties as string),
143
+ properties: validateBodyForResponse(content, type),
132
144
  },
133
145
  },
134
146
  }