You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In past discussions, we kept calling azrm a "provider", but is too similar to an ARM Resource Provider. I propose we call this a "Resource Manager" instead. (RM for short.)
Considerations
Built-in types (string, number, int, bool, array, object) are not specific to an RM.
Named resource and non-resource types are RM-specific.
Functions need to be split into RM-specific and non RM-specific groups.
Implicit conversion
Here are the rules that determine how values can be assigned.
all values are assignable to declarations of the same type
all types are assignable to any
int is assignable to number
int is assignable to int | string
string is assignable to int | string
resource is assignable to object
azrm://ResourceGroup is assignable to object but not to resource
azrm://Microsoft.Network/virtualNetworks@2019-06-01 is assignable to resource
azrm://Microsoft.Network/virtualNetworks@2019-05-01 is NOT assignable to azrm://Microsoft.Network/virtualNetworks@2019-06-01 or vice versa
Explicit conversion
Explicit type conversions should be performed via function invocations if such a function is available.
The text was updated successfully, but these errors were encountered:
Proposal for string literal union and refinement type syntax
In an ARM template we can specify allowed values (mostly for string, not sure if it works for object), and in our new DSL the syntax looks like this (correct me if I'm wrong):
When checking the type of myResource the type system will need to check 1. if it is a string; 2. if its value is within allowedValues. This means the type of myResource is essentially a string literal union, so I wonder if it makes sense for us to support the following syntax like TypeScript does:
parameter myParameter "foo" | "bar" = ...
Similarly, you can specify minValue and maxValue for int parameters, and minLength and maxLength for string parameters. Here's how currently an int parameter with constraints looks like in our new DSL:
This appears to be a Refinement Type. PLs like LiquidHaskell and Scala support it. We might not want a complete Refinement Type system because our new DSL is not a general purpose PL, but we will need implement it for parameter checking. I'm thinking about something like the following for int parameters:
parameter myParameter { int | x >= 0 && x <= 10000 } = ...
Types
We will support the following types:
azrm://ResourceGroup
,azrm://Deployment
,azrm://Parameter
, etc.)azrm://Microsoft.Network/virtualNetworks@2019-06-01
)Union types
One example why we need union types is the
concat()
function (and any other function with multi-type arguments).One possible way to model the concat function using pseudo-TypeScript:
Resource Managers
In past discussions, we kept calling
azrm
a "provider", but is too similar to an ARM Resource Provider. I propose we call this a "Resource Manager" instead. (RM for short.)Considerations
string
,number
,int
,bool
,array
,object
) are not specific to an RM.Implicit conversion
Here are the rules that determine how values can be assigned.
any
int
is assignable tonumber
int
is assignable toint | string
string
is assignable toint | string
resource
is assignable toobject
azrm://ResourceGroup
is assignable toobject
but not toresource
azrm://Microsoft.Network/virtualNetworks@2019-06-01
is assignable toresource
azrm://Microsoft.Network/virtualNetworks@2019-05-01
is NOT assignable toazrm://Microsoft.Network/virtualNetworks@2019-06-01
or vice versaExplicit conversion
Explicit type conversions should be performed via function invocations if such a function is available.
The text was updated successfully, but these errors were encountered: