forked from Azure/azure-service-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes Azure#1474
- Loading branch information
Showing
7 changed files
with
51 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
v2/tools/generator/internal/codegen/pipeline/remove_empty_objects.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) Microsoft Corporation. | ||
* Licensed under the MIT license. | ||
*/ | ||
|
||
package pipeline | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Azure/azure-service-operator/v2/tools/generator/internal/codegen/embeddedresources" | ||
) | ||
|
||
const RemoveEmptyObjectsStageId = "removeEmptyObjects" | ||
|
||
// RemoveEmptyObjects removes Definitions which are empty (an object type with no properties) | ||
func RemoveEmptyObjects() *Stage { | ||
return NewStage( | ||
RemoveEmptyObjectsStageId, | ||
"Remove empty Objects", | ||
func(ctx context.Context, state *State) (*State, error) { | ||
updatedDefs, err := embeddedresources.RemoveEmptyObjects(state.Definitions()) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return state.WithDefinitions(updatedDefs), nil | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters