From 47de2e25d3558cf271be95c4c49b8280cd181ffe Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Thu, 25 Aug 2022 09:34:54 +0200 Subject: [PATCH] add schema for manifests --- src/Umbraco.Web.UI.Client/schemas/api/api.yml | 168 ++++++++++++++++-- .../schemas/generated-schema.ts | 106 +++++++++++ .../temp-schema-generator/manifests.ts | 59 +++++- 3 files changed, 311 insertions(+), 22 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/schemas/api/api.yml b/src/Umbraco.Web.UI.Client/schemas/api/api.yml index a009719139..557d26d03b 100644 --- a/src/Umbraco.Web.UI.Client/schemas/api/api.yml +++ b/src/Umbraco.Web.UI.Client/schemas/api/api.yml @@ -357,12 +357,6 @@ components: required: - user - telemetryLevel - ManifestStandardTypes: - type: string - enum: - - section - - propertyEditorUI - - dashboard MetaSection: type: object properties: @@ -374,6 +368,30 @@ components: required: - pathname - weight + IManifestSection: + type: object + properties: + type: + type: string + enum: + - section + meta: + $ref: '#/components/schemas/MetaSection' + name: + type: string + js: + type: string + elementName: + type: string + alias: + type: string + required: + - type + - meta + - name + - js + - elementName + - alias MetaPropertyEditorUI: type: object properties: @@ -384,6 +402,30 @@ components: required: - icon - group + IManifestPropertyEditorUI: + type: object + properties: + type: + type: string + enum: + - propertyEditorUI + meta: + $ref: '#/components/schemas/MetaPropertyEditorUI' + name: + type: string + js: + type: string + elementName: + type: string + alias: + type: string + required: + - type + - meta + - name + - js + - elementName + - alias MetaDashboard: type: object properties: @@ -396,35 +438,113 @@ components: weight: type: number format: float + label: + type: string required: - sections - pathname - weight - IManifestElement: + - label + IManifestDashboard: type: object properties: type: - $ref: '#/components/schemas/ManifestStandardTypes' - alias: type: string + enum: + - dashboard + meta: + $ref: '#/components/schemas/MetaDashboard' name: type: string js: type: string elementName: type: string - meta: - oneOf: - - $ref: '#/components/schemas/MetaSection' - - $ref: '#/components/schemas/MetaPropertyEditorUI' - - $ref: '#/components/schemas/MetaDashboard' + alias: + type: string required: - type - - alias + - meta - name - js - elementName + - alias + MetaEditorView: + type: object + properties: + editors: + type: array + items: + type: string + pathname: + type: string + weight: + type: number + format: float + icon: + type: string + required: + - editors + - pathname + - weight + - icon + IManifestEditorView: + type: object + properties: + type: + type: string + enum: + - editorView + meta: + $ref: '#/components/schemas/MetaEditorView' + name: + type: string + js: + type: string + elementName: + type: string + alias: + type: string + required: + - type - meta + - name + - js + - elementName + - alias + MetaPropertyAction: + type: object + properties: + propertyEditors: + type: array + items: + type: string + required: + - propertyEditors + IManifestPropertyAction: + type: object + properties: + type: + type: string + enum: + - propertyAction + meta: + $ref: '#/components/schemas/MetaPropertyAction' + name: + type: string + js: + type: string + elementName: + type: string + alias: + type: string + required: + - type + - meta + - name + - js + - elementName + - alias IManifestEntrypoint: type: object properties: @@ -434,13 +554,29 @@ components: - entrypoint js: type: string + alias: + type: string required: - type - js + - alias Manifest: oneOf: - - $ref: '#/components/schemas/IManifestElement' + - $ref: '#/components/schemas/IManifestSection' + - $ref: '#/components/schemas/IManifestPropertyEditorUI' + - $ref: '#/components/schemas/IManifestDashboard' + - $ref: '#/components/schemas/IManifestEditorView' + - $ref: '#/components/schemas/IManifestPropertyAction' - $ref: '#/components/schemas/IManifestEntrypoint' + discriminator: + propertyName: type + mapping: + section: '#/components/schemas/IManifestSection' + propertyEditorUI: '#/components/schemas/IManifestPropertyEditorUI' + dashboard: '#/components/schemas/IManifestDashboard' + editorView: '#/components/schemas/IManifestEditorView' + propertyAction: '#/components/schemas/IManifestPropertyAction' + entrypoint: '#/components/schemas/IManifestEntrypoint' ManifestsResponse: type: object properties: diff --git a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts index 4c9f3aa57f..8ecdb30d35 100644 --- a/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts +++ b/src/Umbraco.Web.UI.Client/schemas/generated-schema.ts @@ -13,6 +13,9 @@ export interface paths { "/install/validateDatabase": { post: operations["PostInstallValidateDatabase"]; }; + "/manifests": { + get: operations["Manifests"]; + }; "/server/status": { get: operations["GetStatus"]; }; @@ -102,6 +105,93 @@ export interface components { telemetryLevel: components["schemas"]["ConsentLevel"]; database?: components["schemas"]["InstallSetupDatabaseConfiguration"]; }; + MetaSection: { + pathname: string; + /** Format: float */ + weight: number; + }; + IManifestSection: { + /** @enum {string} */ + type: "section"; + meta: components["schemas"]["MetaSection"]; + name: string; + js: string; + elementName: string; + alias: string; + }; + MetaPropertyEditorUI: { + icon: string; + group: string; + }; + IManifestPropertyEditorUI: { + /** @enum {string} */ + type: "propertyEditorUI"; + meta: components["schemas"]["MetaPropertyEditorUI"]; + name: string; + js: string; + elementName: string; + alias: string; + }; + MetaDashboard: { + sections: string[]; + pathname: string; + /** Format: float */ + weight: number; + label: string; + }; + IManifestDashboard: { + /** @enum {string} */ + type: "dashboard"; + meta: components["schemas"]["MetaDashboard"]; + name: string; + js: string; + elementName: string; + alias: string; + }; + MetaEditorView: { + editors: string[]; + pathname: string; + /** Format: float */ + weight: number; + icon: string; + }; + IManifestEditorView: { + /** @enum {string} */ + type: "editorView"; + meta: components["schemas"]["MetaEditorView"]; + name: string; + js: string; + elementName: string; + alias: string; + }; + MetaPropertyAction: { + propertyEditors: string[]; + }; + IManifestPropertyAction: { + /** @enum {string} */ + type: "propertyAction"; + meta: components["schemas"]["MetaPropertyAction"]; + name: string; + js: string; + elementName: string; + alias: string; + }; + IManifestEntrypoint: { + /** @enum {string} */ + type: "entrypoint"; + js: string; + alias: string; + }; + Manifest: + | components["schemas"]["IManifestSection"] + | components["schemas"]["IManifestPropertyEditorUI"] + | components["schemas"]["IManifestDashboard"] + | components["schemas"]["IManifestEditorView"] + | components["schemas"]["IManifestPropertyAction"] + | components["schemas"]["IManifestEntrypoint"]; + ManifestsResponse: { + manifests: components["schemas"]["Manifest"][]; + }; /** @enum {string} */ ServerStatus: "running" | "must-install" | "must-upgrade"; StatusResponse: { @@ -185,6 +275,22 @@ export interface operations { }; }; }; + Manifests: { + responses: { + /** 200 response */ + 200: { + content: { + "application/json": components["schemas"]["ManifestsResponse"]; + }; + }; + /** default response */ + default: { + content: { + "application/json": components["schemas"]["ProblemDetails"]; + }; + }; + }; + }; GetStatus: { responses: { /** 200 response */ 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 ce9319ece5..52c5ea4503 100644 --- a/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts +++ b/src/Umbraco.Web.UI.Client/temp-schema-generator/manifests.ts @@ -11,15 +11,28 @@ export class Manifests { default(@body body: ProblemDetails) {} } -export type Manifest = IManifestElement | IManifestEntrypoint; -export type ManifestStandardTypes = 'section' | 'propertyEditorUI' | 'dashboard'; +export type Manifest = + | IManifestSection + | IManifestPropertyEditorUI + | IManifestDashboard + | IManifestEditorView + | IManifestPropertyAction + | IManifestEntrypoint; +export type ManifestStandardTypes = + | 'section' + | 'propertyEditorUI' + | 'dashboard' + | 'editorView' + | 'propertyAction' + | 'entrypoint'; export interface ManifestsResponse { manifests: Manifest[]; } export interface IManifest { - type: string; + type: ManifestStandardTypes; + alias: string; } export interface MetaSection { @@ -36,15 +49,49 @@ export interface MetaDashboard { sections: string[]; pathname: string; weight: number; + label: string; +} + +export interface MetaEditorView { + editors: string[]; + pathname: string; + weight: number; + icon: string; +} + +export interface MetaPropertyAction { + propertyEditors: string[]; } export interface IManifestElement extends IManifest { - type: ManifestStandardTypes; - alias: string; name: string; js: string; elementName: string; - meta: MetaSection | MetaPropertyEditorUI | MetaDashboard; +} + +export interface IManifestSection extends IManifestElement { + type: 'section'; + meta: MetaSection; +} + +export interface IManifestPropertyEditorUI extends IManifestElement { + type: 'propertyEditorUI'; + meta: MetaPropertyEditorUI; +} + +export interface IManifestDashboard extends IManifestElement { + type: 'dashboard'; + meta: MetaDashboard; +} + +export interface IManifestEditorView extends IManifestElement { + type: 'editorView'; + meta: MetaEditorView; +} + +export interface IManifestPropertyAction extends IManifestElement { + type: 'propertyAction'; + meta: MetaPropertyAction; } export interface IManifestEntrypoint extends IManifest {