-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: openapi request import #5586
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
pooja-bruno
wants to merge
13
commits into
usebruno:main
Choose a base branch
from
pooja-bruno:fix/open-api-request-import
base: main
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.
+241
−63
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3a88842
fix: openapi request import
pooja-bruno 160eaa3
rm: file
pooja-bruno 393a5e2
improve: regex
pooja-bruno 9ccfe01
improvements
pooja-bruno 4247dab
rm: number from openapi import test
pooja-bruno 1968a25
improve: collection item verification
pooja-bruno bb56d99
improvements
pooja-bruno 39d8cbf
fix
pooja-bruno a6d06ea
improvements
pooja-bruno 1700f0d
fix
pooja-bruno 610158f
fix
pooja-bruno 2b7bf8d
fix
pooja-bruno 3e2b96d
fix
pooja-bruno 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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
54 changes: 54 additions & 0 deletions
54
tests/import/openapi/duplicate-operation-names-fix.spec.ts
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,54 @@ | ||
import { test, expect } from '../../../playwright'; | ||
import * as path from 'path'; | ||
|
||
test.describe('OpenAPI Duplicate Names Handling', () => { | ||
test('should handle duplicate operation names', async ({ newPage: page, createTmpDir }) => { | ||
const openApiFile = path.resolve(__dirname, 'fixtures', 'openapi-duplicate-operation-name.yaml'); | ||
|
||
// start the import process | ||
await page.getByRole('button', { name: 'Import Collection' }).click(); | ||
|
||
// wait for the import collection modal to appear | ||
const importModal = page.locator('[data-testid="import-collection-modal"]'); | ||
await importModal.waitFor({ state: 'visible' }); | ||
|
||
// upload the OpenAPI file with duplicate operation names | ||
await page.setInputFiles('input[type="file"]', openApiFile); | ||
|
||
// wait for the file processing to complete | ||
await page.locator('#import-collection-loader').waitFor({ state: 'hidden' }); | ||
|
||
// verify that the collection location modal appears (OpenAPI files go directly to location modal) | ||
const locationModal = page.locator('[data-testid="import-collection-location-modal"]'); | ||
// verify the collection name is correctly parsed despite duplicate operation names | ||
await expect(locationModal.getByText('Duplicate Test Collection')).toBeVisible(); | ||
|
||
// select a location | ||
await page.locator('#collection-location').fill(await createTmpDir('duplicate-test')); | ||
await page.getByRole('button', { name: 'Import', exact: true }).click(); | ||
|
||
// verify the collection was imported successfully | ||
await expect(page.locator('#sidebar-collection-name').getByText('Duplicate Test Collection')).toBeVisible(); | ||
|
||
// configure the collection settings | ||
await page.locator('#sidebar-collection-name').getByText('Duplicate Test Collection').click(); | ||
await page.getByLabel('Safe Mode').check(); | ||
await page.getByRole('button', { name: 'Save' }).click(); | ||
|
||
// verify that all requests were imported correctly despite duplicate operation names | ||
const requestCount = await page.locator('#collection-duplicate-test-collection .collection-item-name').count(); | ||
expect(requestCount).toBe(3); | ||
|
||
// cleanup: close the collection | ||
await page | ||
.locator('.collection-name') | ||
.filter({ has: page.locator('#sidebar-collection-name:has-text("Duplicate Test Collection")') }) | ||
.locator('.collection-actions') | ||
.click(); | ||
await page.locator('.dropdown-item').getByText('Close').click(); | ||
await page.getByRole('button', { name: 'Close' }).click(); | ||
|
||
// return to home page | ||
await page.locator('.bruno-logo').click(); | ||
}); | ||
}); |
File renamed without changes.
44 changes: 44 additions & 0 deletions
44
tests/import/openapi/fixtures/openapi-duplicate-operation-name.yaml
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,44 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Duplicate Test Collection | ||
version: 1.0.0 | ||
description: Test collection for handling duplicate operation names | ||
servers: | ||
- url: https://api.example.com | ||
description: Example server | ||
paths: | ||
/users: | ||
get: | ||
summary: 'Get Users' | ||
description: 'Get all users' | ||
operationId: getUsers | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
post: | ||
summary: 'Get Users' | ||
description: 'Create a new user (same summary as GET)' | ||
operationId: createUser | ||
responses: | ||
'201': | ||
description: Created | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
/products: | ||
get: | ||
summary: 'Get Users' | ||
description: 'Get all products (same summary as users GET)' | ||
operationId: getProducts | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
type: object |
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
tests/import/openapi/fixtures/openapi-newline-in-operation-name.yaml
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,32 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Newline Test Collection | ||
version: 1.0.0 | ||
description: Test collection for operation names with newlines | ||
servers: | ||
- url: https://api.example.com | ||
description: Example server | ||
paths: | ||
/users: | ||
get: | ||
summary: "Get users\nwith newline" | ||
description: 'This operation has newlines in the summary' | ||
operationId: getUsersWithNewline | ||
responses: | ||
'200': | ||
description: Success | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
post: | ||
summary: "Create user\n\nwith multiple\n\nnewlines" | ||
description: 'This operation has multiple consecutive newlines' | ||
operationId: createUserWithNewlines | ||
responses: | ||
'201': | ||
description: Created | ||
content: | ||
application/json: | ||
schema: | ||
type: object |
File renamed without changes.
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
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.