From e0af363ada327ebeecf0f43031fa6b3496d2302f Mon Sep 17 00:00:00 2001 From: YuanHu Date: Tue, 27 Mar 2018 16:59:56 +0800 Subject: Add model/workflow/swagger Add model/workflow/swagger Issue-ID: SDC-1130,SDC-1131 Change-Id: Id2de13c045ac81e147a1586c1d566b4a55033553 Signed-off-by: YuanHu --- .../workflow/swagger/swagger-base-parameter.ts | 20 ++++++++++++ .../workflow/swagger/swagger-body-parameter.ts | 18 ++++++++++ .../swagger/swagger-collection-format.enum.ts | 17 ++++++++++ .../workflow/swagger/swagger-data-format.enum.ts | 22 +++++++++++++ .../workflow/swagger/swagger-data-type.enum.ts | 14 ++++++++ .../app/model/workflow/swagger/swagger-in.enum.ts | 14 ++++++++ .../app/model/workflow/swagger/swagger-items.ts | 31 ++++++++++++++++++ .../workflow/swagger/swagger-normal-parameter.ts | 34 +++++++++++++++++++ .../model/workflow/swagger/swagger-parameter.ts | 13 ++++++++ .../app/model/workflow/swagger/swagger-response.ts | 21 ++++++++++++ .../app/model/workflow/swagger/swagger-schema.ts | 38 ++++++++++++++++++++++ 11 files changed, 242 insertions(+) create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-base-parameter.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-body-parameter.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-collection-format.enum.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-data-format.enum.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-data-type.enum.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-in.enum.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-items.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-normal-parameter.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-parameter.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-response.ts create mode 100644 sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-schema.ts (limited to 'sdc-workflow-designer-ui/src/app/model') diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-base-parameter.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-base-parameter.ts new file mode 100644 index 00000000..82103458 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-base-parameter.ts @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +export interface SwaggerBaseParameter { + name: string; + in: string; //SwaggerIn + description?: string; + required?: boolean;//default value is false + show?: boolean;//default value is true; + value?: string; + valueSource?: string; +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-body-parameter.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-body-parameter.ts new file mode 100644 index 00000000..f676b83d --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-body-parameter.ts @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +import { SwaggerBaseParameter } from "./swagger-base-parameter"; +import { SwaggerSchema } from "./swagger-schema"; + +export interface SwaggerBodyParameter extends SwaggerBaseParameter { + $ref: string; + schema: SwaggerSchema; +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-collection-format.enum.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-collection-format.enum.ts new file mode 100644 index 00000000..f8df2536 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-collection-format.enum.ts @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +export enum SwaggerCollectionFormat { + csv,//comma separated values foo,bar. + ssv,//space separated values foo bar. + tsv,//tab separated values foo\tbar. + pipes//pipe separated values foo|bar. +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-data-format.enum.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-data-format.enum.ts new file mode 100644 index 00000000..d8eaaa76 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-data-format.enum.ts @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +export enum SwaggerDataFormat { + int32, + int64, + float, + double, + byte, + binary, + date, + 'date-time', + password +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-data-type.enum.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-data-type.enum.ts new file mode 100644 index 00000000..54634901 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-data-type.enum.ts @@ -0,0 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +export enum SwaggerDataType { + integer, number, string, boolean +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-in.enum.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-in.enum.ts new file mode 100644 index 00000000..dc695da6 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-in.enum.ts @@ -0,0 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +export enum SwaggerIn { + query, header, path, formData, body +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-items.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-items.ts new file mode 100644 index 00000000..0661d034 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-items.ts @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +export interface SwaggerItems { + $ref?: string; + type?: string; + format?: string; + items?: SwaggerItems; + collectionFormat?: string;//Default value is csv + default?: any; + maximum?: number; + exclusiveMaximum?: boolean; + minimum?: number; + exclusiveMinimum?: boolean; + maxLength?: number;//integer + minLength?: number;//integer + pattern?: string; + maxItems?: number;//integer + minItems?: number;//integer + uniqueItems?: boolean; + enum?: any[]; + multipleOf?: number; +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-normal-parameter.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-normal-parameter.ts new file mode 100644 index 00000000..3c28803b --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-normal-parameter.ts @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +import { SwaggerBaseParameter } from "./swagger-base-parameter"; +import { SwaggerItems } from "./swagger-items"; + +export interface SwaggerNormalParameter extends SwaggerBaseParameter { + type: string;//"string", "number", "integer", "boolean", "array" or "file" + format?: string;//https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#dataTypeFormat + allowEmptyValue?: boolean; + items?: SwaggerItems; + collectionFormat?: string; + default?: any; + maximum?: number; + exclusiveMaximum?: boolean; + minimum?: number; + exclusiveMinimum?: boolean; + maxLength?: number;//integer; + minLength?: number;//integer; + pattern?: string;//https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. + maxItems?: number;//integer; + minItems?: number;//integer; + uniqueItems?: boolean; + enum?: any[]; + multipleOf?: number;//https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-parameter.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-parameter.ts new file mode 100644 index 00000000..a87d4bf3 --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-parameter.ts @@ -0,0 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +export interface SwaggerParameter { +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-response.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-response.ts new file mode 100644 index 00000000..5896905d --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-response.ts @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +import { SwaggerSchema } from "./swagger-schema"; + +export interface SwaggerResponse { + description: string; + schema?: SwaggerSchema; + headers?: any;//todo: add define object + examples?: any;//todo: add define + $ref?: string; + name?: string; +} diff --git a/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-schema.ts b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-schema.ts new file mode 100644 index 00000000..c152830c --- /dev/null +++ b/sdc-workflow-designer-ui/src/app/model/workflow/swagger/swagger-schema.ts @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2018 ZTE Corporation. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and the Apache License 2.0 which both accompany this distribution, + * and are available at http://www.eclipse.org/legal/epl-v10.html + * and http://www.apache.org/licenses/LICENSE-2.0 + * + * Contributors: + * ZTE - initial API and implementation and/or initial documentation + *******************************************************************************/ +export interface SwaggerSchema { + $ref?: string; + format?: string; + title?: string; + description?: string; + default?: any; + multipleOf?: number;//https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.1.1. + maximum?: number; + exclusiveMaximum?: boolean; + minimum?: number; + exclusiveMinimum?: boolean; + maxLength?: number;//integer; + minLength?: number;//integer; + pattern?: string;//https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. + maxItems?: number;//integer; + minItems?: number;//integer; + uniqueItems?: boolean; + maxProperties?: number;//integer; + minPropertiesnumber?: number;//integer; + required?: boolean | string[]; + enum?: any[]; + type?: string; + items?: SwaggerSchema | SwaggerSchema[]; + allOf?: any;//every property is a SwaggerSchema; + properties?: any;//every property is a SwaggerSchema; + additionalProperties?: any;//every property is a SwaggerSchema;//boolean | SwaggerSchema; +} -- cgit 1.2.3-korg