-
Notifications
You must be signed in to change notification settings - Fork 334
fix: @opExample generation with @versioned namespaces, unions, and enums #9268
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
base: main
Are you sure you want to change the base?
fix: @opExample generation with @versioned namespaces, unions, and enums #9268
Conversation
b6ed95f to
bfb7971
Compare
| return { example: serializeValueAsJson(program, example.value, type, encodeAs) }; | ||
| const exactValueType = program.checker.getValueExactType(example.value); | ||
| return { | ||
| example: serializeValueAsJson(program, example.value, exactValueType ?? type, encodeAs), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution but I am not sure this is the right fix for this issue. I assume the problem must be that the enum must not be mutated correctly so it return a different instance for the value and the type. While this fix probably workaround this issue I think it also has some negative issues of lossing the original type information which might have encoding and other things
commit: |
|
All changed packages have been documented.
Show changes
|
|
Hi @timotheeguerin, Thanks for reviewing my PR and for the feedback. I agree that the proposed solution is more of a workaround. My assumption was that since all checks for operation example value compatibility are already done earlier, it might not be necessary to validate the example data against the type again. I also spent some time debugging the original cause and found that the decorator argument values are not being mutated correctly during the mutation process. Based on that, I prepared an additional PR #9308 that addresses this root issue. I would really appreciate it if you could take a look at it. Thanks in advance! |
This PR fixes an issue where example generation (
@opExample) fails when used in a@versionednamespace on operations whose return type includes a union that references an enum.Fixes: #8769