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: special characters in enum values #497

Merged
merged 6 commits into from
Nov 3, 2021
Merged

fix: special characters in enum values #497

merged 6 commits into from
Nov 3, 2021

Conversation

panwauu
Copy link
Contributor

@panwauu panwauu commented Nov 2, 2021

Description
I added a Helper Function to resolve ascii characters that are not numbers or letters ([0-9a-zA-Z]) and translate them to english. - becomes minus, + becomes plus ...
The function also accepts characters to be ignored and a seperator string to seperate the translated characters from the rest.
Applied this function to the enum renderer to resolve the issue

Related issue(s)
Fixes #450

Tests
In #450 a blacklisted test is mentioned

@coveralls
Copy link

coveralls commented Nov 2, 2021

Pull Request Test Coverage Report for Build 1416361083

  • 10 of 10 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 93.203%

Totals Coverage Status
Change from base Build 1415713088: 0.06%
Covered Lines: 2286
Relevant Lines: 2336

💛 - Coveralls

@jonaslagoni
Copy link
Member

@panwauu you have one sonarcloud code smell :)

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

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

This looks great, good job! 🎉

Do you want to create the follow-up issue, that enum: ['test+', 'test_plus'] causes clashes, as both will generate TEST_PLUS name?

@sonarcloud
Copy link

sonarcloud bot commented Nov 3, 2021

SonarCloud Quality Gate failed.    Quality Gate failed

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
3.2% 3.2% Duplication

@jonaslagoni jonaslagoni merged commit 76286b2 into asyncapi:master Nov 3, 2021
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.39.4 🎉

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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Special cases in enum values fails to generate accurate enum output
4 participants