Skip to content

Stop marking appsettings schema settings as required - #102

Merged
ronaldbarendse merged 1 commit into
release/17.2.0from
bugfix/appsettings-schema-required-settings
Nov 26, 2026
Merged

ronaldbarendse merged 1 commit into
release/17.2.0from
bugfix/appsettings-schema-required-settings

Conversation

@ronaldbarendse

Copy link
Copy Markdown
Contributor

Fixes #101.

The appsettings schemas generated since the move from hand-written schemas mark the Umbraco, Storage, Cdn and AzureBlob nodes as required (from the C# required modifier on the schema wrapper types), and Cdn:Url and AzureBlob:{name}:VirtualPath too. Configuration is layered across appsettings files and environment variables, so any file that doesn't contain every Storage Providers setting, like an appsettings.Production.json that only overrides a few CMS settings, gets a validation warning on the whole Umbraco node.

Umbraco.JsonSchema.Extensions 0.6.0 switches JsonSchemaGenerate to the System.Text.Json JsonSchemaExporter and no longer marks any property as required by default (umbraco/Umbraco.JsonSchema.Extensions#18). Updating to it is the whole fix: the C# required modifiers and [Required] attributes stay, so missing or empty settings are still reported at startup by options validation.

Changes to the generated schemas

  • No required anywhere.
  • Nested types are inlined instead of using definitions, and the root title is gone.
  • Cdn:Url no longer has minLength: 1; format: uri still flags an empty value in editors.
  • Same settings, types, descriptions, defaults and enums as before.

How to verify

Build the solution and check the generated appsettings-schema.Umbraco.StorageProviders.json and appsettings-schema.Umbraco.StorageProviders.AzureBlob.json contain no required. Then validate these files against the schemas (e.g. in VS Code via the test site's appsettings-schema.json):

appsettings content 0.5.0 0.6.0
The issue's appsettings.Production.json (no Storage node) Storage required valid
Cdn with only RemoveMediaFromPath Url required valid
AzureBlob:Media without VirtualPath (set in code for media) VirtualPath required valid
AzureBlob:Media with only ContainerName VirtualPath required valid
Cdn:Url set to a number invalid invalid
AzureBlob:Media:Retry:Mode set to "Linear" invalid invalid

I also built release/18.1.0 and release/19.0.0 with the same update: both build without errors and generate schemas without required that pass the same cases, so this can be merged forward as is.

Risks

Build-time only: the package is a global, private build dependency, so nothing changes for sites at runtime. The JsonSchemaGenerate task in 0.6.0 needs the .NET 10 SDK or MSBuild 18, which this branch already requires for 0.5.0.

@ronaldbarendse
ronaldbarendse merged commit 61b891f into release/17.2.0 Nov 26, 2026
2 checks passed
@ronaldbarendse
ronaldbarendse deleted the bugfix/appsettings-schema-required-settings branch November 26, 2026 23:13
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.

1 participant