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-225849: Add scaffolding of the openapi cli #2

Merged
merged 7 commits into from Mar 7, 2024

Conversation

andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Mar 7, 2024

Ticket: CLOUDP-225849

Description

This PR adds the scaffolding of the openapi cli that we will use to merge OASes. In particular, this PR defines the cli builder and the merge command without any logic.

make build                                                                                                                                          4s  1.21.4  16.18.0
==> Building openapicli binary
go build -ldflags "-s -w -X github.com/mongodb/openapi/tools/cli/internal/version.GitCommit=e5fb49fd94796ca0a81618431d81c38d6ff45f7f -X github.com/mongodb/openapi/tools/cli/internal/version.Version=v0.0.1" -o ./bin/openapicli ./cmd

./bin/openapicli -v                                                                                                                                  1.21.4  16.18.0
openapicli version: next
git version: next
Go version: go1.21.4
   os: darwin
   arch: arm64
   compiler: gc

Next steps

  • Open a follow up PR to add the logic of the merge command
  • Open a follow up PR to add tests

@andreaangiolillo andreaangiolillo marked this pull request as ready for review March 7, 2024 17:12
tools/cli/go.mod Outdated Show resolved Hide resolved
tools/cli/bin/openapicli Outdated Show resolved Hide resolved
tools/cli/Makefile Outdated Show resolved Hide resolved
opts := &Opts{}

cmd := &cobra.Command{
Use: "merge [base-spec] [spec-1] [spec-2] [spec-3] ... [spec-n]",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let;s use flags, they are friendlier

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add the logic in a follow-up PR. Out of curiosity, how do you envision the usage of the command when we want to merge multiple specs into the base one? Based on your comment, I was thinking about moving the base spec to a flag and leaving the other as args. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either same as you have here, first is base or --base --external... or something like that and why flags tend to be friendlier

Copy link
Collaborator

@gssbzn gssbzn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@andreaangiolillo andreaangiolillo merged commit e1e42ca into main Mar 7, 2024
@andreaangiolillo andreaangiolillo deleted the CLOUDP-225849_1 branch March 7, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants