PUT /vnf_packages/{vnfPkgId}/package_content; Incorrect schema of the request “#/components/requestBodies/VnfPackageContentRequest”
As per the SOL003 (4.3.1) Spec, the VnfPackageContentRequest has no fields / properties prescribed. However, in the swagger (yaml) declarations, the properties “file” is defined as application/binary:
VnfPackageContentRequest:
content:
application/binary:
schema:
properties:
file:
type: file
description: |
The payload body contains a ZIP file that represents the VNF package. The "Content-Type" HTTP header shall
be set according to the type of the file, i.e. to "application/zip" for a VNF Package as defined in ETSI GS NFV-SOL 004.
format: binary
required: true
This causes the Open-Api Code generator for the Spring-boot to nest a JSON field “file” within a wrapper class: “VnfPackagesVnfPkgIdPackageContentGetRequest.java”
So, the Spring framework rejects the request as Unsupported Media Type “application/zip”. Supported Media Types: [“application/json”]
/**
* Class: VnfPackagesVnfPkgIdPackageContentGetRequest
*/
@JsonTypeName("_vnf_packages__vnfPkgId__package_content_get_request")
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2023-02-13T18:25:48.058910+05:30[Asia/Kolkata]")
public class VnfPackagesVnfPkgIdPackageContentGetRequest {
@JsonProperty("file")
private org.springframework.core.io.Resource file = null;
public VnfPackagesVnfPkgIdPackageContentGetRequest file(org.springframework.core.io.Resource file) {
this.file = file;
return this;
}
—--
Fix required: The swagger SOL005/src/SOL005/VNFPackageManagement/VNFPackageManagement.yaml should NOT define a property “file”, given the request content in its entirety is a BINARY (and not a JSON/XML)
Edited by banerjeesu