From 9e1ff0e7076e6559930ee7c8a4fe9c22e1a3c5e0 Mon Sep 17 00:00:00 2001 From: MORISSOT Quentin Date: Mon, 13 Nov 2023 16:51:48 +0100 Subject: [PATCH 1/2] addition of a properties table for the reference data-types to be able to understand more clearly the data-type. --- front-end/studio/src/app/editor.module.ts | 3 +- .../forms/definition-form.component.html | 13 +- .../forms/definition-form.component.ts | 62 ++++- ...eference-properties-section.component.html | 35 +++ .../reference-properties-section.component.ts | 237 ++++++++++++++++++ 5 files changed, 347 insertions(+), 3 deletions(-) create mode 100644 front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.html create mode 100644 front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.ts diff --git a/front-end/studio/src/app/editor.module.ts b/front-end/studio/src/app/editor.module.ts index d86d1df41..9ba79487e 100644 --- a/front-end/studio/src/app/editor.module.ts +++ b/front-end/studio/src/app/editor.module.ts @@ -167,6 +167,7 @@ import {ExtensionRowComponent} from "./pages/apis/{apiId}/editor/_components/for import {JsonSummaryComponent} from "./components/common/json-summary.component"; import {InlineJsonEditorComponent} from "./pages/apis/{apiId}/editor/_components/common/inline-json-editor.component"; import {AddExtensionDialogComponent} from "./pages/apis/{apiId}/editor/_components/dialogs/add-extension.component"; +import {ReferencePropertiesSectionComponent} from "./pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component"; @NgModule({ imports: [ @@ -194,7 +195,7 @@ import {AddExtensionDialogComponent} from "./pages/apis/{apiId}/editor/_componen SecuritySchemesSectionComponent, AaiSecuritySchemesSectionComponent, PathParamsSectionComponent, QueryParamsSectionComponent, PathParamRowComponent, PfInlineTextEditorComponent, TagRowComponent, AaiServerEditorComponent, ServerEditorComponent, AaiServerRowComponent, ServerRowComponent, EntityEditorComponent, InlineArrayEditorComponent, SecuritySchemeRowComponent, SecuritySchemeEditorComponent, DataTypeEditorComponent, - DefinitionInfoSectionComponent, RenamePathDialogComponent, CounterComponent, ResponsesSectionComponent, + DefinitionInfoSectionComponent, RenamePathDialogComponent, CounterComponent, ResponsesSectionComponent, ReferencePropertiesSectionComponent, InlineExampleEditorComponent, DefinitionExampleSectionComponent, PropertyEditorComponent, HeaderParamRowComponent, HeaderParamsSectionComponent, OperationsSectionComponent, ChannelOperationsSectionComponent, MediaTypeRowComponent, HeaderRowComponent, CollaboratorAggregateComponent, CollaboratorOverlayComponent, CookieParamsSectionComponent, CookieParamRowComponent, diff --git a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.html b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.html index 0eb2e8092..343d1bae6 100644 --- a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.html +++ b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.html @@ -136,13 +136,24 @@ {{ definition.$ref }} + + + + + + + -
{{ referenceContent() }}
+ + + + diff --git a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.ts b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.ts index fccf640a4..a8b377de0 100644 --- a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.ts +++ b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.ts @@ -37,6 +37,10 @@ import { SimplifiedType, TraverserDirection, VisitorUtil, + Node, + Oas30Schema, + Schema, + SimplifiedPropertyType, } from "@apicurio/data-models"; import {SourceFormComponent} from "./source-form.base"; @@ -71,6 +75,8 @@ export class DefinitionFormComponent extends SourceFormComponent { private _stype: SimplifiedType = null; + private currentPart : string = "payload"; + private _definition: Oas20SchemaDefinition | Oas30SchemaDefinition; @Input() set definition(definition: Oas20SchemaDefinition | Oas30SchemaDefinition) { @@ -251,13 +257,59 @@ export class DefinitionFormComponent extends SourceFormComponent { let fragment: string = this.definition.$ref.substring(hashIdx+1); content = ReferenceUtil.resolveFragmentFromJS(content, fragment); if (content) { - return JSON.stringify(content, null, 3); + return JSON.stringify(content, null, 3); } } } return "Content not available."; } + extractPropertiesDefinition(): Oas30Schema { + + let ret: Oas30Schema; + let newJsObject: any; + newJsObject = JSON.parse(this.referenceContent()); + let node: Node = this.createEmptyNodeForSource(); + Library.readNode(newJsObject, node); + let temp: any = node; + ret = temp; + return ret; + } + + + public properties(): Schema[] { + let rval: Schema[] = []; + let rtest: SimplifiedPropertyType[] =[]; + + let sourceSchema: OasSchema = this.getPropertySourceSchema(); + // let propertyNames: String[] = sourceSchema.getPropertyNames(); + + sourceSchema.getPropertyNames().forEach(name => console.info(name+ " "+sourceSchema.getProperty(name) + " " +sourceSchema.getProperty(name)._attributes )); + + sourceSchema.getPropertyNames().forEach(name => rval.push(sourceSchema.getProperty(name))); + + //rval.forEach(val => rtest.push(SimplifiedPropertyType.fromPropertySchema(val))); + return rval; + } + + public getPropertySourceSchema(): OasSchema { + let pschema: OasSchema = this.extractPropertiesDefinition(); + + if (this.inheritanceType() != "none") { + let schemas: OasSchema[] = this.extractPropertiesDefinition()[this.inheritanceType()]; + if (schemas) { + schemas.forEach(schema => { + if (schema.type == "object") { + pschema = schema; + } + }); + } + } + + return pschema; + } + + refLink(): string { if (this.definition.$ref && this.definition.$ref.startsWith("apicurio:")) { let currentUrl: string = window.location.href; @@ -277,4 +329,12 @@ export class DefinitionFormComponent extends SourceFormComponent { return this.definition.$ref.substring(colonIdx + 1, hashIdx); } + + public isPartActive(part: string): boolean { + return this.currentPart === part; + } + + public setActivePart(part: string): void { + this.currentPart = part; + } } diff --git a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.html b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.html new file mode 100644 index 000000000..49d147afe --- /dev/null +++ b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.html @@ -0,0 +1,35 @@ +
+ +
+ + + + + + + + + + + + + + + + + + +
NameTypeExample
+ {{ property._propertyName}} + + {{ property.type }} + + {{ property.example }} +
+
+
+ diff --git a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.ts b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.ts new file mode 100644 index 000000000..f9bd645f8 --- /dev/null +++ b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.ts @@ -0,0 +1,237 @@ +/** + * @license + * Copyright 2019 JBoss Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + ChangeDetectionStrategy, + ChangeDetectorRef, + Component, + Input, + ViewChild, + ViewEncapsulation +} from "@angular/core"; +import { + CommandFactory, + ICommand, IPropertyParent, + Library, Oas20Schema, Oas30Schema, + OasSchema, + Schema +} from "@apicurio/data-models"; +import {CommandService} from "../../../_services/command.service"; +import {AbstractBaseComponent} from "../../common/base-component"; +import {DocumentService} from "../../../_services/document.service"; +import {SelectionService} from "../../../_services/selection.service"; +import {ModelUtils} from "../../../_util/model.util"; +import {IPropertyEditorHandler, PropertyData, PropertyEditorComponent} from "../../editors/property-editor.component"; +import {EditorsService} from "../../../_services/editors.service"; +import {RenameEntityDialogComponent, RenameEntityEvent} from "../../dialogs/rename-entity.component"; +import Oas20PropertySchema = Oas20Schema.Oas20PropertySchema; +import Oas30PropertySchema = Oas30Schema.Oas30PropertySchema; + + +@Component({ + selector: "reference-properties-section", + templateUrl: "reference-properties-section.component.html", + styleUrls: [ "properties-section.component.css" ], + encapsulation: ViewEncapsulation.None, + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class ReferencePropertiesSectionComponent extends AbstractBaseComponent { + + @Input() definition: Oas20Schema | Oas30Schema; + + @ViewChild("renamePropertyDialog", { static: true }) renamePropertyDialog: RenameEntityDialogComponent; + + _pconfigOpen: boolean = false; + + _sorted: boolean = true; + + /** + * C'tor. + * @param changeDetectorRef + * @param documentService + * @param commandService + * @param selectionService + * @param editors + */ + constructor(private changeDetectorRef: ChangeDetectorRef, private documentService: DocumentService, + private commandService: CommandService, private selectionService: SelectionService, + private editors: EditorsService) { + super(changeDetectorRef, documentService, selectionService); + } + + public openAddSchemaPropertyEditor(): void { + let editor: PropertyEditorComponent = this.editors.getPropertyEditor(); + let handler: IPropertyEditorHandler = { + onSave: (event) => { + this.addSchemaProperty(event.data); + }, + onCancel: () => {} + }; + editor.open(handler, this.definition); + } + + public togglePropertiesConfig(): void { + this._pconfigOpen = !this._pconfigOpen; + } + + public toggleSorted(): void { + this._sorted = !this._sorted; + } + + public hasProperties(): boolean { + return this.properties().length > 0; + } + + public properties(): Schema[] { + let rval: Schema[] = []; + + let sourceSchema: OasSchema = this.getPropertySourceSchema(); + // let propertyNames: String[] = sourceSchema.getPropertyNames(); + + if (this._sorted) { + sourceSchema.getPropertyNames().sort((left, right) => { + return left.localeCompare(right) + }).forEach(name => rval.push(sourceSchema.getProperty(name))); + } else { + sourceSchema.getPropertyNames().forEach(name => rval.push(sourceSchema.getProperty(name))); + } + + return rval; + } + + public getPropertySourceSchema(): OasSchema { + let pschema: OasSchema = this.definition; + + if (this.inheritanceType() != "none") { + let schemas: OasSchema[] = this.definition[this.inheritanceType()]; + if (schemas) { + schemas.forEach(schema => { + if (schema.type == "object") { + pschema = schema; + } + }); + } + } + + return pschema; + } + + public propertiesNodePath(): string { + return ModelUtils.nodeToPath(this.getPropertySourceSchema()) + "/properties"; + } + + public deleteProperty(property: Schema): void { + let command: ICommand = CommandFactory.createDeletePropertyCommand(property as any); + this.commandService.emit(command); + } + + public addSchemaProperty(data: PropertyData): void { + let pschema: OasSchema = this.getPropertySourceSchema(); + + let command: ICommand = CommandFactory.createNewSchemaPropertyCommand(pschema, + data.name, data.description, data.type); + this.commandService.emit(command); + let path = Library.createNodePath(pschema); + path.appendSegment("properties", false); + path.appendSegment(data.name, true); + this.__selectionService.select(path.toString()); + } + + public deleteAllSchemaProperties(): void { + let command: ICommand = CommandFactory.createDeleteAllPropertiesCommand(this.getPropertySourceSchema()); + this.commandService.emit(command); + } + + public minProperties(): string { + console.info("definition :"+this.definition.additionalProperties); + return this.definition.minProperties ? this.definition.minProperties.toString() : null; + } + + public maxProperties(): string { + return this.definition.maxProperties ? this.definition.maxProperties.toString() : null; + } + + public setMinProps(value: string): void { + this.setMinProperties(Number(value)); + } + + public setMaxProps(value: string): void { + this.setMaxProperties(Number(value)); + } + + public setMinProperties(minProp: number): void { + let command: ICommand = CommandFactory.createChangePropertyCommand(this.getPropertySourceSchema(), "minProperties", minProp); + this.commandService.emit(command); + } + + public setMaxProperties(maxProp: number): void { + let command: ICommand = CommandFactory.createChangePropertyCommand(this.getPropertySourceSchema(), "maxProperties", maxProp); + this.commandService.emit(command); + } + + public additionalProperties(): boolean { + if (typeof this.definition.additionalProperties === "boolean") { + return (this.definition.additionalProperties as boolean); + } else { + return true; + } + } + + public setAdditionalProperties(value: boolean): void { + let newVal: any = value ? null : false; + let command: ICommand = CommandFactory.createChangePropertyCommand(this.getPropertySourceSchema(), "additionalProperties", newVal); + this.commandService.emit(command); + } + + public inheritanceType(): string { + if (this.definition.allOf) { + return "allOf"; + } + if (this.definition['anyOf']) { + return "anyOf"; + } + if (this.definition['oneOf']) { + return "oneOf"; + } + + return "none"; + } + + /** + * Opens the rename property dialog. + * @param property + */ + public openRenamePropertyDialog(property: Schema): void { + let parent: IPropertyParent = property.parent(); + let propertyNames: string[] = parent.getProperties().map( prop => { return (prop).getPropertyName(); }); + this.renamePropertyDialog.open(property, (property).getPropertyName(), newName => { + return propertyNames.indexOf(newName) !== -1; + }); + } + + /** + * Renames the property. + * @param event + */ + public renameProperty(event: RenameEntityEvent): void { + let property: Oas20PropertySchema | Oas30PropertySchema = event.entity; + let propertyName: string = property.getPropertyName(); + let parent: OasSchema = property.parent(); + let command: ICommand = CommandFactory.createRenamePropertyCommand(parent, propertyName, event.newName); + this.commandService.emit(command); + } +} From 26f7493cf7917d0f006219de613056ed784d0efc Mon Sep 17 00:00:00 2001 From: MORISSOT Quentin Date: Mon, 20 Nov 2023 17:41:16 +0100 Subject: [PATCH 2/2] correction property table if ref doesn't exist && property of ref is : enum or array or a ref --- .../forms/definition-form.component.ts | 50 ++----- ...eference-properties-section.component.html | 8 +- .../reference-properties-section.component.ts | 130 ++---------------- 3 files changed, 32 insertions(+), 156 deletions(-) diff --git a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.ts b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.ts index a8b377de0..675ff8530 100644 --- a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.ts +++ b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition-form.component.ts @@ -268,45 +268,25 @@ export class DefinitionFormComponent extends SourceFormComponent { let ret: Oas30Schema; let newJsObject: any; - newJsObject = JSON.parse(this.referenceContent()); - let node: Node = this.createEmptyNodeForSource(); - Library.readNode(newJsObject, node); - let temp: any = node; - ret = temp; - return ret; - } - - - public properties(): Schema[] { - let rval: Schema[] = []; - let rtest: SimplifiedPropertyType[] =[]; - - let sourceSchema: OasSchema = this.getPropertySourceSchema(); - // let propertyNames: String[] = sourceSchema.getPropertyNames(); - sourceSchema.getPropertyNames().forEach(name => console.info(name+ " "+sourceSchema.getProperty(name) + " " +sourceSchema.getProperty(name)._attributes )); - - sourceSchema.getPropertyNames().forEach(name => rval.push(sourceSchema.getProperty(name))); - - //rval.forEach(val => rtest.push(SimplifiedPropertyType.fromPropertySchema(val))); - return rval; + if(this.referenceContent()=="Content not available."){ + ret = null; + return ret; + }else{ + newJsObject = JSON.parse(this.referenceContent()); + let node: Node = this.createEmptyNodeForSource(); + Library.readNode(newJsObject, node); + let temp: any = node; + ret = temp; + return ret; + } } - public getPropertySourceSchema(): OasSchema { - let pschema: OasSchema = this.extractPropertiesDefinition(); - - if (this.inheritanceType() != "none") { - let schemas: OasSchema[] = this.extractPropertiesDefinition()[this.inheritanceType()]; - if (schemas) { - schemas.forEach(schema => { - if (schema.type == "object") { - pschema = schema; - } - }); - } - } + isRefProperties() : boolean{ + let object : boolean = this.definition.type == "object" || this.definition.type == null || this.definition.type == undefined; + let property : boolean = this.extractPropertiesDefinition()!=null; + return object && property; - return pschema; } diff --git a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.html b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.html index 49d147afe..d69bcd803 100644 --- a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.html +++ b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.html @@ -4,7 +4,7 @@ [collaborationNodePath]="propertiesNodePath()" [validationModels]="properties()"> -
+
@@ -22,7 +22,11 @@ {{ property._propertyName}} - {{ property.type }} + {{ property.type }} + enum of {{ property.type }} + {{ property.$ref }} + array of {{ property.items.$ref }} + array of {{ property.items.type }} {{ property.example }} diff --git a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.ts b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.ts index f9bd645f8..28a3b5ce0 100644 --- a/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.ts +++ b/front-end/studio/src/app/pages/apis/{apiId}/editor/_components/forms/definition/reference-properties-section.component.ts @@ -23,10 +23,7 @@ import { ViewChild, ViewEncapsulation } from "@angular/core"; -import { - CommandFactory, - ICommand, IPropertyParent, - Library, Oas20Schema, Oas30Schema, +import {Oas20Schema, Oas30Schema, OasSchema, Schema } from "@apicurio/data-models"; @@ -35,9 +32,8 @@ import {AbstractBaseComponent} from "../../common/base-component"; import {DocumentService} from "../../../_services/document.service"; import {SelectionService} from "../../../_services/selection.service"; import {ModelUtils} from "../../../_util/model.util"; -import {IPropertyEditorHandler, PropertyData, PropertyEditorComponent} from "../../editors/property-editor.component"; import {EditorsService} from "../../../_services/editors.service"; -import {RenameEntityDialogComponent, RenameEntityEvent} from "../../dialogs/rename-entity.component"; +import {RenameEntityDialogComponent} from "../../dialogs/rename-entity.component"; import Oas20PropertySchema = Oas20Schema.Oas20PropertySchema; import Oas30PropertySchema = Oas30Schema.Oas30PropertySchema; @@ -73,25 +69,6 @@ export class ReferencePropertiesSectionComponent extends AbstractBaseComponent { super(changeDetectorRef, documentService, selectionService); } - public openAddSchemaPropertyEditor(): void { - let editor: PropertyEditorComponent = this.editors.getPropertyEditor(); - let handler: IPropertyEditorHandler = { - onSave: (event) => { - this.addSchemaProperty(event.data); - }, - onCancel: () => {} - }; - editor.open(handler, this.definition); - } - - public togglePropertiesConfig(): void { - this._pconfigOpen = !this._pconfigOpen; - } - - public toggleSorted(): void { - this._sorted = !this._sorted; - } - public hasProperties(): boolean { return this.properties().length > 0; } @@ -101,13 +78,14 @@ export class ReferencePropertiesSectionComponent extends AbstractBaseComponent { let sourceSchema: OasSchema = this.getPropertySourceSchema(); // let propertyNames: String[] = sourceSchema.getPropertyNames(); - - if (this._sorted) { - sourceSchema.getPropertyNames().sort((left, right) => { - return left.localeCompare(right) - }).forEach(name => rval.push(sourceSchema.getProperty(name))); - } else { - sourceSchema.getPropertyNames().forEach(name => rval.push(sourceSchema.getProperty(name))); + if(sourceSchema!= null){ + if (this._sorted) { + sourceSchema.getPropertyNames().sort((left, right) => { + return left.localeCompare(right) + }).forEach(name => rval.push(sourceSchema.getProperty(name))); + } else { + sourceSchema.getPropertyNames().forEach(name => rval.push(sourceSchema.getProperty(name))); + } } return rval; @@ -116,7 +94,7 @@ export class ReferencePropertiesSectionComponent extends AbstractBaseComponent { public getPropertySourceSchema(): OasSchema { let pschema: OasSchema = this.definition; - if (this.inheritanceType() != "none") { + if (pschema != null && this.inheritanceType() != "none") { let schemas: OasSchema[] = this.definition[this.inheritanceType()]; if (schemas) { schemas.forEach(schema => { @@ -134,69 +112,6 @@ export class ReferencePropertiesSectionComponent extends AbstractBaseComponent { return ModelUtils.nodeToPath(this.getPropertySourceSchema()) + "/properties"; } - public deleteProperty(property: Schema): void { - let command: ICommand = CommandFactory.createDeletePropertyCommand(property as any); - this.commandService.emit(command); - } - - public addSchemaProperty(data: PropertyData): void { - let pschema: OasSchema = this.getPropertySourceSchema(); - - let command: ICommand = CommandFactory.createNewSchemaPropertyCommand(pschema, - data.name, data.description, data.type); - this.commandService.emit(command); - let path = Library.createNodePath(pschema); - path.appendSegment("properties", false); - path.appendSegment(data.name, true); - this.__selectionService.select(path.toString()); - } - - public deleteAllSchemaProperties(): void { - let command: ICommand = CommandFactory.createDeleteAllPropertiesCommand(this.getPropertySourceSchema()); - this.commandService.emit(command); - } - - public minProperties(): string { - console.info("definition :"+this.definition.additionalProperties); - return this.definition.minProperties ? this.definition.minProperties.toString() : null; - } - - public maxProperties(): string { - return this.definition.maxProperties ? this.definition.maxProperties.toString() : null; - } - - public setMinProps(value: string): void { - this.setMinProperties(Number(value)); - } - - public setMaxProps(value: string): void { - this.setMaxProperties(Number(value)); - } - - public setMinProperties(minProp: number): void { - let command: ICommand = CommandFactory.createChangePropertyCommand(this.getPropertySourceSchema(), "minProperties", minProp); - this.commandService.emit(command); - } - - public setMaxProperties(maxProp: number): void { - let command: ICommand = CommandFactory.createChangePropertyCommand(this.getPropertySourceSchema(), "maxProperties", maxProp); - this.commandService.emit(command); - } - - public additionalProperties(): boolean { - if (typeof this.definition.additionalProperties === "boolean") { - return (this.definition.additionalProperties as boolean); - } else { - return true; - } - } - - public setAdditionalProperties(value: boolean): void { - let newVal: any = value ? null : false; - let command: ICommand = CommandFactory.createChangePropertyCommand(this.getPropertySourceSchema(), "additionalProperties", newVal); - this.commandService.emit(command); - } - public inheritanceType(): string { if (this.definition.allOf) { return "allOf"; @@ -211,27 +126,4 @@ export class ReferencePropertiesSectionComponent extends AbstractBaseComponent { return "none"; } - /** - * Opens the rename property dialog. - * @param property - */ - public openRenamePropertyDialog(property: Schema): void { - let parent: IPropertyParent = property.parent(); - let propertyNames: string[] = parent.getProperties().map( prop => { return (prop).getPropertyName(); }); - this.renamePropertyDialog.open(property, (property).getPropertyName(), newName => { - return propertyNames.indexOf(newName) !== -1; - }); - } - - /** - * Renames the property. - * @param event - */ - public renameProperty(event: RenameEntityEvent): void { - let property: Oas20PropertySchema | Oas30PropertySchema = event.entity; - let propertyName: string = property.getPropertyName(); - let parent: OasSchema = property.parent(); - let command: ICommand = CommandFactory.createRenamePropertyCommand(parent, propertyName, event.newName); - this.commandService.emit(command); - } }