Skip to content

Conversation

polatengin
Copy link
Member

@polatengin polatengin commented May 20, 2025

Fixes #16731

Adding diagnostic error when there is a type mismatch between the parameter in the bicep file and the parameter in the bicepparam file.

Also adding a test to verify the error message is correct

Microsoft Reviewers: Open in CodeFlow

@polatengin polatengin self-assigned this May 20, 2025
@polatengin polatengin marked this pull request as draft May 20, 2025 17:51
Copy link
Contributor

github-actions bot commented May 20, 2025

Test this change out locally with the following install scripts (Action run 16978588431)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 16978588431
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 16978588431"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 16978588431
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 16978588431"

Copy link
Contributor

github-actions bot commented May 20, 2025

Dotnet Test Results

    90 files   -     45      90 suites   - 45   36m 47s ⏱️ - 20m 7s
12 249 tests  -      9  12 249 ✅  -      9  0 💤 ±0  0 ❌ ±0 
28 253 runs   - 14 113  28 253 ✅  - 14 113  0 💤 ±0  0 ❌ ±0 

Results for commit 820a376. ± Comparison against base commit 3f35b0e.

This pull request removes 1911 and adds 654 tests. Note that renamed tests count towards both.

		nestedProp1: 1
		nestedProp2: 2
		prop1: true
		prop2: false
	1
	2
	\$'")
	prop1: true
	prop2: false
…
Bicep.Cli.IntegrationTests.BuildParamsCommandTests ‑ BuildParams_Extends_InvalidType_ThrowsError
Bicep.Cli.IntegrationTests.BuildParamsCommandTests ‑ BuildParams_Extends_Multiple_InvalidType_ThrowsMultipleErrors
Bicep.Cli.IntegrationTests.DecompileParamsCommandTests ‑ Decompile_CustomOutFileAlreadyExists_ShouldFailWithoutForce
Bicep.Cli.IntegrationTests.DecompileParamsCommandTests ‑ Decompile_CustomOutFileAlreadyExists_ShouldSucceedWithForce
Bicep.Cli.IntegrationTests.DecompileParamsCommandTests ‑ Decompile_ValidParamFileWithCustomOutFile_ShouldSucceed
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
�ӽ\u000e�0\u0010\u0007��>\u0005OP��]�\u0003����(�\u001f�\u0018
������\u0001�`b�c/�^���tg�ma\u000fE���2H��\u001a\u0004�h\ud8b0\uddcc\u0002�\u000b\u00080�A���|�\u0001�ol\u001dF��\u001f���6����0+T\u001aI���\u001ai\u0015j��\u001a&W�\u001c��]\us��+�7�c
K?4\u001a����Zѧ�\u0003(�\u000cdH3�\u000e�GR!��d�����,=A\u0014EQ��'���!\u0000\u000c\u0000\u0000,"The path: index.json was not found in artifact contents")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
��K
�0\u0010\u0006�=E�\u0001b��U�{7�\u001b\u000f\u0010�\u0011+��6BA���Bܴ��C0�&��!��!�i�`2�\u001b���k��F\u001d�y�~�q��z��*!\u0005B�\u001d��\u001e�ƚڵ2�Y?(��ؼ��)!B\u0016J�I�t\u0014q�r�t��b\\u0019{N�2��\�[�ŋ�����\u0006|�o�'�6�4�	�\u0015�B�\u0010Q��4�e&�|�\u001f88��V�Z�vP\u001c�\u000e6�d�
<����<ϛ�\u000b�Qb\u0018\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000
��M\u000b�0\u0018\u0007��\u0014�\u000f0���\u000c<\u0004\u001d2��k�\u00142�B
��|�\u0010]�.�\u0004�w\u0019�\u0019�������z��8)J"�\u0002����!\u0018k�oP&\u0011�o�@r�\u0011�ux��.L+c���<�u�fI@%�\u001e�\u0004eD�
��L��U�>���\u0012�y���Z��fyֵ|�cZ\u001d>�7�\u0015}�?x\u000cQ\u000eL2�9\u0008\u0004f\u0010&��d����t��܆��氋�\u00056?��=Y�eY�{\u0001��\u0013�\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003�ӽ
�0\u0010\u0007��>E�\u0003�IzI���Ep�\u0001b{b���V(��n;�K�K?\u0004�\u001bs\u0007w��3�o�-�\u0004ˊ\u0005��>#c�-
���\u0011`�0o�p�@\u0011B��7�q�j[���1�\u0007ɐ�:�0\u0012F))$\u0018�4�҄�jk�PM�ia�s��	6�R��=\u001bj_��΀�����-�<\u0000"\u0014\u0007\u0003ZI\u0003�k�E��Y2����P�cS`\c��숥��'{���n��8�t^�e�\u0011\u0000\u000c\u0000\u0000,"Value cannot be null. (Parameter 'source')")
Bicep.Core.IntegrationTests.AzTypesViaRegistryTests ‑ Bicep_compiler_handles_corrupted_extension_package_gracefully (\u001f�\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0003�Ա
�0\u0010\u0006��>E�\u0001�$�KTp\u0010\u001cT�
��\u0004\u001b�B��\u0015
��q\u0010�\u0016��
�\u001b���p�a��T\u000bkb�\u0017,\u000c\u0005\u000f\u0018i\u001bw\u0014@���\u0000M�~�k\u0004$�V�OR�V�&w����\u0007�\u00115e�کЈRHЊ���60pwǦ;1�WS��I\u0016ۊ��K�,O�ʿ�L��{������.�\u0008�A��@�B��H{����>\F��z9?�v�h8��\u0007��L��y^�\u001eb�FR\u0000\u000c\u0000\u0000,"'7' is an invalid end of a number. Expected a delimiter. Path: $.INVALID_JSON | LineNumber: 0 | BytePositionInLine: 20.")
…

♻️ This comment has been updated with latest results.

@polatengin polatengin marked this pull request as ready for review August 15, 2025 00:10
@polatengin polatengin requested review from jeskew and Copilot August 18, 2025 22:09
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where type mismatches between parameters in Bicep files and their corresponding values in bicepparam files were not being properly validated. The fix adds diagnostic error reporting when parameter types don't match across these file boundaries.

  • Extends type validation to check parameter assignments from external files (bicepparam files)
  • Adds diagnostic error reporting for type mismatches between bicep and bicepparam files
  • Includes comprehensive test coverage for both single and multiple type mismatch scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Bicep.Core/Semantics/SemanticModel.cs Extends type validation logic to handle cross-file parameter assignments and emit appropriate diagnostics
src/Bicep.Cli.IntegrationTests/BuildParamsCommandTests.cs Adds integration tests to verify error reporting for type mismatches in extended bicepparam files

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

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.

No warning/error for type mismatch for extendable bicepparam values
1 participant