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

(GH-240) Fix incorrect enum generation #244

Merged
merged 1 commit into from
Jan 5, 2023
Merged

Conversation

chelnak
Copy link

@chelnak chelnak commented Jan 5, 2023

Prior to this change enums with a single value would be generated with a lowercase counterpart but the enum definition was malformed.

For example, given the the value Yes the following enum would be generated:

Optional[Enum['Yes' 'yes]]

This was happening because when a PowerShell array has a single value it will output a string.

This meant that when being assigned the lowercase variant of the value a string concatination occured causing the join on the next line to be ineffective.

This change updates the flow to use a System.Collections.ArrayList so that we will always have the expected datastructure.

After this change, given the value `Yes' the following enum would be generated:

Optional[Enum['Yes', 'yes]]

This is expected syntax and does not cause Puppets syntax parser to raise an error.

Prior to this change enums with a single value would be generated with a
lowercase counterpart but the enum definition was malformed.

For example, given the the value `Yes` the following enum would be
generated:

`Optional[Enum['Yes' 'yes]]`

This was happening because when a PowerShell array has a single value it
will output a string.

This meant that when being assigned the lowercase variant of the value a
string concatination occured causing the join on the next line to be
ineffective.

This change updates the flow to use a `System.Collections.ArrayList` so
that we will always have the expected datastructure.

After this change, given the value `Yes' the following enum would be
generated:

`Optional[Enum['Yes', 'yes]]`

This is expected syntax and does not cause Puppets syntax parser to
raise an error.
@chelnak chelnak added the bug Something isn't working label Jan 5, 2023
@chelnak chelnak requested a review from a team as a code owner January 5, 2023 11:18
@chelnak chelnak self-assigned this Jan 5, 2023
Copy link

@GSPatton GSPatton left a comment

Choose a reason for hiding this comment

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

looks good. Waiting for tests to complete

@GSPatton GSPatton merged commit e4c346d into main Jan 5, 2023
@GSPatton GSPatton deleted the GH-240-fix_enum_generation branch January 5, 2023 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants