• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ImmediatePlatform / Immediate.Apis / 29608434317

17 Jul 2026 07:41PM UTC coverage: 91.759% (-0.6%) from 92.407%
29608434317

Pull #314

github

web-flow
Merge 25493f2e4 into 7e12df6cd
Pull Request #314: Support tagged registrations of endpoints

1325 of 1444 relevant lines covered (91.76%)

3.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.78
/src/Immediate.Apis.Generators/ImmediateApisGenerator.Render.cs
1
using Microsoft.CodeAnalysis;
2
using Scriban;
3

4
namespace Immediate.Apis.Generators;
5

6
public sealed partial class ImmediateApisGenerator
7
{
8
        private static void RenderEndpoint(
9
                SourceProductionContext context,
10
                Method method,
11
                Template template
12
        )
13
        {
14
                var token = context.CancellationToken;
4✔
15
                token.ThrowIfCancellationRequested();
4✔
16

17
                var source = template.Render(new
4✔
18
                {
4✔
19
                        Method = method,
4✔
20
                        Version = ThisAssembly.InformationalVersion,
4✔
21
                });
4✔
22

23
                token.ThrowIfCancellationRequested();
4✔
24

25
                context.AddSource($"IA.{method.Namespace}.{method.Class.Name}.g.cs", source);
4✔
26
        }
4✔
27

28
        private static void RenderMapEndpoints(
29
                SourceProductionContext context,
30
                EquatableReadOnlyList<RouteEndpoint> endpoints,
31
                EquatableReadOnlyList<RouteGroupDefinition> groups,
32
                AssemblyDefaults assemblyDefaults,
33
                Template template
34
        )
35
        {
36
                var token = context.CancellationToken;
4✔
37
                token.ThrowIfCancellationRequested();
4✔
38

39
                var endpointLookup = endpoints.ToLookup(e => e.Tags, StringComparer.Ordinal);
4✔
40
                var groupLookup = groups.ToLookup(e => e.Tags, StringComparer.Ordinal);
4✔
41

42
                var tags = endpointLookup.Select(l => l.Key)
4✔
43
                        .Union(groupLookup.Select(l => l.Key), StringComparer.Ordinal)
4✔
44
                        .OrderBy(l => l, StringComparer.Ordinal)
4✔
45
                        .Select(k => new
4✔
46
                        {
4✔
47
                                Tag = k,
4✔
48
                                Endpoints = endpointLookup[k].ToEquatableReadOnlyList(),
4✔
49
                                Groups = groupLookup[k].ToEquatableReadOnlyList(),
4✔
50
                        })
4✔
51
                        .ToEquatableReadOnlyList();
4✔
52

53
                var source = template.Render(new
4✔
54
                {
4✔
55
                        assemblyDefaults.AssemblyName,
4✔
56
                        assemblyDefaults.LanguageVersion,
4✔
57

4✔
58
                        Tags = tags,
4✔
59
                        Version = ThisAssembly.InformationalVersion,
4✔
60
                });
4✔
61

62
                token.ThrowIfCancellationRequested();
4✔
63
                context.AddSource("IA.MapEndpoints.g.cs", source);
4✔
64
        }
4✔
65

66
        private static void RenderRouteGroup(
67
                SourceProductionContext context,
68
                RouteGroup group,
69
                Template template
70
        )
71
        {
72
                var token = context.CancellationToken;
4✔
73
                token.ThrowIfCancellationRequested();
4✔
74

75
                var source = template.Render(new
4✔
76
                {
4✔
77
                        Root = group,
4✔
78
                        Version = ThisAssembly.InformationalVersion,
4✔
79
                });
4✔
80

81
                var name = $"{group.Definition.Namespace}.{string.Join(".", group.Definition.OuterClasses.Select(c => c.Name))}.{group.Definition.Class.Name}";
×
82
                context.AddSource($"IA.{name}.g.cs", source);
4✔
83
        }
4✔
84
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc