Skip to content

Conversation

joakimnordling
Copy link
Contributor

FastAPI has for the past 4 years been using the the next version of ReDoc (development version of 2.0.0). The official 2.0.0 version was however released around 9 months ago and the next tag still points to 2.0.0-rc.75. I thought it would be a good idea to update to the final version now rather than the old release candidate.

I also noticed that the examples in the documentation shows what the file used to look like, but the license information has been moved to a separate file and there's just a pointer to that nowadays. I updated the example with what users can today expect to find there now.

It's of course a bit of a question if the version should be locked to 2.0.0 or if the latest tag should instead be used. Please let me know if you'd rather have me switch to that tag.

FastAPI has for the past 4 years been using the the `next` version of ReDoc (development version of 2.0.0). The official 2.0.0 version was however released around 9 months ago and the `next` tag still points to `2.0.0-rc.75`. I thought it would be a good idea to update to the final version now rather than the old release candidate.

I also noticed that the examples in the documentation shows what the file used to look like, but the license information has been moved to a separate file and there's just a pointer to that nowadays. I updated the example with what users can today expect to find there now.

It's of course a bit of a question if the version should be locked to 2.0.0 or if the `latest` tag should instead be used. Please let me know if you'd rather have me switch to that tag.
@tiangolo

This comment was marked as outdated.

@tiangolo tiangolo added the docs Documentation about how to use FastAPI label Oct 2, 2023
@alejsdev alejsdev added the p4 label Jan 16, 2024
eltoder added a commit to eltoder/openapipages that referenced this pull request Jun 13, 2024
Currently passing redoc UI parameters has the following issues:
* It puts json-ed values of parameters in single quotes, which will
  break if the value itself contains single quotes.
* If the value is falsy, only the name of the parameter is used. This
  syntax is *not* treated as falsy by redoc.

The latter cases the download button to be always hidden, because the
default parameters have "hide-download-button": False. There is no way
to un-hide it with the current code.

Change this to use the javascript API to pass parameters[1], which is
much simpler and more robust.

Also, stop using the "next" version of redoc, as suggested here[2]. This
was an old release candidate for version 2. Use the officially released
version 2.

[1] https://redocly.com/docs/redoc/deployment/html/#the-redoc-object
[2] fastapi/fastapi#9700
eltoder added a commit to eltoder/openapipages that referenced this pull request Jun 13, 2024
Currently passing redoc UI parameters has the following issues:
* It puts json-ed values of parameters in single quotes, which breaks if
  the value itself contains single quotes.
* If the value is falsy, only the name of the parameter is used. This
  syntax is *not* treated as falsy by redoc.

The latter causes the download button to be always hidden, because the
default parameters have "hide-download-button": False. There is no way
to un-hide it with the current code.

Change this to use the javascript API to pass UI parameters[1], which is
much simpler and more robust.

Also, stop using the "next" version of redoc, as suggested here[2]. This
was an old release candidate for version 2. Use the officially released
version 2.

[1] https://redocly.com/docs/redoc/deployment/html/#the-redoc-object
[2] fastapi/fastapi#9700
eltoder added a commit to eltoder/openapipages that referenced this pull request Jul 1, 2024
Currently passing redoc UI parameters has the following issues:
* It puts json-ed values of parameters in single quotes, which breaks if
  the value itself contains single quotes.
* If the value is falsy, only the name of the parameter is used. This
  syntax is *not* treated as falsy by redoc.

The latter causes the download button to be always hidden, because the
default parameters have "hide-download-button": False. There is no way
to un-hide it with the current code.

Change this to use the javascript API to pass UI parameters[1], which is
much simpler and more robust.

Also, stop using the "next" version of redoc, as suggested here[2]. This
was an old release candidate for version 2. Use the officially released
version 2.

[1] https://redocly.com/docs/redoc/deployment/html/#the-redoc-object
[2] fastapi/fastapi#9700
@svlandeg svlandeg self-assigned this Aug 28, 2024
@svlandeg svlandeg changed the title Update ReDoc to version 2.0.0 ⬆️ Update ReDoc to version 2.0.0 Sep 10, 2024
@svlandeg svlandeg added the dependencies Pull requests that update a dependency file label Sep 10, 2024

This comment was marked as outdated.

Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

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

Hi @joakimnordling, thanks for the PR and apologies for the delay in reviewing!

I agree with you that we should update the next tag, at least to 2.0.0 (which is out since September 2022). We could also consider pointing it to a more current version like 2.1.0 or 2.1.5. I'm not sure about latest as that would automatically pull in any new version without any control on our end.

I'm going to ask Tiangolo to chime in on the issue and leave the final decision up to him 🙏

@svlandeg svlandeg removed the p4 label Sep 10, 2024
@svlandeg svlandeg removed their assignment Sep 10, 2024
@joakimnordling
Copy link
Contributor Author

Hi @joakimnordling, thanks for the PR and apologies for the delay in reviewing!

I agree with you that we should update the next tag, at least to 2.0.0 (which is out since September 2022). We could also consider pointing it to a more current version like 2.1.0 or 2.1.5. I'm not sure about latest as that would automatically pull in any new version without any control on our end.

I'm going to ask Tiangolo to chime in on the issue and leave the final decision up to him 🙏

