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

preview: first take to handle bump preview command 🎉 #8

Merged
merged 4 commits into from
Apr 28, 2021
Merged

preview: first take to handle bump preview command 🎉 #8

merged 4 commits into from
Apr 28, 2021

Conversation

paulRbr
Copy link
Member

@paulRbr paulRbr commented Apr 27, 2021

This is the implementation of the preview command with a lot of simplification from the original ruby CLI.

It removes:

  • the --specification flag because the server now knows how to guess from the given file
  • the --validation flag because the server will now only do the 'basic' validation (cf https://github.com/bump-sh/bump/issues/522)
  • the --no-external-refs flag because the new node CLI handles all external refs

The resulting command can be summarised by its help:

Create a documentation preview for the given file

USAGE
  $ bump preview FILE

ARGUMENTS
  FILE  Path or URL to your API documentation file. OpenAPI (2.0 to 3.0.2) and AsyncAPI (2.0)
        specifications are currently supported.

OPTIONS
  -h, --help  show CLI help

EXAMPLE
  $ bump preview FILE
  * Your preview is visible at: https://bump.sh/preview/45807371-9a32-48a7-b6e4-1cb7088b5b9b

🎉

Closes #1

Copy link
Member

@Polo2 Polo2 left a comment

Choose a reason for hiding this comment

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

I just left a small comment about OpenAPI version,
while I was reading this whole PR for my education.

README.md Outdated Show resolved Hide resolved
Copy link
Member

@scharrier scharrier left a comment

Choose a reason for hiding this comment

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

I did a second review, sorry for the ping/pong. I left some important (I think) comments. It's far easier to understand comparing to the first version.

I think that we still can enhance some stuff to make it even clearer.

Another small note: I think that we should try to do atomic PRs when we can. This means extracting any not directly related changes to other smaller PRs. Small/atomic PRs make reviewing a bit easier and merging faster. This is the first one so I totally get why it's a big one, but for the upcoming ones, I'm sure that we can do smaller ones.

Congrats on this huge work, I'm pretty sure that we'll be able to merge something tomorrow! 👏

.eslintrc Show resolved Hide resolved
src/api/models.ts Outdated Show resolved Hide resolved
src/api/models.ts Outdated Show resolved Hide resolved
src/commands/preview.ts Outdated Show resolved Hide resolved
src/commands/preview.ts Outdated Show resolved Hide resolved
src/commands/preview.ts Outdated Show resolved Hide resolved
src/commands/preview.ts Outdated Show resolved Hide resolved
Copy link
Member

@scharrier scharrier left a comment

Choose a reason for hiding this comment

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

I left some small comments and questions, but nothing that should block this PR (it's more for my personal knowledge and to be sure that it's not stuff you forgot).

You got the LGTM, let's merge this! 👏

src/api/index.ts Outdated Show resolved Hide resolved
src/api/index.ts Outdated Show resolved Hide resolved
src/api/index.ts Outdated Show resolved Hide resolved
src/args.ts Show resolved Hide resolved
src/commands/preview.ts Show resolved Hide resolved
This commit re-writes two things:
- the way we handle API errors and extracts the logic in the dedicated
  `APIError` class.
- Extract the references builder outside of the 'preview' command in a
  dedicated generic `Command#prepareDefinition` function.
@paulRbr
Copy link
Member Author

paulRbr commented Apr 28, 2021

You got the LGTM, let's merge this! clap

Thanks for the review (and the patience) 😃

@paulRbr paulRbr merged commit 30811e7 into bump-sh:main Apr 28, 2021
@paulRbr paulRbr deleted the preview-basic-command branch April 28, 2021 17:31
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.

Implement basic preview
3 participants