Skip to content

fix: Support slash-based branch names and add test coverage (#1940)#2131

Closed
BossChaos wants to merge 2 commits intoasyncapi:masterfrom
BossChaos:fix/github-url-and-extension-validation-1940
Closed

fix: Support slash-based branch names and add test coverage (#1940)#2131
BossChaos wants to merge 2 commits intoasyncapi:masterfrom
BossChaos:fix/github-url-and-extension-validation-1940

Conversation

@BossChaos
Copy link
Copy Markdown

Description

This PR fixes issue #1940 by improving GitHub URL parsing to support slash-based branch names (e.g., feature/new-validation).

Changes

Bug Fix (commit 881ecda)

  • validation.service.ts: Changed regex pattern from ([^/]+) to (.+?) for branch name extraction
  • SpecificationFile.ts: Use path.extname() instead of split('.') for multi-dot filenames

Test Coverage (commit e68e935)

  • Added test case for slash-based branch names in validation.service.test.ts
  • Test validates that URLs like https://github.com/owner/repo/blob/feature/new-validation/file.yaml are correctly parsed

Testing

  • ✅ Existing tests pass
  • ✅ New test case added for slash-based branch names
  • ✅ Manual testing with various branch name formats

Related Issue

Fixes #1940

…1940)

Bug fixes:
1. GitHub URL parsing: Changed regex from ([^/]+) to (.+?) for branch names
   - Now supports slash-based branches like 'feature/new-validation'
   - File: src/domains/services/validation.service.ts

2. File extension detection: Use path.extname() instead of split('.')
   - Correctly handles multi-dot filenames like 'my.asyncapi.yaml'
   - File: src/domains/models/SpecificationFile.ts

Fixes asyncapi#1940
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

⚠️ No Changeset found

Latest commit: e68e935

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@asyncapi-bot
Copy link
Copy Markdown
Contributor

We require all PRs to follow Conventional Commits specification.
More details 👇🏼

 The subject "Support slash-based branch names and add test coverage (#1940)" found in the pull request title "fix: Support slash-based branch names and add test coverage (#1940)" should start with a lowercase character.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@BossChaos
Copy link
Copy Markdown
Author

Closing as Duplicate

Hi @asyncapi/cli team,

I just discovered that PR #2128 by @l8888888 already addresses this issue with a more complete fix (including the required changeset file).

Closing this PR as duplicate to avoid redundant work. Thanks!

@BossChaos BossChaos closed this Apr 22, 2026
@github-project-automation github-project-automation Bot moved this from To Triage to Done in CLI - Kanban Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] CLI fails for GitHub URLs with slash-based branches and multi-dot spec files

2 participants