Skip to content

Migrate to Order Levels#589

Draft
cihandeniz wants to merge 18 commits into
mouseless:epic/convention-order-layerizationfrom
cihandeniz:migrate-to-order-levels
Draft

Migrate to Order Levels#589
cihandeniz wants to merge 18 commits into
mouseless:epic/convention-order-layerizationfrom
cihandeniz:migrate-to-order-levels

Conversation

@cihandeniz
Copy link
Copy Markdown
Member

@cihandeniz cihandeniz commented May 30, 2026

Refactor features to use new Level system.

Tasks

  • Remove older order system
  • Migrate theme to new order system
  • Migrate relative min/max to new order system
  • Fix build errors
  • Fix generate errors
  • Fix page output changes
    • generated files are not committed, compare with old files
  • Fix hardcoded Order default values to be configurable
    • ex. DomainModelConventionCollection defaults to "Add" or "Configure",
      this should not be hardcoded
  • Fix changes in api routes
    • route-samples.kdl
  • Update ManagingOrders and ApplyingConventions tests for
    new order design
    • Base, Level or Extension null should have proper exception messages
  • Revise TODO notes and use suggested orders where possible

Additional Task

  • ModelCollection index should set value to readonly list

@cihandeniz cihandeniz self-assigned this May 30, 2026
Comment on lines +58 to +68
public Order WithBase(string @base) => Clone(
@base: @base
);

public Order WithLevel(string level) => Clone(
level: level
);

public Order WithExtension(string extension) => Clone(
extension: extension
);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

wrap and single line

c.Type.IsAssignableTo(typeof(IParsable<>)) ||
c.Type.IsAssignableTo(typeof(string)),
order: RestApiLayer.MinConventionOrder
order: Order.At.Defaults.AbsoluteMin // TODO consider using Order.At.Infra.Min
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

reminder for todo

genericArgumentMetadata.Has<ApiInputAttribute>(),
attribute: () => new ApiInputAttribute(),
order: RestApiLayer.MinConventionOrder
order: Order.At.Defaults.AbsoluteMin // TODO consider using Order.At.Infra.Min
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

reminder for todo

Comment on lines +15 to +26
public string DefaultConventionLevel { get; set; } = default!;

public class ConventionMatrixOptions
{
public IList<string> Bases { get; } = [];
public IList<string> Levels { get; } = [];
public IList<string> Extensions { get; } = [];

public Func<IDomainModelConvention, string> FallbackBase { get; set; } = default!;
public Func<IDomainModelConvention, string> FallbackLevel { get; set; } = default!;
public Func<IDomainModelConvention, string> FallbackExtension { get; set; } = default!;
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no default!

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.

i did commit a solution for not using default!, it may require tests to be updated

Comment on lines 9 to 13
_options.ConventionLevels
BuildLevels(_options.ConventionMatrix)
.Select((name, index) => (name, index))
.ToDictionary(x => x.name, x => x.index)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

indentation

dtc.Component.Data ??= Context.Parent(options: o => o.Prop = $"{rootProp}.{data.Prop}");
},
order: UiLayer.MaxConventionOrder - 10
order: Order.At.Theme.Max // TODO Consider using Order.At.Ux
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

remove todo, ux base is canceled

f.Component.Data ??= Context.Parent(options: cd => cd.Prop = $"data.{prop}");
},
order: UiLayer.MaxConventionOrder - 10
order: Order.At.Theme.Max // TODO consider using Order.At.Ux
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

remove todo, ux level canceled

Comment on lines +81 to +82
o.ConventionMatrix.Bases.Add("A");
o.ConventionMatrix.Bases.Add("B");
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ConventionOrderMatrix 🤔

[Test]
public void A_level_change_can_be_set_as_default_so_that_it_is_used_when_a_level_is_not_present()
{
true.ShouldBeFalse();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

:) use Assert.Fail() when this.ShouldFail() is not available

@@ -1,5 +1,5 @@
route-sample {
@controller-model locate-route="GET /coding-style/namespace-as-route/route-samples/{id}"
@controller-model locate-route="GET /route-samples/{id}"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fix api endpoint changes

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