event-catalog / event-catalog/generators
Apicurio: Using `groupId` when generating events
- Dominant language
- TypeScript
- Stars
- 15
- Forks
- 16
- Avg merge
- 25m
- Merged PRs (30d)
- 4
Description
### Use Case
Apicurio groups artifacts by their `groupId` - there can be multiple artifacts sharing name, each different and stored in different `group`.
Apicurio Generator generates all events as a flat structure, resulting in events being merged/overwriting each other, if their names collide.
Let's say Team A pushes all their events to apicurio under group "TeamA":
- account-register
- account-delete
- app-login
- 20 more of events
And teamB under group "TeamB":
- account-register
- customer-visit
- 50 more of events
When Event Catalog pulls all schemas, all events land in the root directory of events.
`account-register` name will collide and both schemas will land in the same `account-register` directory. If their versions will be equal, one will overwrite the other.
I just sent v1.0.0 and v2.0.0 from TeamA and v1.5.0 and v2.5.0 from TeamB - they ended up as 4 versions within "account-register" event, without distinction which one belongs to which group.
### Proposed Solution
For Apicurio generator, move events to their corresponding `group` directory.
ApicurioAPI.SearchArtifacts endpoint [link](https://www.apicur.io/registry/docs/apicurio-registry/3.0.x/assets-attachments/registry-rest-api.htm#tag/Search/operation/searchArtifacts) already returns `groupId` for each returned artifact.
Current implementation of generator already has this attribute available:
ArtifactSearchResults.Artifact.groupId [link](https://github.com/event-catalog/generators/blob/main/packages/generator-apicurio/src/types.ts#L29)
### Implementation Notes
_No response_
### Community Notes
* Please vote by adding a 👍 reaction to the issue to help us prioritize.
* If you are interested to work on this issue, please leave a comment.
* If this issue is labeled **needs-discussion**, it means the spec has not been finalized yet. Please reach out in the [EventCatalog Discord](https://discord.com/invite/3rjaZMmrAm).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.