Skip to content

Add type package validation - #890

Open
Mingzhe Jiang (jiangmingzhe) wants to merge 7 commits into
Azure:mainfrom
jiangmingzhe:mingzhejiang/type-package-validation-init
Open

Add type package validation#890
Mingzhe Jiang (jiangmingzhe) wants to merge 7 commits into
Azure:mainfrom
jiangmingzhe:mingzhejiang/type-package-validation-init

Conversation

@jiangmingzhe

@jiangmingzhe Mingzhe Jiang (jiangmingzhe) commented Aug 3, 2026

Copy link
Copy Markdown
Member

Adds a new library for validating serialized Bicep type packages before publishing or consumption.

Functionality

  • Supports directories, index.json, archive files, and archive streams.
  • Validates JSON structure, references, type graphs, semantic constraints, and package hygiene.
  • Supports canonical-writer and compatible-reader modes.
  • Produces stable, source-located diagnostics.
  • Adds Bicep Types v1 format awareness.

Structure

  • Packaging/: input and archive handling
  • Structural/: JSON shape validation
  • Graph/: reference and target validation
  • Semantic/: value constraints
  • Policy/: compatibility rules
  • Hygiene/: unreachable/unexpected files
  • Diagnostics/: diagnostic models and ordering

Also adds the projects to the solution and introduces a suite of unit-test and golden-sample samples.

/// validation is now implemented (see <c>BCPVT030</c>–<c>BCPVT033</c>); this code is retained for
/// API stability but is no longer emitted.
/// </summary>
public const string ArchiveValidationNotImplemented = "BCPVT001";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The codes seem to be duplicated in this file. Can we make it so they are only in one place (just like in Bicep)?

}

// 2. Package-relative path.
var cmp = string.CompareOrdinal(x.Path ?? string.Empty, y.Path ?? string.Empty);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

According to https://learn.microsoft.com/en-us/dotnet/api/system.string.compareordinal?view=net-10.0, the string.CompareOrdinal() method accepts nulls already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants