diff --git a/src/dashboard/Synapse.Dashboard/Components/MonacoEditor/MonacoEditorHelper.cs b/src/dashboard/Synapse.Dashboard/Components/MonacoEditor/MonacoEditorHelper.cs index 67e716f2c..a1d1bf337 100644 --- a/src/dashboard/Synapse.Dashboard/Components/MonacoEditor/MonacoEditorHelper.cs +++ b/src/dashboard/Synapse.Dashboard/Components/MonacoEditor/MonacoEditorHelper.cs @@ -42,7 +42,6 @@ public Func GetStanda { Other = "true", Strings = "true", - Comments = "fasle" } }; } diff --git a/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/Store.cs b/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/Store.cs index 0540770cc..c376a6fe2 100644 --- a/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/Store.cs +++ b/src/dashboard/Synapse.Dashboard/Pages/Functions/Create/Store.cs @@ -528,7 +528,7 @@ protected async Task SetValidationSchema(string? version = null) this._processingVersion = true; try { - var schema = $"https://raw.githubusercontent.com/serverlessworkflow/specification/{version}/schema/workflow.yaml#/$defs/task"; + var schema = $"https://raw.githubusercontent.com/serverlessworkflow/serverlessworkflow.github.io/main/static/schemas/{version}/workflow.yaml#/$defs/task"; var type = $"create_{typeof(CustomFunction).Name.ToLower()}_{version}_schema"; await this.MonacoInterop.AddValidationSchemaAsync(schema, $"https://synapse.io/schemas/{type}.json", $"{type}*").ConfigureAwait(false); this._textModelUri = this.MonacoEditorHelper.GetResourceUri(type); diff --git a/src/dashboard/Synapse.Dashboard/Services/SpecificationSchemaManager.cs b/src/dashboard/Synapse.Dashboard/Services/SpecificationSchemaManager.cs index dae304e5a..f14267c8b 100644 --- a/src/dashboard/Synapse.Dashboard/Services/SpecificationSchemaManager.cs +++ b/src/dashboard/Synapse.Dashboard/Services/SpecificationSchemaManager.cs @@ -45,7 +45,7 @@ public async Task GetLatestVersion() { if (!string.IsNullOrEmpty(this._latestVersion)) return this._latestVersion; var tags = await this.HttpClient.GetFromJsonAsync>("https://api.github.com/repos/serverlessworkflow/specification/tags"); - this._latestVersion = tags?.FirstOrDefault()?.Name; + this._latestVersion = tags?.FirstOrDefault()?.Name?.Substring(1); return this._latestVersion ?? string.Empty; } @@ -57,7 +57,7 @@ public async Task GetLatestVersion() public async Task GetSchema(string version) { if (_knownSchemas.TryGetValue(version, out string? value)) return value; - var address = $"https://raw.githubusercontent.com/serverlessworkflow/specification/{version}/schema/workflow.yaml"; + var address = $"https://raw.githubusercontent.com/serverlessworkflow/serverlessworkflow.github.io/main/static/schemas/{version}/workflow.yaml"; var yamlSchema = await this.HttpClient.GetStringAsync(address); this._knownSchemas.Add(version, this.YamlSerializer.ConvertToJson(yamlSchema)); return this._knownSchemas[version]; diff --git a/src/dashboard/Synapse.Dashboard/wwwroot/js/monaco-editor-interop-extension.js b/src/dashboard/Synapse.Dashboard/wwwroot/js/monaco-editor-interop-extension.js index f357e14b5..e4de1858a 100644 --- a/src/dashboard/Synapse.Dashboard/wwwroot/js/monaco-editor-interop-extension.js +++ b/src/dashboard/Synapse.Dashboard/wwwroot/js/monaco-editor-interop-extension.js @@ -9,10 +9,12 @@ import { LineCounter, parseDocument } from "https://esm.sh/yaml"; * @returns */ export function addValidationSchema(schema, schemaUri, schemaType) { + let isUrl = false; try { schema = JSON.parse(schema); } catch { + isUrl = true; schema = { $ref: schema }; } // JSON @@ -24,7 +26,11 @@ export function addValidationSchema(schema, schemaUri, schemaType) { schemas: [ ...monaco.languages.json.jsonDefaults.diagnosticsOptions.schemas, { - schema, + schema: isUrl ? + { + $ref: schema.$ref.replace('.yaml', '.json') + } : + schema, uri: schemaUri, fileMatch: [schemaType] }