From 7aa01d2babe303ca58231d90fdcb1634565d8d1d Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Tue, 27 Sep 2022 11:40:55 +0200 Subject: [PATCH] update schemas so they export at PropertyEditorConfig model --- src/Umbraco.Web.UI.Client/schemas/api/api.yml | 60 +++++++------------ .../schemas/generated-schema.ts | 25 +++----- .../src/core/models/index.ts | 1 + .../temp-schema-generator/manifests.ts | 3 +- .../temp-schema-generator/property-editors.ts | 9 ++- 5 files changed, 36 insertions(+), 62 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/schemas/api/api.yml b/src/Umbraco.Web.UI.Client/schemas/api/api.yml index 35b7cb8ce2..3f954a9547 100644 --- a/src/Umbraco.Web.UI.Client/schemas/api/api.yml +++ b/src/Umbraco.Web.UI.Client/schemas/api/api.yml @@ -602,6 +602,17 @@ components: - label - alias - propertyEditorUI + PropertyEditorConfig: + type: object + properties: + properties: + type: array + items: + $ref: '#/components/schemas/PropertyEditorConfigProperty' + defaultConfig: + type: object + required: + - properties MetaPropertyEditorUI: type: object properties: @@ -614,16 +625,7 @@ components: group: type: string config: - type: object - properties: - properties: - type: array - items: - $ref: '#/components/schemas/PropertyEditorConfigProperty' - defaultConfig: - type: object - required: - - properties + $ref: '#/components/schemas/PropertyEditorConfig' required: - label - propertyEditor @@ -918,16 +920,7 @@ components: hasConfig: type: boolean config: - type: object - properties: - properties: - type: array - items: - $ref: '#/components/schemas/PropertyEditorConfigProperty' - defaultConfig: - type: object - required: - - properties + $ref: '#/components/schemas/PropertyEditorConfig' required: - alias - name @@ -959,16 +952,7 @@ components: hasConfig: type: boolean config: - type: object - properties: - properties: - type: array - items: - $ref: '#/components/schemas/PropertyEditorConfigProperty' - defaultConfig: - type: object - required: - - properties + $ref: '#/components/schemas/PropertyEditorConfig' required: - alias - name @@ -980,19 +964,15 @@ components: properties: propertyEditorAlias: type: string - config: + properties: + type: array + items: + $ref: '#/components/schemas/PropertyEditorConfigProperty' + defaultConfig: type: object - properties: - properties: - type: array - items: - $ref: '#/components/schemas/PropertyEditorConfigProperty' - defaultConfig: - type: object - required: - - properties required: - propertyEditorAlias + - properties ServerStatus: type: string enum: diff --git a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts index 6e9f89169e..efbe58b664 100644 --- a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts +++ b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts @@ -182,15 +182,16 @@ export interface components { alias: string; propertyEditorUI: string; }; + PropertyEditorConfig: { + properties: components["schemas"]["PropertyEditorConfigProperty"][]; + defaultConfig?: { [key: string]: unknown }; + }; MetaPropertyEditorUI: { label: string; propertyEditor: string; icon: string; group: string; - config?: { - properties: components["schemas"]["PropertyEditorConfigProperty"][]; - defaultConfig?: { [key: string]: unknown }; - }; + config?: components["schemas"]["PropertyEditorConfig"]; }; IManifestPropertyEditorUI: { /** @enum {string} */ @@ -306,10 +307,7 @@ export interface components { group?: string; isSystem: boolean; hasConfig: boolean; - config?: { - properties: components["schemas"]["PropertyEditorConfigProperty"][]; - defaultConfig?: { [key: string]: unknown }; - }; + config?: components["schemas"]["PropertyEditorConfig"]; }; PropertyEditorsListResponse: { propertyEditors: components["schemas"]["PropertyEditor"][]; @@ -321,17 +319,12 @@ export interface components { group?: string; isSystem: boolean; hasConfig: boolean; - config?: { - properties: components["schemas"]["PropertyEditorConfigProperty"][]; - defaultConfig?: { [key: string]: unknown }; - }; + config?: components["schemas"]["PropertyEditorConfig"]; }; PropertyEditorConfigResponse: { propertyEditorAlias: string; - config?: { - properties: components["schemas"]["PropertyEditorConfigProperty"][]; - defaultConfig?: { [key: string]: unknown }; - }; + properties: components["schemas"]["PropertyEditorConfigProperty"][]; + defaultConfig?: { [key: string]: unknown }; }; /** @enum {string} */ ServerStatus: "running" | "must-install" | "must-upgrade"; diff --git a/src/Umbraco.Web.UI.Client/src/core/models/index.ts b/src/Umbraco.Web.UI.Client/src/core/models/index.ts index 924337426c..2da1cc6ad7 100644 --- a/src/Umbraco.Web.UI.Client/src/core/models/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/models/index.ts @@ -35,6 +35,7 @@ export type PackageInstalled = components['schemas']['PackageInstalled']; export type PropertyEditorsListResponse = components['schemas']['PropertyEditorsListResponse']; export type PropertyEditorResponse = components['schemas']['PropertyEditorResponse']; export type PropertyEditorConfigResponse = components['schemas']['PropertyEditorConfigResponse']; +export type PropertyEditorConfig = components['schemas']['PropertyEditorConfig']; export type PropertyEditor = components['schemas']['PropertyEditor']; export type PropertyEditorConfigProperty = components['schemas']['PropertyEditorConfigProperty']; diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts index 8bcc801457..54e2bd1e38 100644 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts @@ -99,11 +99,12 @@ export interface MetaTreeItemAction { icon: string; weight: number; } -export interface MetaPropertyEditorUI extends PropertyEditorConfig { +export interface MetaPropertyEditorUI { label: string; propertyEditor: string; icon: string; group: string; + config?: PropertyEditorConfig; } export interface MetaDashboard { diff --git a/src/Umbraco.Web.UI.Client/temp-schema-generator/property-editors.ts b/src/Umbraco.Web.UI.Client/temp-schema-generator/property-editors.ts index 880868e052..2eb7682a57 100644 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/property-editors.ts +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/property-editors.ts @@ -54,20 +54,19 @@ export interface PropertyEditorConfigResponse extends PropertyEditorConfig { propertyEditorAlias: string; } -export interface PropertyEditor extends PropertyEditorConfig { +export interface PropertyEditor { alias: string; name: string; icon: string; group?: string; isSystem: boolean; hasConfig: boolean; + config?: PropertyEditorConfig; } export interface PropertyEditorConfig { - config?: { - properties: PropertyEditorConfigProperty[]; - defaultConfig?: {}; - }; + properties: PropertyEditorConfigProperty[]; + defaultConfig?: {}; } export interface PropertyEditorConfigProperty {