asyncapi / asyncapi/optimizer

[BUG] 2.17.0 & 3.1.1 asyncapi bundle & optimise breaks fifo channels

Open
#291 13 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
12
Forks
11
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug.

The AWS SNS topics and queues can be (first in first out) FIFO. To define such their name must end with .fifo (example `user-created.fifo`)

Content:

```yaml
# asyncapi.yaml
asyncapi: 2.0.0
info:
title: Service
version: 1.0.0

channels:
'{ENV}-user-created.fifo':
publish:
message:
$ref: '#/components/messages/UserCreated'

components:
messages:
UserCreated:
$ref: 'UserCreated.yaml'
```

```yaml
# UserCreated.yaml
payload:
type: object
properties:
eventName:
type: string
description: The name of the event.

```

Execute:

```
asyncapi bundle asyncapi.yaml -x -o output.yaml
```

Then Execute:

```
asyncapi optimize output.yaml --optimization=reuse-components -o=overwrite --no-tty
```

The result is invalid Async API document:
```yaml
asyncapi: 2.0.0
info:
title: Remittance
version: 1.0.0
channels:
'{ENV}-user-created.fifo':
publish:
message:
payload:
type: object
properties:
eventName:
type: string
description: The name of the event.
x-origin: UserCreated.yaml
'{ENV}-user-created':
fifo:
publish:
message:
$ref: '#/components/messages/UserCreated'
components:
messages:
UserCreated:
payload:
type: object
properties:
eventName:
type: string
description: The name of the event.
x-origin: UserCreated.yaml
```

### Expected behavior

-

### 👀 Have you checked for similar open issues?

- [x] I checked and didn't find similar issue

### 🏢 Have you read the Contributing Guidelines?

- [x] I have read the [Contributing Guidelines](https://github.com/asyncapi/.github/blob/master/CONTRIBUTING.md)

### Are you willing to work on this issue ?

None

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the asyncapi.yaml and UserCreated.yaml examples using bundle followed by optimize with reuse-components. Trace how the optimizer handles the bundled FIFO channel name, and consider the work done when the optimized document preserves the original channel and remains a valid AsyncAPI document.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.