hashicorp / pandora

A suite of single-purpose tools enabling automation for Terraform/Azure
Mozilla Public License 2.0
69 stars 50 forks source link

`SecurityInsights` @ `2022-07-01-preview` - missing properties #1714

Open ziyeqf opened 2 years ago

ziyeqf commented 2 years ago

generated MLBehaviorAnalyticsAlertRuleTemplateProperties missing all of AlertRuleTemplateWithMitreProperties

resource-manager/securityinsights/2022-07-01-preview/alertruletemplates/model_mlbehavioranalyticsalertruletemplateproperties.go:6

tombuildsstuff commented 2 years ago

@ziyeqf we don't currently support this API Version? https://github.com/hashicorp/go-azure-sdk/tree/main/resource-manager/securityinsights/

ziyeqf commented 2 years ago

@ziyeqf we don't currently support this API Version? https://github.com/hashicorp/go-azure-sdk/tree/main/resource-manager/securityinsights/

Current version is 2021-09-01-preview rather than 2022-07-01-preview, and this issue found when tried to add 2022-07-01-preview

magodo commented 2 years ago

The issue also exists in 2021-09-01-preview. See #1719 for details.

magodo commented 2 years ago

This issue derives from extracting the inlined model at https://github.com/hashicorp/pandora/blob/2e81b696982b908365a38b12921127ed64285584/tools/importer-rest-api-specs/components/parser/models.go#L159

This probably wants to be something similar to https://github.com/hashicorp/pandora/blob/2e81b696982b908365a38b12921127ed64285584/tools/importer-rest-api-specs/components/parser/models.go#L469

ziyeqf commented 2 years ago

@tombuildsstuff this issue still exist on SecurityInsights@2022-07-01-preview, it seems the importer does not handle nested AllOf Swagger piece:

   "MLBehaviorAnalyticsAlertRuleTemplate": {
      "properties": {
        "properties": {
          "allOf": [
            {
              "$ref": "#/definitions/AlertRuleTemplateWithMitreProperties"
            }
          ]}
    }
"AlertRuleTemplateWithMitreProperties": {
        "allOf": [
          {
            "$ref": "#/definitions/AlertRuleTemplatePropertiesBase"
          }
        ],
        "properties": {
        },
        "type": "object"
      }

Then the generated SDK file MLBehaviorAnalyticsAlertRuleTemplateProperties contains properties from MLBehaviorAnalyticsAlertRuleTemplate and AlertRuleTemplateWithMitreProperties, but not contains properites from AlertRuleTemplatePropertiesBase