Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-262703: Add x-xgen-sha flag to GenerateAtlasOpenApiSpecTool #93

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tools/cli/internal/cli/flag/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ const (
Spec = "spec"
SpecShort = "s"
Environment = "env"
GitSha = "sha"
)
8 changes: 8 additions & 0 deletions tools/cli/internal/cli/merge/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Opts struct {
basePath string
outputPath string
format string
gitSha string
externalPaths []string
}

Expand All @@ -41,6 +42,12 @@ func (o *Opts) Run() error {
return err
}

if o.gitSha != "" {
federated.Info.Extensions = map[string]interface{}{
"x-xgen-sha": o.gitSha,
}
}

federatedBytes, err := json.MarshalIndent(*federated, "", " ")
if err != nil {
return err
Expand Down Expand Up @@ -97,6 +104,7 @@ func Builder() *cobra.Command {

cmd.Flags().StringVarP(&opts.basePath, flag.Base, flag.BaseShort, "", usage.Base)
cmd.Flags().StringArrayVarP(&opts.externalPaths, flag.External, flag.ExternalShort, nil, usage.External)
cmd.Flags().StringVar(&opts.gitSha, flag.GitSha, "", usage.GitSha)
cmd.Flags().StringVarP(&opts.outputPath, flag.Output, flag.OutputShort, "", usage.Output)
cmd.Flags().StringVarP(&opts.format, flag.Format, flag.FormatShort, "json", usage.Format)

Expand Down
1 change: 1 addition & 0 deletions tools/cli/internal/cli/usage/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ const (
Versions = "Boolean flag that defines wether to split the OAS into multiple versions."
Spec = "Path to the OAS file."
Environment = "Environment to consider when generating the versioned OAS."
GitSha = "GitSHA to use as identifier (x-xgen-sha) of the generated specification."
)
Loading