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

User-Defined Types - Compiled JSON does not recognize discriminator types #12331

Closed
slavizh opened this issue Oct 30, 2023 · 3 comments · Fixed by #12388
Closed

User-Defined Types - Compiled JSON does not recognize discriminator types #12331

slavizh opened this issue Oct 30, 2023 · 3 comments · Fixed by #12388
Assignees
Labels
bug Something isn't working type system
Milestone

Comments

@slavizh
Copy link
Contributor

slavizh commented Oct 30, 2023

Bicep version
Bicep CLI version 0.22.6 (d62b94d)

Describe the bug
If you have foo.bicep like

@sealed()
type typeA = {
  type: 'a'
  value: string
}

@sealed()
type typeB = {
  type: 'b'
  value: int
}

@sealed()
@discriminator('type')
type unionAB = typeA | typeB

type unionAbArray = unionAB[]

param foo unionAbArray

and in bicep parameters file you reference that file all looks ok. But if you convert the bicep to json and reference the json (or reference the json that is uploaded to bicep registry intellisense does not work.

276935068-3654f04b-006d-474f-a035-1fbe3927b6ec

276935195-d71ea900-01f6-4cee-9e36-bad8e42d359e

This makes discriminator useless as basically it works only if you use the bicep template directly.

To Reproduce
Steps to reproduce the behavior:

Additional context
Add any other context about the problem here.

@slavizh
Copy link
Contributor Author

slavizh commented Nov 8, 2023

@jeskew once the fix is available, do we have to compile again the bicep templates?

@jeskew
Copy link
Contributor

jeskew commented Nov 8, 2023

@slavizh No, recompiling templates won't be necessary. The change made in the linked PR updates how Bicep reads type information in ARM JSON templates and does not affect compilation from bicep to JSON.

@slavizh
Copy link
Contributor Author

slavizh commented Nov 8, 2023

@jeskew thanks for confirming. I was suspecting that was the case but do not know the code that well so better to confirm it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type system
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants