Skip to content

Add support for Nullable injection types as 'optional" injections#409

Merged
ggleyzer merged 1 commit intomasterfrom
Nullable
Mar 13, 2026
Merged

Add support for Nullable injection types as 'optional" injections#409
ggleyzer merged 1 commit intomasterfrom
Nullable

Conversation

@ggleyzer
Copy link
Copy Markdown
Collaborator

In a number of container-based execution scenarios there appears to be a very useful pattern of declaring an optional injectable resource via Nullable types.

JK used this pattern to declare optional overrides for DB model size thresholds:

    @Inject(ConfigSmallModelMaxBytes)  Int? smallModelBytesMax;
    @Inject(ConfigSmallModelMaxFiles)  Int? smallModelFilesMax;
    @Inject(ConfigMediumModelMaxBytes) Int? mediumModelBytesMax;
    @Inject(ConfigMediumModelMaxFiles) Int? mediumModelFilesMax;

and to declare optional tests in xunit engine:

        @Inject(discovery.ConfigDiscoveryTest)        List<String>? tests;
        @Inject(discovery.ConfigDiscoveryVerbose)     String?       verboseConfig;

Both scenarios were hand coded in the BasicResourceProvider

Another use of that patter can be found in the platform repository, where we "optionally" inject Authenticator and Broker resources.

This change takes a systematic approach for this pattern; all OOTB ResourceProvider implementations allow any resource to be optionally injected using a Nullable type.

Corresponding changes will also be made in the platform code.

While working on this, I discovered and fixed a couple of bugs in the native support for Type.x

@ggleyzer ggleyzer requested a review from cpurdy March 12, 2026 22:20
Comment thread lib_ecstasy/src/main/x/ecstasy/mgmt/BasicResourceProvider.x
@ggleyzer ggleyzer merged commit 686b852 into master Mar 13, 2026
4 checks passed
@ggleyzer ggleyzer deleted the Nullable branch March 13, 2026 13:17
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