Support rendering OpenAPI spec#36449
Merged
Merged
Conversation
Contributor
Author
c567c00 to
830af2f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the markup rendering system to use file name patterns instead of simple extensions, and adds support for rendering OpenAPI/Swagger specification files using swagger-ui.
Changes:
- Refactored renderer interface to use
FileNamePatterns()instead ofExtensions()for more flexible file matching (supports patterns like*.yamland exact names likeopenapi.yaml) - Added OpenAPI renderer that embeds swagger-ui to display OpenAPI/Swagger specs in YAML or JSON format
- Updated all renderer implementations and detection logic to use the new pattern-based approach
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| modules/markup/external/openapi.go | New OpenAPI renderer implementation with swagger-ui integration |
| modules/markup/renderer.go | Refactored renderer detection to support file name patterns |
| modules/markup/render.go | Updated render context detection methods |
| web_src/js/standalone/swagger.ts | Enhanced to support inline spec content and YAML parsing |
| web_src/css/standalone/swagger.css | Hides embedded spec content textarea |
| modules/setting/markup.go | Updated configuration to use file patterns instead of extensions |
| modules/markup/*/[renderers] | Updated all built-in renderers to use FileNamePatterns() |
| routers/web/repo/*.go | Updated file view routes to use new detection methods |
| package.json | Added js-yaml dependency for YAML parsing |
| tests/integration/markup_external_test.go | Updated tests for renamed functions |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a4eb3f0 to
ffb6b57
Compare
ffb6b57 to
d5f307a
Compare
lunny
reviewed
Jan 25, 2026
lunny
approved these changes
Jan 25, 2026
Member
|
I tried swapping the yaml module to https://github.com/eemeli/yaml, but it resulted in a 300kB larger bundle size, so |
e0dfb15 to
12a2258
Compare
zjjhot
added a commit
to zjjhot/gitea
that referenced
this pull request
Jan 26, 2026
* giteaofficial/main: Support rendering OpenAPI spec (go-gitea#36449)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fix #20852