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

feat: extend split and join commands to produce JSON output #1305

Merged
merged 9 commits into from
Oct 26, 2023

Conversation

IgorKarpiuk
Copy link
Contributor

@IgorKarpiuk IgorKarpiuk commented Oct 19, 2023

What/Why/How?

Extend split and join commands to optionally produce JSON output.

Split

Determine the output format by the extension of the input file, if the extension is not supported use yaml
Supported file extensions: json, yaml, yml

Join

Determine the output format by the extension of the file from output option, if output option is not provided use extension of first entry point, if extension not supported use yaml.

Supported file extensions: json, yaml, yml

Reference

Related: #1205

Testing

Screenshots (optional)

Check yourself

  • Code is linted
  • Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

@IgorKarpiuk IgorKarpiuk self-assigned this Oct 19, 2023
@changeset-bot
Copy link

changeset-bot bot commented Oct 19, 2023

🦋 Changeset detected

Latest commit: 39a5c8a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@redocly/cli Minor
@redocly/openapi-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 19, 2023

Command Mean [s] Min [s] Max [s] Relative
redocly lint packages/core/src/benchmark/benches/rebilly.yaml 1.503 ± 0.028 1.458 1.543 1.02 ± 0.04
redocly-next lint packages/core/src/benchmark/benches/rebilly.yaml 1.467 ± 0.051 1.384 1.538 1.00

@github-actions
Copy link
Contributor

github-actions bot commented Oct 19, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 76.08% 4045/5317
🟡 Branches 65.9% 2145/3255
🟡 Functions 68.26% 656/961
🟡 Lines 76.27% 3793/4973

Test suite run success

645 tests passing in 93 suites.

Report generated by 🧪jest coverage report action from 39a5c8a

packages/cli/src/utils.ts Outdated Show resolved Hide resolved
@IgorKarpiuk IgorKarpiuk force-pushed the feat/split-and-join-output branch from 8e4da06 to 83d854b Compare October 23, 2023 08:14
@IgorKarpiuk IgorKarpiuk marked this pull request as ready for review October 23, 2023 08:53
@IgorKarpiuk IgorKarpiuk requested a review from a team as a code owner October 23, 2023 08:53
@IgorKarpiuk IgorKarpiuk requested a review from lornajane October 23, 2023 08:53
Copy link
Contributor

Choose a reason for hiding this comment

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

Dont we need to update docs for split command as well ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to update the docs. This feature was originally reported as a bug, the split command doesn't mention what it can output (but it only supported YAML until now) and a user expected it to work with JSON too.

Copy link
Contributor

@lornajane lornajane left a comment

Choose a reason for hiding this comment

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

Tweak for the changelog language, but otherwise this looks good to me, I can't see where we would update the split command docs, the feature works as I expected it to, and I'm excited to be able to share this with the customer when we merge and release :)

.changeset/plenty-mugs-suffer.md Outdated Show resolved Hide resolved
@IgorKarpiuk IgorKarpiuk force-pushed the feat/split-and-join-output branch from 2c64201 to 39a5c8a Compare October 25, 2023 07:44
@IgorKarpiuk IgorKarpiuk merged commit 1510e47 into main Oct 26, 2023
26 checks passed
@IgorKarpiuk IgorKarpiuk deleted the feat/split-and-join-output branch October 26, 2023 11:42
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.

4 participants