Comments (9)
Yes, that's what I meant when I said that I didn't express it very well (again, sorry). It does use the config file, it just doesn't allow you to leave out the entrypoint
parameter and have it use the spec that's linked in the apiDefinitions
section automatically.
Like @RomanHotsiy said, it used to do that (picking the first definition from that section) in the old version. I was using that, and was surprised when it suddenly didn't work anymore in the beta.
It's not a huge issue, but it makes things more convenient (if you only have one spec at a time, like I have).
Thanks for considering to add it back in!
from redocly-cli.
It will land in the upcoming release
from redocly-cli.
@Blacklands just fyi: landed in 1.0.0-beta.4
from redocly-cli.
FYI: preview-docs
was semi-broken before 1.0.0-beta3
.
Can you provide how to reproduce the issue? Can you share a snippet of your .redocly.yaml
file so we can see the apiDefinitions
section?
from redocly-cli.
@Blacklands could you verify this is still an issue with the beta?
from redocly-cli.
I should have clarified which version I am using exactly, sorry. I was already using the latest beta (1.0.0-beta.3
) at this point. I started with 1.0.0-beta.1
, but then realized that preview-docs
was fairly broken, yes. I just wanted to point out that this problem has existed since the first beta version, but it's still there now.
I think I also did a bad job explaining the problem: It's not that the command somehow can't read from the config file at all, it's that you can't leave out the entrypoint
parameter when you use the command.
From how it looks like, the entrypoint
parameter has been marked as "required" in the code. If you try to leave it out and just call openapi preview-docs
, you get
Not enough non-option arguments: got 0, need at least 1
If you call openapi preview-docs help
, it also says
cli.js preview-docs <entrypoint>
Preview API reference docs for the specified definition.
Positionals:
entrypoint [string] [required]
Options:
[...]
The other two commands (bundle
and lint
) say this instead:
cli.js bundle [entrypoints...]
Bundle definition.
Positionals:
entrypoints [array] [default: []]
So all that might be missing here is making the entrypoint
parameter for preview-docs
optional/adding a default value, so that the parameter can be left out.
This is what I would be expecting at least (that's why I opened the issue), since the other commands also work that way and read entrypoint
from the apiDefinitions
section in the config file if you don't supply the parameter explicitly.
from redocly-cli.
@Blacklands preview-docs is quite different from lint or bundle. Lint or bundle can operation on entrypoints (plural). Preview-docs can only operate on one and only one entrypoint at a time. Which entrypoint from apiDefinitions
would you expect it to use (assuming you have more than one in apiDefinitions
?
from redocly-cli.
Also, it does check the config file, so you can do this (where aliasFromApiDefinitions
is set in the apiDefinitions
section:
openapi preview-docs aliasFromApiDefinitions
Also, the referenceDocs
section is utilized too.
from redocly-cli.
@adamaltman I believe the old openapi-cli used the first definition from .redocly.yaml if none was supplied via CLI args. I think we can fix that.
from redocly-cli.
Related Issues (20)
- Join does not add component prefix to discriminator mapping if the name of the schema coincidentally contains the prefix. HOT 2
- `split` command option/config for custom subdirectories of schemas HOT 3
- join --prefix-components-with-info-prop doesn't correctly handle spaces in info property HOT 1
- "lint" command incorrectly flags "examples:" with an error when structured as an object HOT 4
- [Question] Configurable rule to check any schemas within responses HOT 2
- Allow to have a more strict validation about officially registered format HOT 2
- Redocly Rules with Ruleset ID does not match the URL HOT 1
- Validation error: type required when nullable is true HOT 2
- $.components.schemas.*.example are not validated when no path reference them. HOT 2
- illogical oneOf detection missing HOT 7
- `@redocly/config` is missing a license HOT 1
- join should allow longer lines and retain original quotes HOT 4
- enhance no-http-verbs-in-paths with excludedPaths option HOT 4
- Split only the schemas HOT 3
- example is not bundled HOT 1
- Allow split command to group by naming convention then write each group to their own file. HOT 1
- Review and update the quickstart guide HOT 1
- Improve server replace guide HOT 1
- Update the CLI Guides landing page HOT 4
- Unexpected error when specifying a wildcarded path for linting on Windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redocly-cli.