-
Notifications
You must be signed in to change notification settings - Fork 154
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: add output as a per-API configuration option #1708
Conversation
🦋 Changeset detectedLatest commit: 3878eb6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
|
Coverage report
Show files with reduced coverage 🔻
Test suite run success793 tests passing in 118 suites. Report generated by 🧪jest coverage report action from 3878eb6 |
ebf4efd
to
6617f1a
Compare
ef129f3
to
bbde7e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature behaves differently depending if we're bundling one API or many, which I did not expect. I can tell from the documentation that this is an intentional exception - but I don't know why we did this. In every other context, the API is linted/bundled the same way whether it's done alone by alias, or others are done at the same time. With this configuration, the bundle command will apply per-api decorators, but not per-api output, which seems wrong.
The command line parameter should still take priority if it's supplied, but the configuration should apply if it exists, regardless of whether there are other APIs being bundled at the same time or not.
@lornajane do you mean that having this apis:
main@v1:
root: openapi.yaml
output: bunlded.yaml and running |
Yes, running |
@lornajane but how would you print it out to the stdout for the alias if needed? |
Oh, of course. You can't use the filename without silently picking up the alias :( I guess another alias, or a special value for |
@lornajane another alias means you have to maintain consistency between those two (and remember twice more names too). And a special output value could collide with a filename (users are quite creative when it comes to naming things!). |
I believe this option is mainly aimed for bundling and storing large amount of apis which is quite tedious to do via the command line. So that’s where the ‘output’ really comes in handy. If a user wants to bundle one alias, it’s not hard to specify the output destination as well. I hope that seeing the output, users will be able to figure out the behaviour. |
The current behaviour is unexpected - test it alone and you get one behaviour. Run it in a batch and it does something different. I'm not comfortable with us shipping it as it is. |
3e2eb24
to
e414930
Compare
@lornajane changed the behaviour. Now if you bundle an alias, it will take the output from the config if it exists. |
Everything here looks great to me, but I was surprised that I could bundle a file by name without it picking up the alias magically (since the file is mentioned in the config file). So I like everything here, but I wanted to mention it in case the change was not intentional. |
153de2a
to
479e1aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one comment, otherwise looks good.
Co-authored-by: Lorna Jane Mitchell <lorna.mitchell@redocly.com>
Co-authored-by: Lorna Jane Mitchell <lorna.mitchell@redocly.com>
Co-authored-by: Lorna Jane Mitchell <lorna.mitchell@redocly.com>
Co-authored-by: Lorna Jane Mitchell <lorna.mitchell@redocly.com>
88fd5ef
to
f949ef9
Compare
What/Why/How?
Added support for the
output
option in the per-API configuration. This adds the possibility to store bundled files for allapis
that have the option specified.For example, for the following
redocly.yaml
:Executing
redocly bundle
will store bundled files under thedist/
directory.Executing
redocly bundle openapi1.yaml
will result in printing only the openapi1 bundle to stdout.Reference
Resolves #1579
Testing
Screenshots (optional)
Check yourself
Security