Giter Club home page Giter Club logo

Comments (9)

Blacklands avatar Blacklands commented on May 19, 2024 1

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.

RomanHotsiy avatar RomanHotsiy commented on May 19, 2024 1

It will land in the upcoming release

from redocly-cli.

RomanHotsiy avatar RomanHotsiy commented on May 19, 2024 1

@Blacklands just fyi: landed in 1.0.0-beta.4

from redocly-cli.

adamaltman avatar adamaltman commented on May 19, 2024

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.

RomanHotsiy avatar RomanHotsiy commented on May 19, 2024

@Blacklands could you verify this is still an issue with the beta?

from redocly-cli.

Blacklands avatar Blacklands commented on May 19, 2024

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.

adamaltman avatar adamaltman commented on May 19, 2024

@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.

adamaltman avatar adamaltman commented on May 19, 2024

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.

RomanHotsiy avatar RomanHotsiy commented on May 19, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.