Skip to content

[Configuration] Make optional scalar properties nullable - #3785

Open
Aryadeepta (Aryadeepta) wants to merge 1 commit into
Azure:mainfrom
Aryadeepta:fix/1861-nullable-scalar-config
Open

[Configuration] Make optional scalar properties nullable#3785
Aryadeepta (Aryadeepta) wants to merge 1 commit into
Azure:mainfrom
Aryadeepta:fix/1861-nullable-scalar-config

Conversation

@Aryadeepta

Copy link
Copy Markdown

Why make this change?

What is this change?

  • Make optional REST and GraphQL scalar runtime properties nullable so omitted values remain distinguishable from explicitly configured values.
  • Preserve effective runtime defaults through RuntimeConfig accessors.
  • Update REST and GraphQL converters so omitted scalar properties remain omitted during serialization.
  • Preserve explicit true and false values for REST/GraphQL shorthand configuration.
  • Preserve existing dab init output by explicitly supplying generated GraphQL defaults.
  • Update hot-reload tests to use effective REST/GraphQL enabled values.
  • Add regression coverage verifying that:
    • omitted scalar properties remain omitted after serialization;
    • omitted scalar properties do not overwrite base configuration values after merge.

How was this tested?

  • Integration Tests
  • Unit Tests

Validated with:

  • dotnet build src/Azure.DataApiBuilder.sln --no-restore
  • RuntimeConfigLoaderJsonDeserializerTests
  • scalar serialization and merge regression tests
  • ConfigGeneratorTests
  • ConfigureOptionsTests
  • targeted CLI regression tests
  • dotnet format src/Azure.DataApiBuilder.sln --verify-no-changes

The full Service test suite was also attempted locally, but environment-dependent tests require external database instances and exceeded the local WSL inotify watcher limit.

Sample Request(s)

Not applicable. This change affects configuration serialization and merge behavior rather than REST or GraphQL request behavior.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the configuration object model and JSON converters so that optional REST/GraphQL scalar runtime settings (e.g., enabled, path, allow-introspection, request-body-strict) can remain omitted (serialized as absent) when not explicitly configured, preventing higher-precedence configs from unintentionally overriding base config values during merge. It preserves effective runtime defaults via RuntimeConfig accessor properties and adds regression tests to validate the new serialization/merge behavior.

Changes:

  • Make REST and GraphQL runtime scalar options nullable in the object model and adjust RuntimeConfig accessors to apply effective defaults.
  • Update REST/GraphQL runtime options JSON converters to only write scalar properties when explicitly set.
  • Add/adjust tests (including hot-reload) to validate omission-preserving serialization and non-overriding merge behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Service.Tests/UnitTests/RuntimeConfigLoaderJsonDeserializerTests.cs Adds regression tests for omission-preserving serialization and merge behavior while asserting effective defaults via RuntimeConfig accessors.
src/Service.Tests/Configuration/HotReload/ConfigurationHotReloadTests.cs Updates hot-reload assertions to use effective RuntimeConfig accessors rather than nullable underlying options.
src/Config/ObjectModel/RuntimeConfig.cs Updates accessors (IsRestEnabled, IsGraphQLEnabled, paths, etc.) to interpret nullable scalar options with correct effective defaults.
src/Config/ObjectModel/RestRuntimeOptions.cs Makes REST scalar options nullable to distinguish omitted vs explicitly configured values.
src/Config/ObjectModel/GraphQLRuntimeOptions.cs Makes key GraphQL scalar options nullable to distinguish omitted vs explicitly configured values.
src/Config/Converters/RestRuntimeOptionsConverterFactory.cs Writes REST scalar properties only when non-null; preserves shorthand true/false behavior.
src/Config/Converters/GraphQLRuntimeOptionsConverterFactory.cs Writes GraphQL scalar properties only when non-null; preserves shorthand true/false behavior.
src/Cli/ConfigGenerator.cs Keeps dab init output stable by explicitly supplying GraphQL defaults where needed.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Config/ObjectModel/RestRuntimeOptions.cs
@Aryadeepta
Aryadeepta (Aryadeepta) force-pushed the fix/1861-nullable-scalar-config branch from 4107715 to e0538f3 Compare August 26, 2026 23:53
@Aryadeepta

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

[Configuration] Make optional scalar properties nullable

2 participants