-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snippetgen): generate mock input for required fields (#941)
Generate mock field inputs for all required fields. * For oneofs, the first option is selected. * For enums, the last option is selected (as 0 is often unspecified). * Mock input for string fields that reference resources (`resource_pb2.resource_reference`) is the pattern provided in the protos. **TODOs:** - When a resource's pattern is `*` this results in unhelpful strings ```proto message Asset { option (google.api.resource) = { type: "cloudasset.googleapis.com/Asset" pattern: "*" }; ``` ```py request = asset_v1.BatchGetAssetsHistoryRequest( parent="*", ) ``` - Map fields are not yet handled. **Other changes:** * Fields are set like `foo.bar` rather than through dict access `foo["bar"]`. This is because the former allows you to set fields nested more than one field deep `foo.bar.baz`. **Before**: ```py output_config = {} output_config["gcs_destination"]["uri"] = "uri_value" # fails as there is no nested dict ``` **After**: ```py output_config = asset_v1.IamPolicyAnalysisOutputConfig() output_config.gcs_destination.uri = "uri_value" ```
- Loading branch information
1 parent
49205d9
commit b2149da
Showing
144 changed files
with
1,155 additions
and
107 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
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
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
Oops, something went wrong.