Skip to content
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

fix!: traits, id and reply problems for v3 #910

Merged

Conversation

jonaslagoni
Copy link
Member

@jonaslagoni jonaslagoni commented Nov 24, 2023

Description
This PR fixes a bunch of different edge cases with traits and ID's not being correctly created. Ontop of this, reply.messages had incorrect type as it's an array of messages NOT record, this is a breaking change.

Related issue(s)
Fixes #873
Fixes #856
Only one approach is needed, this PR or #895 for solving #873

@jonaslagoni jonaslagoni changed the title fix: add test fix: traits and id problems for v3 Nov 27, 2023
Comment on lines +47 to +59
// Normalize input to always be JSON
let loadedObj;
if (typeof asyncapi === 'string') {
try {
loadedObj = yaml.load(asyncapi);
} catch (e) {
loadedObj = JSON.parse(asyncapi);
}
} else {
loadedObj = asyncapi;
}
// Apply unique ids before resolving references
applyUniqueIds(loadedObj);
Copy link
Member Author

Choose a reason for hiding this comment

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

In order to apply unique IDs I had to control the input and force any input (string/yaml/json, and pure objects) to adapt them.

@jonaslagoni jonaslagoni marked this pull request as ready for review November 28, 2023 07:40
@jonaslagoni jonaslagoni changed the title fix: traits and id problems for v3 fix: traits, id and reply problems for v3 Nov 28, 2023
@jonaslagoni jonaslagoni changed the title fix: traits, id and reply problems for v3 fix!: traits, id and reply problems for v3 Nov 28, 2023
@jonaslagoni
Copy link
Member Author

/rtm

Copy link

sonarcloud bot commented Nov 29, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@asyncapi-bot asyncapi-bot merged commit 18ee6fe into asyncapi:next-major-spec Nov 29, 2023
11 checks passed
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 3.0.0-next-major-spec.15 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants