Skip to content

Commit

Permalink
Fix: Schema validation for Adaptive cards (#2062)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElinorW authored Aug 30, 2022
1 parent a0281f7 commit 6a3e744
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/app/views/common/monaco/Monaco.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FocusZone } from '@fluentui/react';
import Editor, { OnChange } from '@monaco-editor/react';
import React from 'react';
import Editor, { OnChange, useMonaco } from '@monaco-editor/react';
import React, { useEffect } from 'react';

import { ThemeContext } from '../../../../themes/theme-context';
import './monaco.scss';
Expand All @@ -26,6 +26,19 @@ export function Monaco(props: IMonaco) {
}
const itemHeight = height ? height : '300px';

const monaco = useMonaco();
useEffect(() => {
if (monaco) {
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
validate: true,
allowComments: false,
schemas: [],
enableSchemaRequest: true,
schemaRequest: 'ignore'
});
}
}, [monaco]);

return (
<FocusZone disabled={props.extraInfoElement ? false : true}>
<div className='monaco-editor'>
Expand Down

0 comments on commit 6a3e744

Please sign in to comment.