-
Notifications
You must be signed in to change notification settings - Fork 2
Diff sidebar #607
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
Open
oscarlund121
wants to merge
35
commits into
develop
Choose a base branch
from
openapi-diff
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Diff sidebar #607
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
b93d543
Created functionality for sidebar (diffbar) - Using the logic of the …
oscarlund121 53358e7
CoPilot review updates
oscarlund121 dfc5c95
Import update:
oscarlund121 59b3a3d
diffwidth marked as unused
oscarlund121 bf99297
Various improvements to the diff view
ulrikandersen 4f7bdab
Merge branch 'develop' into openapi-diff
ulrikandersen d89b9e1
Fixes build errors
ulrikandersen 994c9a7
Fixes
ulrikandersen 53a978d
Install oasdiff in Docker
ulrikandersen 7a925a3
Add instructuons for oasdiff
ulrikandersen 1d6494e
Ensure diff sidebar is closed by default
ulrikandersen e3f37ea
Fetch PRs for all repos in one query
ulrikandersen 35da9c6
Disable diff button if diff cannot be determined
ulrikandersen 134687d
Tooltip text was inverted
ulrikandersen dee68f8
Initial plan
Copilot a0096bb
Add URL validation for GitHub domains in OasDiffCalculator
Copilot 93dba46
Use IGitHubClient interface instead of concrete class
Copilot ebc4979
Merge pull request #620 from shapehq/copilot/sub-pr-607
ulrikandersen a0de56f
Update src/features/sidebar/data/useDiff.ts
ulrikandersen af121ce
Initial plan
Copilot 2724866
Use change.id as React key instead of array index
Copilot ec558d3
Update pull request query to only fetch OPEN states
ulrikandersen 0f09ea9
Remove unnecessary React imports from multiple components
ulrikandersen edfb8e6
Remove semicolons
ulrikandersen 9bb6004
Fix issue in SpacedList
ulrikandersen 87f82f3
Remove unused border
ulrikandersen 0f6711a
Fix linting error
ulrikandersen 084883c
Refactor GitHubRepositoryDataSource for improved readability and cons…
ulrikandersen 8c68abe
Refactor ClientSplitView for consistency and readability
ulrikandersen 0ad48be
Refactor SecondarySplitHeader for improved readability and consistency
ulrikandersen a76b31c
Resolve merge conflicts with openapi-diff base branch
Copilot a2e5999
Merge branch 'openapi-diff' into copilot/sub-pr-607
Copilot 850bd84
Merge pull request #622 from shapehq/copilot/sub-pr-607
ulrikandersen 3cb312d
feat: add PR comparison context and new file detection to OpenAPI dif…
ulrikandersen 21dea16
chore: fix linting errors - remove unused variables and escape apostr…
ulrikandersen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { NextRequest, NextResponse } from "next/server" | ||
| import { session, userGitHubClient } from "@/composition" | ||
| import { makeUnauthenticatedAPIErrorResponse } from "@/common" | ||
| import { execSync } from "child_process" | ||
|
|
||
| interface GetDiffParams { | ||
| owner: string | ||
| repository: string | ||
| path: [string] | ||
| } | ||
|
|
||
| export async function GET(req: NextRequest, { params }: { params: Promise<GetDiffParams> }) { | ||
| const isAuthenticated = await session.getIsAuthenticated() | ||
| if (!isAuthenticated) { | ||
| return makeUnauthenticatedAPIErrorResponse() | ||
| } | ||
|
|
||
| const { path: paramsPath, owner, repository } = await params | ||
| const path = paramsPath.join("/") | ||
|
|
||
| const fromRef = req.nextUrl.searchParams.get("from") | ||
| const toRef = req.nextUrl.searchParams.get("to") | ||
|
|
||
| if (!fromRef || !toRef) { | ||
| return NextResponse.json({ error: "Missing from/to parameters" }, { status: 400 }) | ||
| } | ||
|
|
||
| const fullRepositoryName = repository + "-openapi" | ||
|
|
||
| const spec1 = await userGitHubClient.getRepositoryContent({ | ||
| repositoryOwner: owner, | ||
| repositoryName: fullRepositoryName, | ||
| path: path, | ||
| ref: fromRef | ||
| }) | ||
|
|
||
| const spec2 = await userGitHubClient.getRepositoryContent({ | ||
| repositoryOwner: owner, | ||
| repositoryName: fullRepositoryName, | ||
| path: path, | ||
| ref: toRef | ||
| }) | ||
|
|
||
| const result = execSync(`oasdiff changelog --format json "${spec1.downloadURL}" "${spec2.downloadURL}"`, { encoding: 'utf8' }) | ||
|
|
||
| console.log(result) | ||
|
|
||
oscarlund121 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| const diffData = JSON.parse(result) | ||
|
|
||
| return NextResponse.json({ | ||
| from: fromRef, | ||
| to: toRef, | ||
| changes: diffData | ||
| }) | ||
| } | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.