Skip to content

Commit

Permalink
fix json serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
CypherPotato committed Dec 7, 2023
1 parent 80dec77 commit a8ee5e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Http/Hosting/HttpServerHostContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ public class HttpServerHostContext
/// Gets the host <see cref="CrossOriginResourceSharingPolicy"/>.
/// </summary>
/// <definition>
/// public CrossOriginResourceSharingHeaders? CrossOriginResourceSharingPolicy { get; set; }
/// public CrossOriginResourceSharingHeaders CrossOriginResourceSharingPolicy { get; set; }
/// </definition>
/// <type>
/// Property
/// </type>
public CrossOriginResourceSharingHeaders? CrossOriginResourceSharingPolicy {
public CrossOriginResourceSharingHeaders CrossOriginResourceSharingPolicy {
get => HttpServer.ServerConfiguration.ListeningHosts[0].CrossOriginResourceSharingPolicy;
set => HttpServer.ServerConfiguration.ListeningHosts[0].CrossOriginResourceSharingPolicy = value;
}
Expand Down
15 changes: 8 additions & 7 deletions src/Internal/ServiceProvider/ConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,16 @@ internal static void ParseConfiguration(ProviderContext prov)
}
}

[JsonSerializable(typeof(ConfigStructureFile))]
internal class ConfigStructureFile
[JsonSerializable(typeof(JsonObject))]
[JsonSerializable(typeof(ConfigStructureFile__ServerConfiguration))]
[JsonSerializable(typeof(ConfigStructureFile__ListeningHost))]
internal partial class ConfigStructureFile : JsonSerializerContext
{
public ConfigStructureFile__ServerConfiguration? Server { get; set; } = null!;
public ConfigStructureFile__ListeningHost? ListeningHost { get; set; } = null!;
public JsonObject? Parameters { get; set; }
}

[JsonSerializable(typeof(ConfigStructureFile__ServerConfiguration))]
internal class ConfigStructureFile__ServerConfiguration
{
public string? AccessLogsStream { get; set; } = "console";
Expand All @@ -145,8 +146,8 @@ internal class ConfigStructureFile__ServerConfiguration
public bool ThrowExceptions { get; set; } = true;
}

[JsonSerializable(typeof(ConfigStructureFile__ListeningHost__CrossOriginResourceSharingPolicy))]
internal class ConfigStructureFile__ListeningHost__CrossOriginResourceSharingPolicy
[JsonSerializable(typeof(string[]))]
internal partial class ConfigStructureFile__ListeningHost__CrossOriginResourceSharingPolicy : JsonSerializerContext
{
public bool? AllowCredentials { get; set; } = null;
public string[]? ExposeHeaders { get; set; }
Expand All @@ -157,8 +158,8 @@ internal class ConfigStructureFile__ListeningHost__CrossOriginResourceSharingPol
public int? MaxAge { get; set; } = null;
}

[JsonSerializable(typeof(ConfigStructureFile__ListeningHost))]
internal class ConfigStructureFile__ListeningHost
[JsonSerializable(typeof(ConfigStructureFile__ListeningHost__CrossOriginResourceSharingPolicy))]
internal partial class ConfigStructureFile__ListeningHost : JsonSerializerContext
{
public string? Label { get; set; }
public string[]? Ports { get; set; }
Expand Down

0 comments on commit a8ee5e9

Please sign in to comment.