My own suggestion would be to update it to 2.1.5 (assuming there's no issues found with it, which I doubt) and lock it to that version so you have control of when it gets updated. But let's wait for Tiangolo's decision.

This comment was marked as outdated.

This comment was marked as outdated.

@ziglef
Copy link

ziglef commented Feb 5, 2025

Any updates on this?

At this point the version that FastAPI points to is already 2.5 years old and still an rc.
ReDoc has since released 2.1.x, 2.2, 2.3, all stable versions that we could use as a default. This creates some issues with a couple of missing features and a bunch of missing bug fixes that have since been added to ReDoc.

I decided to update the PR to use the latest released 2.4.0 version of ReDoc since we've not heard anything back yet. I also noticed there were some new translations added, so updated the texts in them as well (fortunately only code stuff was needed, as I don't know all those languages).

A bit of a question of course if we should use `redoc@2.4.0` or just `redoc@2`. If you feel like using the `@2` instead, feel free to update or request me to update.
@joakimnordling
Copy link
Contributor Author

I decided to update the PR to use the latest released 2.4.0 version of ReDoc since we've not heard anything back yet. I also noticed there were some new translations added, so updated the texts in them as well (fortunately only code stuff was needed, as I don't know all those languages).

A bit of a question of course if we should use redoc@2.4.0 or just redoc@2. If you feel like using the @2 instead, feel free to update or request me to update.

@joakimnordling joakimnordling changed the title ⬆️ Update ReDoc to version 2.0.0 ⬆️ Update ReDoc to version 2.4.0 Feb 24, 2025
@joakimnordling
Copy link
Contributor Author

@ziglef if you want a quick workaround to get the latest ReDoc 2.4.0 and SwaggerUI 5.19.0 and are fine with them being loaded from your servers instead of a CDN, I could mention that I just published version 0.2.0 of fastapi-standalone-docs. And sorry for marketing this in this thread.

@svlandeg svlandeg removed their request for review February 25, 2025 09:30
@svlandeg svlandeg self-assigned this Feb 25, 2025
@ziglef
Copy link

ziglef commented Mar 5, 2025

Hey @joakimnordling thanks for the ping, we have internally been using the custom version for docs as explained in FastAPI Docs - Custom Docs UI and that has worked for us for now.

I do appreciate your efforts into keeping this issue alive for consideration. I personally believe that keeping just the major versions redoc 2 and swagger-ui 5 should be perfectly fine for most people, but I understand some might prefer the extra consistency of fixing a minor version instead.
The downsides of keeping a minor version is that if we wanted to keep this updated it would require more maintenance effort but on the other hand it could potentially mean less regressions/breaks on new updates.

@3ddi
Copy link

3ddi commented Mar 13, 2025

Hey, any plans on pushing this soon? Are there any blockers?

Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

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

Thanks for updating to 2.4.0 @joakimnordling! This looks good to me.

@svlandeg svlandeg removed their assignment Mar 28, 2025
@tiangolo
Copy link
Member

Thank you @joakimnordling!

I would go with redoc@2 so we get future updates for that major version.

After that, the only missing step is for one of the team members (e.g. @svlandeg, me) to try this branch locally and ensure nothing obvious is breaking, and then I'll merge it. 🤓

@joakimnordling joakimnordling changed the title ⬆️ Update ReDoc to version 2.4.0 ⬆️ Update ReDoc to version 2.x Mar 31, 2025
@joakimnordling
Copy link
Contributor Author

Thank you @joakimnordling!

I would go with redoc@2 so we get future updates for that major version.

After that, the only missing step is for one of the team members (e.g. @svlandeg, me) to try this branch locally and ensure nothing obvious is breaking, and then I'll merge it. 🤓

Thanks @tiangolo ! I've now updated to @2 instead of @2.4.0 in all places. Also merged in latest master to ensure there's no new translations added that would have referenced the old URLs.

Minor note that I could not verify the URL on UNPKG (https://unpkg.com/redoc@2/bundles/redoc.standalone.js, used in the tutorial for using an alternative CDN) actually works because that CDN seems to be down at least for me and based on some comments online it seems to have had some issues for some time now. I don't think it should matter for the concepts shown in the guides, but still preferred to mention this.

@svlandeg
Copy link
Member

After that, the only missing step is for one of the team members (e.g. @svlandeg, me) to try this branch locally and ensure nothing obvious is breaking, and then I'll merge it. 🤓

I'll try and do that this week!

@svlandeg svlandeg self-assigned this Mar 31, 2025
@joakimnordling
Copy link
Contributor Author

Minor note that I could not verify the URL on UNPKG (https://unpkg.com/redoc@2/bundles/redoc.standalone.js, used in the tutorial for using an alternative CDN) actually works because that CDN seems to be down at least for me and based on some comments online it seems to have had some issues for some time now. I don't think it should matter for the concepts shown in the guides, but still preferred to mention this.

Seems like the UNPKG CDN now works and https://unpkg.com/redoc@2/bundles/redoc.standalone.js does a nice 302 redirect to https://unpkg.com/redoc@2.4.0/bundles/redoc.standalone.js and serves the content.

Copy link
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

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

the only missing step is for one of the team members (e.g. @svlandeg, me) to try this branch locally and ensure nothing obvious is breaking, and then I'll merge it. 🤓

All looks good to me!

@svlandeg svlandeg removed their assignment Apr 4, 2025
Copy link
Member

@tiangolo tiangolo left a comment

Choose a reason for hiding this comment

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

Let's get this in, thank you everyone! 🚀

And thanks @svlandeg for checking and confirming. 🙌

@tiangolo tiangolo added upgrade and removed docs Documentation about how to use FastAPI labels Apr 28, 2025
@tiangolo tiangolo merged commit 8fa56b4 into fastapi:master Apr 28, 2025
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants