Skip to content

Commit

Permalink
tools/importer-rest-api-specs: adding a swagger data workaround for A…
Browse files Browse the repository at this point in the history
  • Loading branch information
tombuildsstuff committed Nov 16, 2022
1 parent d3dcd39 commit eea2584
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ func patchSwaggerData(input []models.AzureApiDefinition, logger hclog.Logger) (*
item.Resources["Fleets"] = resource
}

// Works around the Update operation having the incorrect Swagger Tag (StreamingEndpoint
// rather than StreamingEndpoints).
// Swagger PR: https://github.com/Azure/azure-rest-api-specs/pull/21581
if item.ServiceName == "MediaServices" && item.ApiVersion == "2022-05-01" {
singular, singularExists := item.Resources["StreamingEndpoint"]
plural, pluralExists := item.Resources["StreamingEndpoints"]
if singularExists && pluralExists {
updateOperation, ok := singular.Operations["Update"]
if ok {
// NOTE: we should be moving the Model too, but as it's the same as for Create this should be fine
plural.Operations["Update"] = updateOperation
item.Resources["StreamingEndpoints"] = plural
delete(item.Resources, "StreamingEndpoint")
}
}
}

output = append(output, item)
}

Expand Down

0 comments on commit eea2584

Please sign in to comment.