From 2c19163b016765bd185461cb6c11a3175709a12a Mon Sep 17 00:00:00 2001 From: Levi Muriuki Date: Fri, 23 Jan 2026 20:14:35 -0800 Subject: [PATCH 1/4] messed up --- src/Bicep.Types/Serialization/TypeJsonContext.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bicep.Types/Serialization/TypeJsonContext.cs b/src/Bicep.Types/Serialization/TypeJsonContext.cs index 666d231d..9866bfb6 100644 --- a/src/Bicep.Types/Serialization/TypeJsonContext.cs +++ b/src/Bicep.Types/Serialization/TypeJsonContext.cs @@ -1,6 +1,5 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Text.Json; using System.Text.Json.Serialization; using Azure.Bicep.Types.Concrete; using Azure.Bicep.Types.Index; @@ -15,6 +14,7 @@ namespace Azure.Bicep.Types.Serialization; [JsonSerializable(typeof(ObjectType))] [JsonSerializable(typeof(FunctionType))] [JsonSerializable(typeof(ResourceFunctionType))] +[JsonSerializable(typeof(NamespaceFunctionType))] [JsonSerializable(typeof(ResourceType))] [JsonSerializable(typeof(StringLiteralType))] [JsonSerializable(typeof(UnionType))] @@ -23,7 +23,7 @@ namespace Azure.Bicep.Types.Serialization; [JsonSerializable(typeof(BooleanType))] [JsonSerializable(typeof(IntegerType))] [JsonSerializable(typeof(StringType))] -[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] +[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault)] internal partial class TypeJsonContext : JsonSerializerContext { } From 4ab5a6e21cc27164444e7323ec54df87827d498d Mon Sep 17 00:00:00 2001 From: Levi Muriuki Date: Fri, 23 Jan 2026 20:17:26 -0800 Subject: [PATCH 2/4] sorry --- src/Bicep.Types/Serialization/TypeJsonContext.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bicep.Types/Serialization/TypeJsonContext.cs b/src/Bicep.Types/Serialization/TypeJsonContext.cs index 9866bfb6..a9047fd7 100644 --- a/src/Bicep.Types/Serialization/TypeJsonContext.cs +++ b/src/Bicep.Types/Serialization/TypeJsonContext.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +using System.Text.Json; using System.Text.Json.Serialization; using Azure.Bicep.Types.Concrete; using Azure.Bicep.Types.Index; @@ -23,7 +24,7 @@ namespace Azure.Bicep.Types.Serialization; [JsonSerializable(typeof(BooleanType))] [JsonSerializable(typeof(IntegerType))] [JsonSerializable(typeof(StringType))] -[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault)] +[JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] internal partial class TypeJsonContext : JsonSerializerContext { } From 8d94ab9ec0a458a02e8c80687f59f3e9e1495b00 Mon Sep 17 00:00:00 2001 From: Levi Muriuki Date: Wed, 18 Feb 2026 10:39:17 -0800 Subject: [PATCH 3/4] [namespace functions]Add more properties to generated markdown --- src/bicep-types/src/writers/markdown.ts | 14 +++++++++++--- .../test/integration/baselines/foo/foo/types.md | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/bicep-types/src/writers/markdown.ts b/src/bicep-types/src/writers/markdown.ts index 7640fcf2..3c7d7c53 100644 --- a/src/bicep-types/src/writers/markdown.ts +++ b/src/bicep-types/src/writers/markdown.ts @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { ArrayType, BuiltInType, DiscriminatedObjectType, getBuiltInTypeKindLabel, getObjectTypePropertyFlagsLabels, getScopeTypeLabels, ObjectTypeProperty, ObjectType, ResourceFunctionType, ResourceType, StringLiteralType, StringType, BicepType, TypeBaseKind, TypeIndex, TypeReference, UnionType, IntegerType, FunctionType, NamespaceFunctionType, TypeFile } from '../types'; +import { ArrayType, BuiltInType, DiscriminatedObjectType, getBuiltInTypeKindLabel, getNamespaceFunctionParameterFlagsLabels, getObjectTypePropertyFlagsLabels, getScopeTypeLabels, ObjectTypeProperty, ObjectType, ResourceFunctionType, ResourceType, StringLiteralType, StringType, BicepType, TypeBaseKind, TypeIndex, TypeReference, UnionType, IntegerType, FunctionType, NamespaceFunctionType, BicepSourceFileKind, TypeFile } from '../types'; import { groupBy, orderBy } from '../utils'; class MarkdownFile { @@ -222,14 +222,22 @@ export function writeMarkdown(types: BicepType[], fileHeading?: string) { const namespaceFunctionType = type as NamespaceFunctionType; md.writeHeading(nesting, `Namespace Function ${namespaceFunctionType.name}`); md.writeBullet("Description", namespaceFunctionType.description || "(none)"); + if (namespaceFunctionType.evaluatedLanguageExpression !== undefined) { + md.writeBullet("Evaluated language expression", `\`${namespaceFunctionType.evaluatedLanguageExpression}\``); + } + if (namespaceFunctionType.visibleInFileKind !== undefined) { + md.writeBullet("Visible only in bicep file kind", BicepSourceFileKind[namespaceFunctionType.visibleInFileKind]); + } if (namespaceFunctionType.parameters && namespaceFunctionType.parameters.length > 0) { md.writeHeading(nesting + 1, "Parameters"); for (let i = 0; i < namespaceFunctionType.parameters.length; i++) { const param = namespaceFunctionType.parameters[i]; - md.writeNumbered(i + 1, param.name, getTypeName(types, param.type)); + const flagsString = param.flags ? ` (${getNamespaceFunctionParameterFlagsLabels(param.flags).join(', ')})` : ''; + const descriptionString = param.description ? `: ${param.description}` : ''; + md.writeNumbered(i + 1, param.name, `${getTypeName(types, param.type)}${flagsString}${descriptionString}`); } } - md.writeBullet("Output", getTypeName(types, namespaceFunctionType.outputType)); + md.writeBullet("Output type", getTypeName(types, namespaceFunctionType.outputType)); md.writeNewLine(); return; diff --git a/src/bicep-types/test/integration/baselines/foo/foo/types.md b/src/bicep-types/test/integration/baselines/foo/foo/types.md index ce8cac22..a6b44b53 100644 --- a/src/bicep-types/test/integration/baselines/foo/foo/types.md +++ b/src/bicep-types/test/integration/baselines/foo/foo/types.md @@ -19,9 +19,11 @@ ## Namespace Function binding * **Description**: Binding function +* **Evaluated language expression**: `[externalInput('binding', parameters('bindingKey'))]` +* **Visible only in bicep file kind**: ParamsFile ### Parameters -1. **bindingKey**: string -* **Output**: any +1. **bindingKey**: string (Required): The binding key parameter +* **Output type**: any ## def ### Properties From d055ea846e41262cdd39caf7a3b1ddbdb3d431a2 Mon Sep 17 00:00:00 2001 From: Levi Muriuki Date: Wed, 18 Feb 2026 13:55:48 -0800 Subject: [PATCH 4/4] fix go test failure --- src/bicep-types-go/writers/markdown.go | 50 ++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/src/bicep-types-go/writers/markdown.go b/src/bicep-types-go/writers/markdown.go index c6524bf9..832397c3 100644 --- a/src/bicep-types-go/writers/markdown.go +++ b/src/bicep-types-go/writers/markdown.go @@ -330,6 +330,14 @@ func writeComplexType(md *markdownBuilder, typesList []types.Type, t types.Type, } md.writeBullet("Description", description) + if concrete.EvaluatedLanguageExpression != "" { + md.writeBullet("Evaluated language expression", fmt.Sprintf("`%s`", concrete.EvaluatedLanguageExpression)) + } + + if concrete.VisibleInFileKind != nil { + md.writeBullet("Visible only in bicep file kind", formatBicepSourceFileKind(*concrete.VisibleInFileKind)) + } + if len(concrete.Parameters) > 0 { md.writeHeading(nesting+1, "Parameters") for i, param := range concrete.Parameters { @@ -337,7 +345,14 @@ func writeComplexType(md *markdownBuilder, typesList []types.Type, t types.Type, if err != nil { return err } - md.writeNumbered(i+1, param.Name, paramTypeName) + value := paramTypeName + if flags := formatNamespaceFunctionParameterFlags(param.Flags); flags != "" { + value += fmt.Sprintf(" (%s)", flags) + } + if param.Description != "" { + value += ": " + param.Description + } + md.writeNumbered(i+1, param.Name, value) } } @@ -345,7 +360,7 @@ func writeComplexType(md *markdownBuilder, typesList []types.Type, t types.Type, if err != nil { return err } - md.writeBullet("Output", outputTypeName) + md.writeBullet("Output type", outputTypeName) md.writeNewLine() case *types.ObjectType: if includeHeader { @@ -612,6 +627,37 @@ func getScopeTypeLabels(scope types.ScopeType) []string { return result } +func formatBicepSourceFileKind(kind types.BicepSourceFileKind) string { + switch kind { + case types.BicepSourceFileKindBicepFile: + return "BicepFile" + case types.BicepSourceFileKindParamsFile: + return "ParamsFile" + default: + return fmt.Sprintf("Unknown(%d)", int(kind)) + } +} + +func formatNamespaceFunctionParameterFlags(flags types.NamespaceFunctionParameterFlags) string { + labels := []struct { + flag types.NamespaceFunctionParameterFlags + label string + }{ + {types.NamespaceFunctionParameterFlagsRequired, "Required"}, + {types.NamespaceFunctionParameterFlagsCompileTimeConstant, "CompileTimeConstant"}, + {types.NamespaceFunctionParameterFlagsDeployTimeConstant, "DeployTimeConstant"}, + } + + names := make([]string, 0, len(labels)) + for _, entry := range labels { + if flags&entry.flag == entry.flag { + names = append(names, entry.label) + } + } + + return strings.Join(names, ", ") +} + func formatPropertyFlags(flags types.TypePropertyFlags) string { labels := []struct { flag types.TypePropertyFlags