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: adds useSchemaTitleAsRef in the bundler #1490
feat: adds useSchemaTitleAsRef in the bundler #1490
Conversation
🦋 Changeset detectedLatest commit: d00d6c9 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 |
Thanks @kennethaasan! I think we need to consider if title makes the most sense in the widest number of situations. I am concerned about two things:
|
Hey @lornajane, thanks for taking a look. I saw #1496, but for us title makes more sense than the path. What if we combine the two and use title if it exists, and path as a fallback? Regarding configuration options, I think we can make this (1. title, 2. path) the default behavior. Based on what I see in #1496, the current approach with file name is the least best option. What do you think? The only alternative we have is to make our own bundler which I would like to avoid. |
@kennethaasan you are proposing a breaking change. @lornajane's PR is also a breaking change (albeit less of one). |
Yes, but it doesn't have to be. Initially, I proposed adding it as a configuration option. I can imagine having it as a configuration option makes sense because different users might want different names. |
How about adding an extension field to indicate to (let's not finalise that naming without discussion and checking if there's anything already in use that does the same thing) We can also consider improving the name-guessing and reduce the warnings as separate ideas. |
Do you mean you must set that extension field in each schema then? We already have quite a big code base with JSON schemas used for AsyncAPI where we bundle with the title, and we want to re-use those schemas when bundling OpenAPI specs and use the title there as well. Setting an extension in each schema will not work for us because it's too much boilerplate and duplicated work. I'm happy to create our own bundler, but I was hoping to use this one :/ |
@adamaltman I don't think it's a breaking change. @kennethaasan please correct me if I'm wrong, but you've merely added the Another question, what behaviour you would expect if the options are set to true but there's no |
@tatomyr why wouldn't it be a breaking change? (I'm talking about changing the default behavior, not a configuration option. We have clients that rely on the A configuration option though is also a cognitive load change. That's why it warrants time and discussion. Is this the configuration option that is going to drive more usage and adoption? I think it may help @kennethaasan but I don't think this is going to be widely used. Configuration options like those cause decay in the applications usability to new users -- and therefore, could actually hinder more usage and adoption. Sorry Kenneth, I don't mean anything negative by this, but imagine we should provide people with a list with 100 configuration options for the I'm for new options -- but I'd like to see them being used by at least 2-5% of the user base. |
I mean that the default bundler behaviour is not changing as far as I can judge based on the code changes. |
@kennethaasan (going back a few steps in the discussion, hopefully this isn't too disjointed). If we added a specific extension field and used that for the name if it's present, that's not a breaking change. If you already have the information in place in Let me know if an example would be useful. |
Sorry for the late response (I've been on holiday). If you think almost no one needs this, I agree with @adamaltman that this should perhaps not be added here. We will instead create and maintain our own bundler. |
Closing because we made our own bundler that re-uses lots of your bundler. |
What/Why/How?
First of all, thank you for creating redoc/redocly. We already have quite a big codebase with schemas used in AsyncAPI specs, and now we want to use the redoc documentation and redocly bundler for some of our OpenAPI specs. This seems to be the only blocker for us.
Reference
Please see #661. We're not able to use the bundler because it uses the file names instead of the schema titles as references.
Testing
Added a test in
packages/core/src/__tests__/bundle.test.ts
Screenshots (optional)
Check yourself
Security