Skip to content

Add [GeneratedCode] for more RDG output #48377

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/Http/Http.Extensions/gen/RequestDelegateGeneratorSources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ internal static class RequestDelegateGeneratorSources

public static string GeneratedCodeAttribute => $@"[System.CodeDom.Compiler.GeneratedCodeAttribute(""{typeof(RequestDelegateGeneratorSources).Assembly.FullName}"", ""{typeof(RequestDelegateGeneratorSources).Assembly.GetName().Version}"")]";

public static string ContentTypeConstantsType => """
public static string ContentTypeConstantsType => $$"""
{{GeneratedCodeAttribute}}
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -31,7 +32,8 @@ file static class GeneratedMetadataConstants

""";

public static string ProducesResponseTypeMetadataType => """
public static string ProducesResponseTypeMetadataType => $$"""
{{GeneratedCodeAttribute}}
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -50,7 +52,8 @@ public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[

""";

public static string AcceptsMetadataType => """
public static string AcceptsMetadataType => $$"""
{{GeneratedCodeAttribute}}
file sealed class GeneratedAcceptsMetadata : IAcceptsMetadata
{
public GeneratedAcceptsMetadata(string[] contentTypes)
Expand Down Expand Up @@ -258,6 +261,7 @@ private static Task WriteToResponseAsync<T>(T? value, HttpContext httpContext, J
""";

public static string LogOrThrowExceptionHelperClass => $$"""
{{GeneratedCodeAttribute}}
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down Expand Up @@ -402,7 +406,8 @@ public void InvalidFormRequestBody(string parameterTypeName, string parameterNam
}
""";

public static string PropertyAsParameterInfoClass = """
public static string PropertyAsParameterInfoClass = $$"""
{{GeneratedCodeAttribute}}
file sealed class PropertyAsParameterInfo : ParameterInfo
{
private readonly PropertyInfo _underlyingProperty;
Expand Down Expand Up @@ -547,6 +552,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

{{GeneratedCodeAttribute}}
file static class GeneratedRouteBuilderExtensionsCore
{
{{GetGenericThunks(genericThunks)}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -1839,6 +1840,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -1855,6 +1857,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -1864,6 +1867,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -364,6 +365,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedAcceptsMetadata : IAcceptsMetadata
{
public GeneratedAcceptsMetadata(string[] contentTypes)
Expand All @@ -389,6 +391,7 @@ namespace Microsoft.AspNetCore.Http.Generated

public bool IsOptional { get; }
}
%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -398,6 +401,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -247,6 +248,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -263,6 +265,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -272,6 +275,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -219,6 +220,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -235,6 +237,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -244,6 +247,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -219,6 +220,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -235,6 +237,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -244,6 +247,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -247,6 +248,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -263,6 +265,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -272,6 +275,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -218,6 +219,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -234,6 +236,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -243,6 +246,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -218,6 +219,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -234,6 +236,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -243,6 +246,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -383,6 +384,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -399,6 +401,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -408,6 +411,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ namespace Microsoft.AspNetCore.Http.Generated
using MetadataPopulator = System.Func<System.Reflection.MethodInfo, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions?, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult>;
using RequestDelegateFactoryFunc = System.Func<System.Delegate, Microsoft.AspNetCore.Http.RequestDelegateFactoryOptions, Microsoft.AspNetCore.Http.RequestDelegateMetadataResult?, Microsoft.AspNetCore.Http.RequestDelegateResult>;

%GENERATEDCODEATTRIBUTE%
file static class GeneratedRouteBuilderExtensionsCore
{

Expand Down Expand Up @@ -571,6 +572,7 @@ namespace Microsoft.AspNetCore.Http.Generated

}

%GENERATEDCODEATTRIBUTE%
file sealed class GeneratedProducesResponseTypeMetadata : IProducesResponseTypeMetadata
{
public GeneratedProducesResponseTypeMetadata(Type? type, int statusCode, string[] contentTypes)
Expand All @@ -587,6 +589,7 @@ namespace Microsoft.AspNetCore.Http.Generated
public IEnumerable<string> ContentTypes { get; }
}

%GENERATEDCODEATTRIBUTE%
file static class GeneratedMetadataConstants
{
public static readonly string[] JsonContentType = new [] { "application/json" };
Expand All @@ -596,6 +599,7 @@ namespace Microsoft.AspNetCore.Http.Generated
}


%GENERATEDCODEATTRIBUTE%
file sealed class LogOrThrowExceptionHelper
{
private readonly ILogger? _rdgLogger;
Expand Down
Loading