import { Document } from '../../core/models/Document'; import { NodePath } from '../../core/models/NodePath'; import { OasSchema } from '../../openapi/models/OasSchema'; import { AbstractSchemaInhCommand } from './AbstractSchemaInhCommand'; /** * Allows changing the inheritance setting for a schema. This basically allows changing * the usage of "anyOf", "allOf", etc. The algorithm for this command is as follows: * * - When switching from "none" to any inheritance mode, any existing properties of the * schema will be wrapped in a new schema and added to the new inheritance mode * - When switching from any inheritance mode back to "none", any properties in a wrapped * schema will be unwrapped and added as properties * - When switching from one inheritance mode to another, the list of schemas will be * copied over with it (e.g. when going from "allOf" to "anyOf") * * Challenge: what impact will this have on undo/redo? Changes made to properties after * this command is executed may be lost when this command is undone! * * @author eric.wittmann@gmail.com * @extends AbstractSchemaInhCommand * @class */ export declare class ChangeSchemaInheritanceCommand extends AbstractSchemaInhCommand { _schemaPath: NodePath; _newInheritanceType: string; _oldInheritanceType: string; _oldSchemas: Array; constructor(schema?: any, inheritanceType?: any); /** * @see io.apicurio.datamodels.cmd.ICommand#execute(io.apicurio.datamodels.core.models.Document) * @param {Document} document */ execute(document: Document): void; /** * @see io.apicurio.datamodels.cmd.ICommand#undo(io.apicurio.datamodels.core.models.Document) * @param {Document} document */ undo(document: Document): void; /** * Switch the inheritance type. * @param {OasSchema} schema * @param {string} fromType * @param {string} toType * @param {boolean} isUndo * @private */ switchInheritance(schema: OasSchema, fromType: string, toType: string, isUndo: boolean): void; /** * Copies the given list of schemas to the appropriate property on the model * @param {OasSchema[]} schemas * @param {OasSchema} targetSchema * @param {string} inheritanceType * @private */ copySchemasTo(schemas: Array, targetSchema: OasSchema, inheritanceType: string): void; /** * Moves properties from one schema to another. * @param {OasSchema} from * @param {OasSchema} to * @private */ moveProperties(from: OasSchema, to: OasSchema): void; }