vmware / go-vcloud-director

Golang SDK for VMware Cloud Director
Other
80 stars 79 forks source link

Add the feature to ignore metadata for OpenAPI metadata endpoints #632

Closed adambarreiro closed 8 months ago

adambarreiro commented 9 months ago

This PR complements #557 by adding the support of IgnoredMetadata to OpenAPI metadata resources like DefinedEntity.

The implementation tries to avoid duplicating the already existing mechanism used by XML ignored metadata, by creating an intermediate struct that normalises both XML and OpenAPI flavors into a common type that can be understood by the same filtering function.

For that reason we have

With the two normalised structs, we can use filterSingleGenericMetadataEntry that now it doesn't care about OpenAPI nor XML, it just contains the logic to filter.

Then we have two filterSingleXmlMetadataEntry and filterSingleOpenApiMetadataEntry that calls the normalising function and the filtering.