From 673f704cf68cbfd07226690d3f4351ee12fc1d88 Mon Sep 17 00:00:00 2001 From: Michele Carignani Date: Tue, 25 Aug 2020 11:17:35 +0200 Subject: [PATCH 1/2] support dockerized validator --- validate-all.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/validate-all.sh b/validate-all.sh index b54810f..66981be 100644 --- a/validate-all.sh +++ b/validate-all.sh @@ -2,6 +2,30 @@ # Copyright ETSI 2019 # See: https://forge.etsi.org/etsi-forge-copyright-statement.txt +DOCKER_IMAGE=jeanberu/swagger-cli:2.3.3 + +if [ -x "$(command -v docker)" ] ; then + RUN_IN_DOCKER=0 + docker pull "$DOCKER_IMAGE" + echo "Using dockerized validator ($DOCKER_IMAGE)" +else + RUN_IN_DOCKER=1 + if [ ! -x "$(command -v swagger-cli)" ] ; then + echo "Validator swagger-cli not found. Quitting." + exit 1 + else + echo "Using local validator ($(which swagger-cli))" + fi +fi + +function validate { + if [ $RUN_IN_DOCKER == 0 ] ; then + docker run --rm -v "$PWD/$1":"/$1" $DOCKER_IMAGE swagger-cli validate "$1" + else + swagger-cli validate "$1" + fi +} + echo "------ Switching to $1 folder --------" cd $1 @@ -21,7 +45,7 @@ fres=0 for i in ./*.yaml ; do echo "---- Will validate: $i ----" - swagger-cli validate "$i" + validate "$i" res=$? fres=$(($fres||$res)) done -- GitLab From 0f2071fdc165b63e064ec26babb011a7b04d2c22 Mon Sep 17 00:00:00 2001 From: Michele Carignani Date: Tue, 25 Aug 2020 12:43:16 +0200 Subject: [PATCH 2/2] show errors first in log --- test/yaml/UEAppInterfaceApi.yaml | 496 ++++++++++++++++++++++++++++++ test/yaml/UEAppInterfaceApi2.yaml | 495 +++++++++++++++++++++++++++++ test/yaml/UEAppInterfaceApi3.yaml | 496 ++++++++++++++++++++++++++++++ validate-all.sh | 28 +- 4 files changed, 1509 insertions(+), 6 deletions(-) create mode 100644 test/yaml/UEAppInterfaceApi.yaml create mode 100644 test/yaml/UEAppInterfaceApi2.yaml create mode 100644 test/yaml/UEAppInterfaceApi3.yaml diff --git a/test/yaml/UEAppInterfaceApi.yaml b/test/yaml/UEAppInterfaceApi.yaml new file mode 100644 index 0000000..6d9533e --- /dev/null +++ b/test/yaml/UEAppInterfaceApi.yaml @@ -0,0 +1,496 @@ +openapi: 3.0.2 +info: + title: UE Application Interface API + version: 1.1.1 + description: >- + The ETSI MEC ISG MEC016 UE Application Interface API described using OpenAPI + license: + name: ETSI Forge copyright notice + url: https://forge.etsi.org/etsi-forge-copyright-notice.txt + contact: + email: cti_support@etsi.org +externalDocs: + description: >- + ETSI GS MEC016 UE Application Interface API, V1.1.1 + url: http://www.etsi.org/deliver/etsi_gs/MEC/001_099/016/01.01.01_60/gs_MEC016v010101p.pdf +security: + - OauthSecurity: + - all +servers: + - url: http://127.0.0.1:8081/mx2/v1 + - url: https://127.0.0.1:8081/mx2/v1 +tags: + - name: appList + - name: appContext +paths: + "/app_list": + get: + description: >- + Used to query information about the available + MEC applications. + operationId: AppList_GET + tags: + - appList + parameters: + - $ref: "#/components/parameters/Query.AppName" + - $ref: "#/components/parameters/Query.AppProvider" + - $ref: "#/components/parameters/Query.AppSoftVersion" + - $ref: "#/components/parameters/Query.ServiceCont" + - $ref: "#/components/parameters/Query.VendorId" + responses: + "200": + $ref: '#/components/responses/AppList' + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + "/app_contexts": + post: + description: >- + The POST method can be used to create a new application context. Upon + success, the response contains entity body describing the created + application context. + operationId: AppContext_POST + tags: + - appContext + requestBody: + $ref: "#/components/requestBodies/AppContext" + responses: + "201": + $ref: '#/components/responses/AppContext' + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + "/app_contexts/{contextId}": + parameters: + - $ref: "#/components/parameters/Path.ContextId" + put: + description: >- + The PUT method is used to update the callback reference of the existing + application context. Upon successful operation, the target resource is + updated with new callback reference. + operationId: AppContextId_PUT + tags: + - appContext + requestBody: + $ref: "#/components/requestBodies/AppContext" + responses: + "204": + description: No Content. + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + delete: + description: >- + The DELETE method is used to delete the resource that represents the + existing application context. + operationId: AppContextId_DEL + tags: + - appContext + responses: + "204": + description: No Content + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' +components: + parameters: + Query.AppName: + name: appName + in: query + description: >- + Name to identify the MEC application + required: false + schema: + type: array + items: + type: string + Query.AppProvider: + name: appProvider + in: query + description: >- + Provider of the MEC application + required: false + schema: + type: array + items: + type: string + Query.AppSoftVersion: + name: appSoftVersion + in: query + description: >- + Software version of the MEC application + required: false + schema: + type: array + items: + type: string + Query.ServiceCont: + name: serviceCont + in: query + description: >- + Required service continuity mode for this application + required: false + schema: + type: string + enum: + - SERVICE_CONTINUITY_NOT_REQUIRED + - SERVICE_CONTINUITY_REQUIRED + Query.VendorId: + name: vendorId + in: query + description: Vendor identifier + required: false + schema: + type: array + items: + type: string + Path.ContextId: + name: contextId + in: path + description: >- + Uniquely identifies the application context in the MEC system. + It is assigned by the MEC system and included in the response to + an AppContext create. + required: true + schema: + type: string + requestBodies: + AppContext: + description: >- + Uniquely identifies the application context in the MEC system. + It is assigned by the MEC system and included in the response to + an AppContext create. + content: + application/json: + schema: + $ref: "#/components/schemas/AppContext" + required: true + responses: + AppContext: + description: >- + The response body contains the Application Context as it was created + by the MEC system + content: + application/json: + schema: + $ref: "#/components/schemas/AppContext" + AppList: + description: >- + The response body contains the ApplicationList resource available + for the querying UE application + content: + application/json: + schema: + $ref: "#/components/schemas/ApplicationList" + Error.400: + description: >- + Bad Request. + It is used to indicate that incorrect parameters were passed to the request. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + Error.401: + description: >- + Unauthorized. + It is used when the client did not submit the appropriate credentials. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + Error.403: + description: >- + Forbidden. + The operation is not allowed given the current status of the resource. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + Error.404: + description: >- + Not Found. + It is used when a client provided a URI that cannot be mapped + to a valid resource URI. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + securitySchemes: + OauthSecurity: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://oauth.exampleAPI/token + scopes: + all: Single oauth2 scope for API + schemas: + Empty: + description: Empty schema + ProblemDetails: + type: object + properties: + type: + $ref: "#/components/schemas/Problem.type" + title: + $ref: "#/components/schemas/Problem.title" + status: + $ref: "#/components/schemas/Problem.status" + detail: + $ref: "#/components/schemas/Problem.detail" + instance: + $ref: "#/components/schemas/Problem.instance" + Problem.type: + type: string + format: uri + description: >- + A URI reference according to IETF RFC 3986 that identifies the problem + type + Problem.title: + type: string + description: >- + A short, human-readable summary of the problem type + Problem.status: + type: integer + format: uint32 + description: >- + The HTTP status code for this occurrence of the problem + Problem.detail: + type: string + description: >- + A human-readable explanation specific to this occurrence of the problem + Problem.instance: + type: string + format: uri + description: >- + A URI reference that identifies the specific occurrence of the problem + ApplicationList: + description: >- + Information on available applications + type: object + properties: + appInfo: + $ref: "#/components/schemas/AppInfo" + vendorSpecificExt: + $ref: "#/components/schemas/VendorSpecificExt" + AppContext: + description: >- + Information on application context created by the MEC system + type: object + required: + - contextId + - associateUeAppId + - appInfo + properties: + contextId: + $ref: "#/components/schemas/ContextId" + associateUeAppId: + $ref: "#/components/schemas/AssociateUeAppId" + callbackReference: + $ref: "#/components/schemas/CallbackReference" + appInfo: + $ref: "#/components/schemas/RequiredAppInfo" + NotificationEvent: + description: >- + The parameters used in the method "Receiving notification events". + type: object + required: + - referenceURI + properties: + referenceURI: + $ref: "#/components/schemas/ReferenceURL" + VendorSpecificExtList: + description: Extension for vendor specific information. + type: array + minItems: 0 + items: + $ref: "#/components/schemas/VendorSpecificExt" + VendorSpecificExt: + description: >- + Extension for vendor-specific information + required: + - vendorId + properties: + vendorId: + $ref: "#/components/schemas/VendorId" + ContextId: + description: >- + Uniquely identifies the application context in the MEC system. + Assigned by the MEC system and included in the response. The + length of the value shall not exceed 32 characters. + type: string + AssociateUeAppId: + description: >- + Uniquely identifies the UE application. Included in the request. The + length of the value shall not exceed 32 characters. + type: string + VendorId: + description: >- + Vendor identifier. The length of the value shall not exceed 32 + characters. The rest of the structure of this vendor specific extension + is not defined + type: string + AppInfo: + description: >- + User applications available for the UE application + type: array + items: + $ref: "#/components/schemas/AppInfoList" + AppInfoList: + type: object + required: + - appName + - appProvider + - appDescription + properties: + appName: + $ref: "#/components/schemas/AppName" + appProvider: + $ref: "#/components/schemas/AppProvider" + appSoftVersion: + $ref: "#/components/schemas/AppSoftVersion" + appDescription: + $ref: "#/components/schemas/AppDescription" + appCharcs: + $ref: "#/components/schemas/AppCharcs" + RequiredAppInfo: + description: Included in the request + type: object + required: + - appName + - appProvider + - referenceURL + properties: + appName: + $ref: "#/components/schemas/AppName" + appProvider: + $ref: "#/components/schemas/AppProvider" + appSoftVersion: + $ref: "#/components/schemas/AppSoftVersion" + appDescription: + $ref: "#/components/schemas/AppDescription" + referenceURL: + $ref: "#/components/schemas/ReferenceURL" + appPackageSource: + $ref: "#/components/schemas/AppPackageSource" + AppCharcs: + description: >- + The application characteristics relate to the system resources consumed + by the application. UE application can use this information e.g., for + estimating the cost of use of the application or for the expected user + experience + type: object + properties: + memory: + $ref: "#/components/schemas/Memory" + storage: + $ref: "#/components/schemas/Storage" + latency: + $ref: "#/components/schemas/Latency" + bandwidth: + $ref: "#/components/schemas/Bandwidth" + serviceCont: + $ref: "#/components/schemas/ServiceCont" + Memory: + description: >- + The maximum size in Mbytes of the memory resource reserved for the + MEC application instance in the MEC system + type: integer + format: uint32 + Storage: + description: >- + The maximum size in Mbytes of the storage resource expected to be used + by the MEC application instance in the MEC system + type: integer + format: uint32 + Latency: + description: >- + The target round trip time in milliseconds supported by the MEC + system for the MEC application instance + type: integer + format: uint32 + Bandwidth: + description: >- + The required connection bandwidth in kbit/s for the use of the mobile + edge application instance + type: integer + format: uint32 + ServiceCont: + description: >- + Required service continuity mode for this application. + type: string + enum: + - SERVICE_CONTINUITY_NOT_REQUIRED + - SERVICE_CONTINUITY_REQUIRED + AppName: + description: >- + Name of the MEC application. The length of the value shall not + exceed 32 characters. + type: string + AppProvider: + description: >- + Provider of the MEC application. The length of the value shall + not exceed 32 characters. + type: string + AppSoftVersion: + description: >- + Software version of the MEC application. The length of the value + shall not exceed 32 characters. + type: string + AppDescription: + description: >- + Human readable description of the MEC application. NOTE the + language support may be limited. The length of the value shall not + exceed 128 characters. + type: string + CallbackReference: + description: >- + URI assigned by the UE application to receive application lifecycle + related notifications. Included in the request. This subscription stays + alive for the lifetime of the application context. + type: string + format: uri + ReferenceURL: + description: >- + Address of the user application. Used as the reference URL for the + application. Assigned by the MEC system and included in the + response + type: string + format: uri + AppPackageSource: + description: >- + URI of the application package. Included in the request if the + application is not one in the ApplicationList. appPackageSource enables + on-boarding of the application package into the MEC system. The + application package shall comply with the definitions in clause 6.2.1.2 + of ETSI GS MEC 010-2 + type: string + format: uri \ No newline at end of file diff --git a/test/yaml/UEAppInterfaceApi2.yaml b/test/yaml/UEAppInterfaceApi2.yaml new file mode 100644 index 0000000..d4703ae --- /dev/null +++ b/test/yaml/UEAppInterfaceApi2.yaml @@ -0,0 +1,495 @@ +info: + title: UE Application Interface API + version: 1.1.1 + description: >- + The ETSI MEC ISG MEC016 UE Application Interface API described using OpenAPI + license: + name: ETSI Forge copyright notice + url: https://forge.etsi.org/etsi-forge-copyright-notice.txt + contact: + email: cti_support@etsi.org +externalDocs: + description: >- + ETSI GS MEC016 UE Application Interface API, V1.1.1 + url: http://www.etsi.org/deliver/etsi_gs/MEC/001_099/016/01.01.01_60/gs_MEC016v010101p.pdf +security: + - OauthSecurity: + - all +servers: + - url: http://127.0.0.1:8081/mx2/v1 + - url: https://127.0.0.1:8081/mx2/v1 +tags: + - name: appList + - name: appContext +paths: + "/app_list": + get: + description: >- + Used to query information about the available + MEC applications. + operationId: AppList_GET + tags: + - appList + parameters: + - $ref: "#/components/parameters/Query.AppName" + - $ref: "#/components/parameters/Query.AppProvider" + - $ref: "#/components/parameters/Query.AppSoftVersion" + - $ref: "#/components/parameters/Query.ServiceCont" + - $ref: "#/components/parameters/Query.VendorId" + responses: + "200": + $ref: '#/components/responses/AppList' + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + "/app_contexts": + post: + description: >- + The POST method can be used to create a new application context. Upon + success, the response contains entity body describing the created + application context. + operationId: AppContext_POST + tags: + - appContext + requestBody: + $ref: "#/components/requestBodies/AppContext" + responses: + "201": + $ref: '#/components/responses/AppContext' + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + "/app_contexts/{contextId}": + parameters: + - $ref: "#/components/parameters/Path.ContextId" + put: + description: >- + The PUT method is used to update the callback reference of the existing + application context. Upon successful operation, the target resource is + updated with new callback reference. + operationId: AppContextId_PUT + tags: + - appContext + requestBody: + $ref: "#/components/requestBodies/AppContext" + responses: + "204": + description: No Content. + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + delete: + description: >- + The DELETE method is used to delete the resource that represents the + existing application context. + operationId: AppContextId_DEL + tags: + - appContext + responses: + "204": + description: No Content + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' +components: + parameters: + Query.AppName: + name: appName + in: query + description: >- + Name to identify the MEC application + required: false + schema: + type: array + items: + type: string + Query.AppProvider: + name: appProvider + in: query + description: >- + Provider of the MEC application + required: false + schema: + type: array + items: + type: string + Query.AppSoftVersion: + name: appSoftVersion + in: query + description: >- + Software version of the MEC application + required: false + schema: + type: array + items: + type: string + Query.ServiceCont: + name: serviceCont + in: query + description: >- + Required service continuity mode for this application + required: false + schema: + type: string + enum: + - SERVICE_CONTINUITY_NOT_REQUIRED + - SERVICE_CONTINUITY_REQUIRED + Query.VendorId: + name: vendorId + in: query + description: Vendor identifier + required: false + schema: + type: array + items: + type: string + Path.ContextId: + name: contextId + in: path + description: >- + Uniquely identifies the application context in the MEC system. + It is assigned by the MEC system and included in the response to + an AppContext create. + required: true + schema: + type: string + requestBodies: + AppContext: + description: >- + Uniquely identifies the application context in the MEC system. + It is assigned by the MEC system and included in the response to + an AppContext create. + content: + application/json: + schema: + $ref: "#/components/schemas/AppContext" + required: true + responses: + AppContext: + description: >- + The response body contains the Application Context as it was created + by the MEC system + content: + application/json: + schema: + $ref: "#/components/schemas/AppContext" + AppList: + description: >- + The response body contains the ApplicationList resource available + for the querying UE application + content: + application/json: + schema: + $ref: "#/components/schemas/ApplicationList" + Error.400: + description: >- + Bad Request. + It is used to indicate that incorrect parameters were passed to the request. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + Error.401: + description: >- + Unauthorized. + It is used when the client did not submit the appropriate credentials. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + Error.403: + description: >- + Forbidden. + The operation is not allowed given the current status of the resource. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + Error.404: + description: >- + Not Found. + It is used when a client provided a URI that cannot be mapped + to a valid resource URI. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + securitySchemes: + OauthSecurity: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://oauth.exampleAPI/token + scopes: + all: Single oauth2 scope for API + schemas: + Empty: + description: Empty schema + ProblemDetails: + type: object + properties: + type: + $ref: "#/components/schemas/Problem.type" + title: + $ref: "#/components/schemas/Problem.title" + status: + $ref: "#/components/schemas/Problem.status" + detail: + $ref: "#/components/schemas/Problem.detail" + instance: + $ref: "#/components/schemas/Problem.instance" + Problem.type: + type: string + format: uri + description: >- + A URI reference according to IETF RFC 3986 that identifies the problem + type + Problem.title: + type: string + description: >- + A short, human-readable summary of the problem type + Problem.status: + type: integer + format: uint32 + description: >- + The HTTP status code for this occurrence of the problem + Problem.detail: + type: string + description: >- + A human-readable explanation specific to this occurrence of the problem + Problem.instance: + type: string + format: uri + description: >- + A URI reference that identifies the specific occurrence of the problem + ApplicationList: + description: >- + Information on available applications + type: object + properties: + appInfo: + $ref: "#/components/schemas/AppInfo" + vendorSpecificExt: + $ref: "#/components/schemas/VendorSpecificExt" + AppContext: + description: >- + Information on application context created by the MEC system + type: object + required: + - contextId + - associateUeAppId + - appInfo + properties: + contextId: + $ref: "#/components/schemas/ContextId" + associateUeAppId: + $ref: "#/components/schemas/AssociateUeAppId" + callbackReference: + $ref: "#/components/schemas/CallbackReference" + appInfo: + $ref: "#/components/schemas/RequiredAppInfo" + NotificationEvent: + description: >- + The parameters used in the method "Receiving notification events". + type: object + required: + - referenceURI + properties: + referenceURI: + $ref: "#/components/schemas/ReferenceURL" + VendorSpecificExtList: + description: Extension for vendor specific information. + type: array + minItems: 0 + items: + $ref: "#/components/schemas/VendorSpecificExt" + VendorSpecificExt: + description: >- + Extension for vendor-specific information + required: + - vendorId + properties: + vendorId: + $ref: "#/components/schemas/VendorId" + ContextId: + description: >- + Uniquely identifies the application context in the MEC system. + Assigned by the MEC system and included in the response. The + length of the value shall not exceed 32 characters. + type: string + AssociateUeAppId: + description: >- + Uniquely identifies the UE application. Included in the request. The + length of the value shall not exceed 32 characters. + type: string + VendorId: + description: >- + Vendor identifier. The length of the value shall not exceed 32 + characters. The rest of the structure of this vendor specific extension + is not defined + type: string + AppInfo: + description: >- + User applications available for the UE application + type: array + items: + $ref: "#/components/schemas/AppInfoList" + AppInfoList: + type: object + required: + - appName + - appProvider + - appDescription + properties: + appName: + $ref: "#/components/schemas/AppName" + appProvider: + $ref: "#/components/schemas/AppProvider" + appSoftVersion: + $ref: "#/components/schemas/AppSoftVersion" + appDescription: + $ref: "#/components/schemas/AppDescription" + appCharcs: + $ref: "#/components/schemas/AppCharcs" + RequiredAppInfo: + description: Included in the request + type: object + required: + - appName + - appProvider + - referenceURL + properties: + appName: + $ref: "#/components/schemas/AppName" + appProvider: + $ref: "#/components/schemas/AppProvider" + appSoftVersion: + $ref: "#/components/schemas/AppSoftVersion" + appDescription: + $ref: "#/components/schemas/AppDescription" + referenceURL: + $ref: "#/components/schemas/ReferenceURL" + appPackageSource: + $ref: "#/components/schemas/AppPackageSource" + AppCharcs: + description: >- + The application characteristics relate to the system resources consumed + by the application. UE application can use this information e.g., for + estimating the cost of use of the application or for the expected user + experience + type: object + properties: + memory: + $ref: "#/components/schemas/Memory" + storage: + $ref: "#/components/schemas/Storage" + latency: + $ref: "#/components/schemas/Latency" + bandwidth: + $ref: "#/components/schemas/Bandwidth" + serviceCont: + $ref: "#/components/schemas/ServiceCont" + Memory: + description: >- + The maximum size in Mbytes of the memory resource reserved for the + MEC application instance in the MEC system + type: integer + format: uint32 + Storage: + description: >- + The maximum size in Mbytes of the storage resource expected to be used + by the MEC application instance in the MEC system + type: integer + format: uint32 + Latency: + description: >- + The target round trip time in milliseconds supported by the MEC + system for the MEC application instance + type: integer + format: uint32 + Bandwidth: + description: >- + The required connection bandwidth in kbit/s for the use of the mobile + edge application instance + type: integer + format: uint32 + ServiceCont: + description: >- + Required service continuity mode for this application. + type: string + enum: + - SERVICE_CONTINUITY_NOT_REQUIRED + - SERVICE_CONTINUITY_REQUIRED + AppName: + description: >- + Name of the MEC application. The length of the value shall not + exceed 32 characters. + type: string + AppProvider: + description: >- + Provider of the MEC application. The length of the value shall + not exceed 32 characters. + type: string + AppSoftVersion: + description: >- + Software version of the MEC application. The length of the value + shall not exceed 32 characters. + type: string + AppDescription: + description: >- + Human readable description of the MEC application. NOTE the + language support may be limited. The length of the value shall not + exceed 128 characters. + type: string + CallbackReference: + description: >- + URI assigned by the UE application to receive application lifecycle + related notifications. Included in the request. This subscription stays + alive for the lifetime of the application context. + type: string + format: uri + ReferenceURL: + description: >- + Address of the user application. Used as the reference URL for the + application. Assigned by the MEC system and included in the + response + type: string + format: uri + AppPackageSource: + description: >- + URI of the application package. Included in the request if the + application is not one in the ApplicationList. appPackageSource enables + on-boarding of the application package into the MEC system. The + application package shall comply with the definitions in clause 6.2.1.2 + of ETSI GS MEC 010-2 + type: string + format: uri diff --git a/test/yaml/UEAppInterfaceApi3.yaml b/test/yaml/UEAppInterfaceApi3.yaml new file mode 100644 index 0000000..6d9533e --- /dev/null +++ b/test/yaml/UEAppInterfaceApi3.yaml @@ -0,0 +1,496 @@ +openapi: 3.0.2 +info: + title: UE Application Interface API + version: 1.1.1 + description: >- + The ETSI MEC ISG MEC016 UE Application Interface API described using OpenAPI + license: + name: ETSI Forge copyright notice + url: https://forge.etsi.org/etsi-forge-copyright-notice.txt + contact: + email: cti_support@etsi.org +externalDocs: + description: >- + ETSI GS MEC016 UE Application Interface API, V1.1.1 + url: http://www.etsi.org/deliver/etsi_gs/MEC/001_099/016/01.01.01_60/gs_MEC016v010101p.pdf +security: + - OauthSecurity: + - all +servers: + - url: http://127.0.0.1:8081/mx2/v1 + - url: https://127.0.0.1:8081/mx2/v1 +tags: + - name: appList + - name: appContext +paths: + "/app_list": + get: + description: >- + Used to query information about the available + MEC applications. + operationId: AppList_GET + tags: + - appList + parameters: + - $ref: "#/components/parameters/Query.AppName" + - $ref: "#/components/parameters/Query.AppProvider" + - $ref: "#/components/parameters/Query.AppSoftVersion" + - $ref: "#/components/parameters/Query.ServiceCont" + - $ref: "#/components/parameters/Query.VendorId" + responses: + "200": + $ref: '#/components/responses/AppList' + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + "/app_contexts": + post: + description: >- + The POST method can be used to create a new application context. Upon + success, the response contains entity body describing the created + application context. + operationId: AppContext_POST + tags: + - appContext + requestBody: + $ref: "#/components/requestBodies/AppContext" + responses: + "201": + $ref: '#/components/responses/AppContext' + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + "/app_contexts/{contextId}": + parameters: + - $ref: "#/components/parameters/Path.ContextId" + put: + description: >- + The PUT method is used to update the callback reference of the existing + application context. Upon successful operation, the target resource is + updated with new callback reference. + operationId: AppContextId_PUT + tags: + - appContext + requestBody: + $ref: "#/components/requestBodies/AppContext" + responses: + "204": + description: No Content. + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' + delete: + description: >- + The DELETE method is used to delete the resource that represents the + existing application context. + operationId: AppContextId_DEL + tags: + - appContext + responses: + "204": + description: No Content + "400": + $ref: '#/components/responses/Error.400' + "401": + $ref: '#/components/responses/Error.401' + "403": + $ref: '#/components/responses/Error.403' + "404": + $ref: '#/components/responses/Error.404' +components: + parameters: + Query.AppName: + name: appName + in: query + description: >- + Name to identify the MEC application + required: false + schema: + type: array + items: + type: string + Query.AppProvider: + name: appProvider + in: query + description: >- + Provider of the MEC application + required: false + schema: + type: array + items: + type: string + Query.AppSoftVersion: + name: appSoftVersion + in: query + description: >- + Software version of the MEC application + required: false + schema: + type: array + items: + type: string + Query.ServiceCont: + name: serviceCont + in: query + description: >- + Required service continuity mode for this application + required: false + schema: + type: string + enum: + - SERVICE_CONTINUITY_NOT_REQUIRED + - SERVICE_CONTINUITY_REQUIRED + Query.VendorId: + name: vendorId + in: query + description: Vendor identifier + required: false + schema: + type: array + items: + type: string + Path.ContextId: + name: contextId + in: path + description: >- + Uniquely identifies the application context in the MEC system. + It is assigned by the MEC system and included in the response to + an AppContext create. + required: true + schema: + type: string + requestBodies: + AppContext: + description: >- + Uniquely identifies the application context in the MEC system. + It is assigned by the MEC system and included in the response to + an AppContext create. + content: + application/json: + schema: + $ref: "#/components/schemas/AppContext" + required: true + responses: + AppContext: + description: >- + The response body contains the Application Context as it was created + by the MEC system + content: + application/json: + schema: + $ref: "#/components/schemas/AppContext" + AppList: + description: >- + The response body contains the ApplicationList resource available + for the querying UE application + content: + application/json: + schema: + $ref: "#/components/schemas/ApplicationList" + Error.400: + description: >- + Bad Request. + It is used to indicate that incorrect parameters were passed to the request. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + Error.401: + description: >- + Unauthorized. + It is used when the client did not submit the appropriate credentials. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + Error.403: + description: >- + Forbidden. + The operation is not allowed given the current status of the resource. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + Error.404: + description: >- + Not Found. + It is used when a client provided a URI that cannot be mapped + to a valid resource URI. + content: + application/problem+json: + schema: + $ref: '#/components/schemas/ProblemDetails' + text/plain: + schema: + $ref: '#/components/schemas/Empty' + securitySchemes: + OauthSecurity: + type: oauth2 + flows: + clientCredentials: + tokenUrl: https://oauth.exampleAPI/token + scopes: + all: Single oauth2 scope for API + schemas: + Empty: + description: Empty schema + ProblemDetails: + type: object + properties: + type: + $ref: "#/components/schemas/Problem.type" + title: + $ref: "#/components/schemas/Problem.title" + status: + $ref: "#/components/schemas/Problem.status" + detail: + $ref: "#/components/schemas/Problem.detail" + instance: + $ref: "#/components/schemas/Problem.instance" + Problem.type: + type: string + format: uri + description: >- + A URI reference according to IETF RFC 3986 that identifies the problem + type + Problem.title: + type: string + description: >- + A short, human-readable summary of the problem type + Problem.status: + type: integer + format: uint32 + description: >- + The HTTP status code for this occurrence of the problem + Problem.detail: + type: string + description: >- + A human-readable explanation specific to this occurrence of the problem + Problem.instance: + type: string + format: uri + description: >- + A URI reference that identifies the specific occurrence of the problem + ApplicationList: + description: >- + Information on available applications + type: object + properties: + appInfo: + $ref: "#/components/schemas/AppInfo" + vendorSpecificExt: + $ref: "#/components/schemas/VendorSpecificExt" + AppContext: + description: >- + Information on application context created by the MEC system + type: object + required: + - contextId + - associateUeAppId + - appInfo + properties: + contextId: + $ref: "#/components/schemas/ContextId" + associateUeAppId: + $ref: "#/components/schemas/AssociateUeAppId" + callbackReference: + $ref: "#/components/schemas/CallbackReference" + appInfo: + $ref: "#/components/schemas/RequiredAppInfo" + NotificationEvent: + description: >- + The parameters used in the method "Receiving notification events". + type: object + required: + - referenceURI + properties: + referenceURI: + $ref: "#/components/schemas/ReferenceURL" + VendorSpecificExtList: + description: Extension for vendor specific information. + type: array + minItems: 0 + items: + $ref: "#/components/schemas/VendorSpecificExt" + VendorSpecificExt: + description: >- + Extension for vendor-specific information + required: + - vendorId + properties: + vendorId: + $ref: "#/components/schemas/VendorId" + ContextId: + description: >- + Uniquely identifies the application context in the MEC system. + Assigned by the MEC system and included in the response. The + length of the value shall not exceed 32 characters. + type: string + AssociateUeAppId: + description: >- + Uniquely identifies the UE application. Included in the request. The + length of the value shall not exceed 32 characters. + type: string + VendorId: + description: >- + Vendor identifier. The length of the value shall not exceed 32 + characters. The rest of the structure of this vendor specific extension + is not defined + type: string + AppInfo: + description: >- + User applications available for the UE application + type: array + items: + $ref: "#/components/schemas/AppInfoList" + AppInfoList: + type: object + required: + - appName + - appProvider + - appDescription + properties: + appName: + $ref: "#/components/schemas/AppName" + appProvider: + $ref: "#/components/schemas/AppProvider" + appSoftVersion: + $ref: "#/components/schemas/AppSoftVersion" + appDescription: + $ref: "#/components/schemas/AppDescription" + appCharcs: + $ref: "#/components/schemas/AppCharcs" + RequiredAppInfo: + description: Included in the request + type: object + required: + - appName + - appProvider + - referenceURL + properties: + appName: + $ref: "#/components/schemas/AppName" + appProvider: + $ref: "#/components/schemas/AppProvider" + appSoftVersion: + $ref: "#/components/schemas/AppSoftVersion" + appDescription: + $ref: "#/components/schemas/AppDescription" + referenceURL: + $ref: "#/components/schemas/ReferenceURL" + appPackageSource: + $ref: "#/components/schemas/AppPackageSource" + AppCharcs: + description: >- + The application characteristics relate to the system resources consumed + by the application. UE application can use this information e.g., for + estimating the cost of use of the application or for the expected user + experience + type: object + properties: + memory: + $ref: "#/components/schemas/Memory" + storage: + $ref: "#/components/schemas/Storage" + latency: + $ref: "#/components/schemas/Latency" + bandwidth: + $ref: "#/components/schemas/Bandwidth" + serviceCont: + $ref: "#/components/schemas/ServiceCont" + Memory: + description: >- + The maximum size in Mbytes of the memory resource reserved for the + MEC application instance in the MEC system + type: integer + format: uint32 + Storage: + description: >- + The maximum size in Mbytes of the storage resource expected to be used + by the MEC application instance in the MEC system + type: integer + format: uint32 + Latency: + description: >- + The target round trip time in milliseconds supported by the MEC + system for the MEC application instance + type: integer + format: uint32 + Bandwidth: + description: >- + The required connection bandwidth in kbit/s for the use of the mobile + edge application instance + type: integer + format: uint32 + ServiceCont: + description: >- + Required service continuity mode for this application. + type: string + enum: + - SERVICE_CONTINUITY_NOT_REQUIRED + - SERVICE_CONTINUITY_REQUIRED + AppName: + description: >- + Name of the MEC application. The length of the value shall not + exceed 32 characters. + type: string + AppProvider: + description: >- + Provider of the MEC application. The length of the value shall + not exceed 32 characters. + type: string + AppSoftVersion: + description: >- + Software version of the MEC application. The length of the value + shall not exceed 32 characters. + type: string + AppDescription: + description: >- + Human readable description of the MEC application. NOTE the + language support may be limited. The length of the value shall not + exceed 128 characters. + type: string + CallbackReference: + description: >- + URI assigned by the UE application to receive application lifecycle + related notifications. Included in the request. This subscription stays + alive for the lifetime of the application context. + type: string + format: uri + ReferenceURL: + description: >- + Address of the user application. Used as the reference URL for the + application. Assigned by the MEC system and included in the + response + type: string + format: uri + AppPackageSource: + description: >- + URI of the application package. Included in the request if the + application is not one in the ApplicationList. appPackageSource enables + on-boarding of the application package into the MEC system. The + application package shall comply with the definitions in clause 6.2.1.2 + of ETSI GS MEC 010-2 + type: string + format: uri \ No newline at end of file diff --git a/validate-all.sh b/validate-all.sh index 66981be..3fcf961 100644 --- a/validate-all.sh +++ b/validate-all.sh @@ -26,13 +26,13 @@ function validate { fi } -echo "------ Switching to $1 folder --------" +echo -e "\n------ Switching to $1 folder --------" cd $1 -echo "------ Content of the folder ------" +echo -e "\n------ Content of the folder ------" ls -echo "------ Validating all YAML files ------" +echo -e "\n------ Validating all YAML files ------" # If there are no YAML file, simply exit ls | grep -q yaml found_yaml=$? @@ -42,14 +42,30 @@ if [ ! $found_yaml ] ; then fi fres=0 - +LOG="" +ERR="" for i in ./*.yaml ; do echo "---- Will validate: $i ----" - validate "$i" + MSG=$(validate "$i" 2>&1) res=$? + if [ ! $res == 0 ] ; then + ERR="$ERR$MSG\n" + fi + LOG="$LOG$MSG\n" fres=$(($fres||$res)) done +echo -e "\n-- Final validator returns $fres." + + +if [ ! "$ERR" == "" ] ; then + echo -e "\n---- Errors detected ----" + echo -e $ERR +fi + +echo -e "\n---- Complete log of validation ----" +echo -e $LOG + # Exit code needed for jenkins to know the verdict of the build -echo "-- Final validator returns $fres." + exit $fres -- GitLab