SNIA / Swordfish-API-Emulator

The Swordfish API Emulator can emulate a Swordfish-based system statically or dynamically. Starting from an initial state described by mock-ups, the emulator can be used to emulate a Swordfish system responding to create/modify/delete operations in order to allow developers to model new Swordfish functionality, test clients, demonstrate Swordfish and other similar functions.
Other
22 stars 19 forks source link

DataStorageLoSCapabilities_v1_2_2_DataStorageLoSCapabilities SupportedLinesOfService #136

Open commonism opened 3 months ago

commonism commented 3 months ago

Hi,

using v1.2.6 the mockup http://service-based-mockups.swordfishmockups.com fails validation using the provided openapi description documents. The PathItems

/redfish/v1/StorageServices/FileService/DataProtectionLoSCapabilities/
/redfish/v1/StorageServices/1/IOPerformanceLoSCapabilities/
/redfish/v1/StorageServices/FileService/IOPerformanceLoSCapabilities/
/redfish/v1/StorageServices/1/IOPerformanceLoSCapabilities/
/redfish/v1/StorageServices/FileService/IOConnectivityLoSCapabilities/
/redfish/v1/StorageServices/1/DataProtectionLoSCapabilities/
/redfish/v1/StorageServices/FileService/DataSecurityLoSCapabilities/
/redfish/v1/StorageServices/FileService/IOPerformanceLoSCapabilities/
/redfish/v1/StorageServices/1/DataSecurityLoSCapabilities/
/redfish/v1/StorageServices/1/DataStorageLoSCapabilities/

fail validation.

The problem is in the SupportedLinesOfService property:

       10 validation errors for DataStorageLoSCapabilities_v1_2_2_DataStorageLoSCapabilities
SupportedLinesOfService.0.`@odata.type`
  Extra inputs are not permitted [type=extra_forbidden, input_value='#DataSecurityLineOfServi...taSecurityLineOfService', input_type=str]
    For further information visit https://errors.pydantic.dev/2.5/v/extra_forbidden
SupportedLinesOfService.0.Id
  Extra inputs are not permitted [type=extra_forbidden, input_value='SecureData', input_type=str]
    For further information visit https://errors.pydantic.dev/2.5/v/extra_forbidden
…

which is defined as

        SupportedLinesOfService:
          description: Collection of known and supported DataStorageLinesOfService.
          items:
            $ref: http://redfish.dmtf.org/schemas/v1/odata-v4.yaml#/components/schemas/odata-v4_idRef
          readOnly: false
          type: array
          x-autoExpand: true
          x-longDescription: The collection shall contain known and supported DataStorageLinesOfService.

but served as:

…
    "SupportedLinesOfService": [
        {
            "@odata.type": "#DataSecurityLineOfService.v1_1_1.DataSecurityLineOfService",
            "Id": "SecureData",
            "Name": "SecureData",
            "MediaEncryptionStrength": "Bits_256",
            "ChannelEncryptionStrength": "Bits_128",
            "HostAuthenticationType": "Ticket",
            "UserAuthenticationType": "Password",
            "SecureChannelProtocol": "TLS",
            "AntivirusScanPolicies": [],
            "DataSanitizationPolicy": "CryptographicErase",
            "@odata.id": "/redfish/v1/StorageServices/FileService/LinesOfService/DataSecurityLinesOfService/SecureData"
        }
…

this is most likely due to missing auto-expansion when generating the OpenAPI description documents (c.f. https://github.com/DMTF/Redfish-Service-Validator/issues/588). Changing the type to the "expanded" in the description documents works for me.

rahlvers commented 3 months ago

Cross-logged in Swordfish TWG repository.