fix: @opExample generation with @versioned namespaces, unions, and enums#9268
fix: @opExample generation with @versioned namespaces, unions, and enums#9268ershov-konst wants to merge 3 commits intomicrosoft:mainfrom
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.
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! |
|
Hi @@ershov-konst. Your PR has had no update for 30 days and it is marked as a stale PR. If it is not updated within 30 days, the PR will automatically be closed. If you want to refresh the PR, please remove the |
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