stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
211 stars 112 forks source link

Compatibility concern when adding HttpBootUri type #259

Closed lzap closed 1 year ago

lzap commented 1 year ago

Hello,

I would like to contribute the following field:

    <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="ComputerSystem.v1_9_0">
      <Annotation Term="Redfish.OwningEntity" String="DMTF"/>
      <Annotation Term="Redfish.Release" String="2019.3"/>

      <EntityType Name="ComputerSystem" BaseType="ComputerSystem.v1_8_0.ComputerSystem"/>

      <ComplexType Name="Boot" BaseType="ComputerSystem.v1_7_0.Boot">
        <Property Name="HttpBootUri" Type="Edm.String">
          <Annotation Term="OData.Permissions" EnumMember="OData.Permission/ReadWrite"/>
          <Annotation Term="OData.Description" String="The URI to boot from when BootSourceOverrideTarget is set to `UefiHttp`."/>
          <Annotation Term="OData.LongDescription" String="This property shall contain the URI to perform an HTTP or HTTPS boot when BootSourceOverrideTarget is set to `UefiHttp`.  If this property is not configured or supported, the URI shall be provided by a DHCP server as specified by the UEFI Specification."/>
          <Annotation Term="OData.IsURL"/>
        </Property>
      </ComplexType>
    </Schema>

So from a brief read I understand that I can simply add this field to the ComputerSystem type. I also see unit tests, that is easy to.

My main question is how to handle compatibility, this flag was added in more recent versions of the schema. What is the approach you take.

Thanks for hints.

Edited, added compatibility concern.

lzap commented 1 year ago

Any hints @stmcginnis ? Thanks.

stmcginnis commented 1 year ago

Don't know how I missed this coming in - sorry about that!

So far, for newer properties and methods in the schema, we've mostly just been adding them and expecting the consumer of the library to handle the error if the attempt fails or the value is missing.

Thanks for looking at this! Contributions would definitely be appreciated.

Not sure if it would be more work for this one targeted update, but there is a script under tools that can be used to generate source from the schema. It doesn't generate the unit tests, but could be an easy diff to copy out the generated code and paste part of it into the source code.

lzap commented 1 year ago

Thanks, created https://github.com/stmcginnis/gofish/pull/271

There is no simulator that supports this relatively new flag, at least no I am aware of. Need to test this on real hardware.