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

Bicep ProgramSyntax / SyntaxTree feature #275

Open
kilasuit opened this issue Sep 19, 2022 · 3 comments
Open

Bicep ProgramSyntax / SyntaxTree feature #275

kilasuit opened this issue Sep 19, 2022 · 3 comments
Labels
enhancement New feature or request PSBicep

Comments

@kilasuit
Copy link

To be more able to statistically analyse Bicep files, or programmatically build them, there should be a mechanism to convert a bicep file into usable Objects within PowerShell

@kilasuit kilasuit added the enhancement New feature or request label Sep 19, 2022
@StefanIvemo
Copy link
Member

Build-Bicep have a -AsHashtable switch. Is this what you are looking for?

@SimonWahlin
Copy link
Member

We've been entertaining the idea of returning some kind of BicepTemplate object similar to Bicep.Core.Syntax.ProgramSyntax and similar to the PowerShell AST.

The problem is that since bicep has dependencies that are in conflict with other modules and PowerShell itself (Newtonsoft.Json), we are using the module BicepNet.PS to stand up an assembly load context where we can load all the bicep dlls in it's own "bubble". This means that we cannot expose the native types from bicep but will have to maintain our own classes representing the same types, which might end up being quite a lot of work.

We currently haven't found any scenarios where we feel the benefit of having this rich syntax tree motivates the effort to maintain it. However if you have any specific scenarios I'm open for a discussion.

@kilasuit
Copy link
Author

@StefanIvemo - that may do thou let me play a bit more

@SimonWahlin please see this kilasuit/ARMTemplateComplexity#11 as to why I would like to have a proper bicepfile type similar to those that I have built in that repo for ARM templates and other json files.

I think it's perhaps worth me trying to get some time with @alex-frankel to discuss further too prior to the bicep community call this month if I can

@SimonWahlin SimonWahlin changed the title ConvertFrom-Bicep function Bicep ProgramSyntax / SyntaxTree feature Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PSBicep
Projects
None yet
Development

No branches or pull requests

3 participants