]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20392 Web API v2 doc improvement with new PATCH media type
authorViktor Vorona <viktor.vorona@sonarsource.com>
Fri, 15 Sep 2023 09:42:23 +0000 (11:42 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 15 Sep 2023 20:03:06 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/settings/components/authentication/hook/useGithubConfiguration.ts
server/sonar-web/src/main/js/apps/web-api-v2/components/ApiResponseSchema.tsx
server/sonar-web/src/main/js/apps/web-api-v2/utils.ts

index 79df8b060d9f2d342a82cbdfb5f30868adb5ece4..4d961f61ff99b5a33f8d28b570abe8189a2df39f 100644 (file)
@@ -97,14 +97,12 @@ export default function useGithubConfiguration(definitions: ExtendedSettingDefin
   const applyAdditionalOptions = () => {
     const newValues = GITHUB_ADDITIONAL_FIELDS.map((settingKey) => values[settingKey]);
     saveSettings(newValues);
-    if (newGithubProvisioningStatus ?? githubProvisioningStatus) {
-      if (rolesMapping) {
-        updateMapping(rolesMapping)
-          .then(() => {
-            setRolesMapping(null);
-          })
-          .catch(() => {});
-      }
+    if ((newGithubProvisioningStatus ?? githubProvisioningStatus) && rolesMapping) {
+      updateMapping(rolesMapping)
+        .then(() => {
+          setRolesMapping(null);
+        })
+        .catch(() => {});
     }
   };
 
index bd9ec2db3f910cf5d734b2c4960a1ebe3439133e..19bef2c711419a2097ceb044b982ca3c44e619e8 100644 (file)
@@ -31,7 +31,10 @@ interface Props extends HtmlHTMLAttributes<HTMLDivElement> {
 
 export default function ApiResponseSchema(props: Props) {
   const { content, ...other } = props;
-  if (!content || !content['application/json']?.schema) {
+  const schema =
+    content &&
+    (content['application/json']?.schema || content['application/merge-patch+json']?.schema);
+  if (!schema) {
     return <TextMuted text={translate('no_data')} />;
   }
 
@@ -39,7 +42,7 @@ export default function ApiResponseSchema(props: Props) {
     <CodeSnippet
       language="json"
       className="sw-p-6"
-      snippet={JSON.stringify(mapOpenAPISchema(content['application/json'].schema), null, 2)}
+      snippet={JSON.stringify(mapOpenAPISchema(schema), null, 2)}
       wrap
       {...other}
     />
index e6f877306256bc8b7fd17f05d956a29751bb92cb..49732b04d7a260bd4ac3a6601a7c4685c7ee365e 100644 (file)
@@ -22,7 +22,7 @@ import { mapValues } from 'lodash';
 import { OpenAPIV3 } from 'openapi-types';
 import { DereferenceRecursive, ExcludeReferences } from './types';
 
-export const URL_DIVIDER = '-';
+export const URL_DIVIDER = '--';
 
 type ConvertedSchema = string | { [Key: string]: ConvertedSchema } | ConvertedSchema[];