Skip to content

Switch C# TargetFramework to netstandard2.0 #1901

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 0 additions & 1 deletion codegen-templates/csharp/types/struct.cs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ namespace Svix.Models {
sb.Append("}\n");
return sb.ToString();
}

}
}
6 changes: 3 additions & 3 deletions codegen-templates/csharp/types/struct_enum.cs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Svix.Models {
{
{% include "types/struct_fields.cs.jinja" %}
[JsonIgnore]
public required {{ enum_type_name }} {{ content_field_name }} { get; set; }
public {{ enum_type_name }} {{ content_field_name }} { get; set; }

[JsonProperty("{{ type.discriminator_field }}")]
private string {{ discriminator_field_name }} => Config.GetDiscriminator();
Expand Down Expand Up @@ -164,10 +164,10 @@ namespace Svix.Models {
{
{% include "types/struct_fields.cs.jinja" %}
[JsonProperty("{{ type.discriminator_field }}", Required = Required.Always)]
public required string {{ discriminator_field_name }} { get; set; }
public string {{ discriminator_field_name }} { get; set; }

[JsonProperty("{{ type.content_field }}", Required = Required.Always)]
public required JObject {{ content_field_name }} { get; set; }
public JObject {{ content_field_name }} { get; set; }

}

Expand Down
4 changes: 1 addition & 3 deletions codegen-templates/csharp/types/struct_fields.cs.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
{% set is_patch = type.name is endingwith "Patch" -%}
[JsonProperty("{{ field.name }}"{% if field.required and not field.nullable %},Required = Required.Always{% endif %})]
{% set f_ty = field.type.to_csharp() -%}
{% set modifier = "public"-%}
{% if field.nullable or not field.required -%}
{% set f_ty %}{{ f_ty }}?{% endset -%}
{% set f_val = "= null;" -%}
{% else -%}
{% set modifier %}{{ modifier }} required{% endset -%}
{% set f_val = "" -%}
{% endif -%}
{% if is_patch and field.nullable -%}
{% set f_ty %}MaybeUnset<{{ f_ty }}>{% endset -%}
{% set f_val %}= {{ f_ty }}.Unset();{% endset -%}
{% endif -%}
{{ modifier }} {{ f_ty }} {{ field.name | to_upper_camel_case }} { get; set; } {{ f_val }}
public {{ f_ty }} {{ field.name | to_upper_camel_case }} { get; set; } {{ f_val }}
{% if is_patch and field.nullable -%}
public bool ShouldSerialize{{ field.name | to_upper_camel_case }}() => !{{ field.name | to_upper_camel_case }}.IsUnset;
{% elif is_patch and not field.nullable -%}
Expand Down
2 changes: 1 addition & 1 deletion csharp/Svix/Models/AdobeSignConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class AdobeSignConfig
{
[JsonProperty("clientId", Required = Required.Always)]
public required string ClientId { get; set; }
public string ClientId { get; set; }

Check warning on line 10 in csharp/Svix/Models/AdobeSignConfig.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Non-nullable property 'ClientId' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

public override string ToString()
{
Expand Down
6 changes: 3 additions & 3 deletions csharp/Svix/Models/AggregateEventTypesOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
public class AggregateEventTypesOut
{
[JsonProperty("id", Required = Required.Always)]
public required string Id { get; set; }
public string Id { get; set; }

Check warning on line 10 in csharp/Svix/Models/AggregateEventTypesOut.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Non-nullable property 'Id' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

[JsonProperty("status", Required = Required.Always)]
public required BackgroundTaskStatus Status { get; set; }
public BackgroundTaskStatus Status { get; set; }

[JsonProperty("task", Required = Required.Always)]
public required BackgroundTaskType Task { get; set; }
public BackgroundTaskType Task { get; set; }

public override string ToString()
{
Expand Down
6 changes: 3 additions & 3 deletions csharp/Svix/Models/ApiTokenCensoredOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
public class ApiTokenCensoredOut
{
[JsonProperty("censoredToken", Required = Required.Always)]
public required string CensoredToken { get; set; }
public string CensoredToken { get; set; }

Check warning on line 10 in csharp/Svix/Models/ApiTokenCensoredOut.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Non-nullable property 'CensoredToken' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

[JsonProperty("createdAt", Required = Required.Always)]
public required DateTime CreatedAt { get; set; }
public DateTime CreatedAt { get; set; }

[JsonProperty("expiresAt")]
public DateTime? ExpiresAt { get; set; } = null;

[JsonProperty("id", Required = Required.Always)]
public required string Id { get; set; }
public string Id { get; set; }

Check warning on line 19 in csharp/Svix/Models/ApiTokenCensoredOut.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Non-nullable property 'Id' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

[JsonProperty("name")]
public string? Name { get; set; } = null;
Expand Down
2 changes: 1 addition & 1 deletion csharp/Svix/Models/ApiTokenIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class ApiTokenIn
{
[JsonProperty("name", Required = Required.Always)]
public required string Name { get; set; }
public string Name { get; set; }

Check warning on line 10 in csharp/Svix/Models/ApiTokenIn.cs

View workflow job for this annotation

GitHub Actions / C# Lint

Non-nullable property 'Name' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.

[JsonProperty("scopes")]
public List<string>? Scopes { get; set; } = null;
Expand Down
6 changes: 3 additions & 3 deletions csharp/Svix/Models/ApiTokenOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ namespace Svix.Models
public class ApiTokenOut
{
[JsonProperty("createdAt", Required = Required.Always)]
public required DateTime CreatedAt { get; set; }
public DateTime CreatedAt { get; set; }

[JsonProperty("expiresAt")]
public DateTime? ExpiresAt { get; set; } = null;

[JsonProperty("id", Required = Required.Always)]
public required string Id { get; set; }
public string Id { get; set; }

[JsonProperty("name")]
public string? Name { get; set; } = null;
Expand All @@ -22,7 +22,7 @@ public class ApiTokenOut
public List<string>? Scopes { get; set; } = null;

[JsonProperty("token", Required = Required.Always)]
public required string Token { get; set; }
public string Token { get; set; }

public override string ToString()
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/Svix/Models/AppPortalAccessOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ namespace Svix.Models
public class AppPortalAccessOut
{
[JsonProperty("token", Required = Required.Always)]
public required string Token { get; set; }
public string Token { get; set; }

[JsonProperty("url", Required = Required.Always)]
public required string Url { get; set; }
public string Url { get; set; }

public override string ToString()
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/Svix/Models/AppUsageStatsIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public class AppUsageStatsIn
public List<string>? AppIds { get; set; } = null;

[JsonProperty("since", Required = Required.Always)]
public required DateTime Since { get; set; }
public DateTime Since { get; set; }

[JsonProperty("until", Required = Required.Always)]
public required DateTime Until { get; set; }
public DateTime Until { get; set; }

public override string ToString()
{
Expand Down
8 changes: 4 additions & 4 deletions csharp/Svix/Models/AppUsageStatsOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace Svix.Models
public class AppUsageStatsOut
{
[JsonProperty("id", Required = Required.Always)]
public required string Id { get; set; }
public string Id { get; set; }

[JsonProperty("status", Required = Required.Always)]
public required BackgroundTaskStatus Status { get; set; }
public BackgroundTaskStatus Status { get; set; }

[JsonProperty("task", Required = Required.Always)]
public required BackgroundTaskType Task { get; set; }
public BackgroundTaskType Task { get; set; }

[JsonProperty("unresolvedAppIds", Required = Required.Always)]
public required List<string> UnresolvedAppIds { get; set; }
public List<string> UnresolvedAppIds { get; set; }

public override string ToString()
{
Expand Down
2 changes: 1 addition & 1 deletion csharp/Svix/Models/ApplicationIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ApplicationIn
public Dictionary<string, string>? Metadata { get; set; } = null;

[JsonProperty("name", Required = Required.Always)]
public required string Name { get; set; }
public string Name { get; set; }

[JsonProperty("rateLimit")]
public ushort? RateLimit { get; set; } = null;
Expand Down
10 changes: 5 additions & 5 deletions csharp/Svix/Models/ApplicationOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace Svix.Models
public class ApplicationOut
{
[JsonProperty("createdAt", Required = Required.Always)]
public required DateTime CreatedAt { get; set; }
public DateTime CreatedAt { get; set; }

[JsonProperty("id", Required = Required.Always)]
public required string Id { get; set; }
public string Id { get; set; }

[JsonProperty("metadata", Required = Required.Always)]
public required Dictionary<string, string> Metadata { get; set; }
public Dictionary<string, string> Metadata { get; set; }

[JsonProperty("name", Required = Required.Always)]
public required string Name { get; set; }
public string Name { get; set; }

[JsonProperty("rateLimit")]
public ushort? RateLimit { get; set; } = null;
Expand All @@ -25,7 +25,7 @@ public class ApplicationOut
public string? Uid { get; set; } = null;

[JsonProperty("updatedAt", Required = Required.Always)]
public required DateTime UpdatedAt { get; set; }
public DateTime UpdatedAt { get; set; }

public override string ToString()
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/Svix/Models/BackgroundTaskFinishedEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ namespace Svix.Models
public class BackgroundTaskFinishedEvent
{
[JsonProperty("data", Required = Required.Always)]
public required BackgroundTaskFinishedEvent2 Data { get; set; }
public BackgroundTaskFinishedEvent2 Data { get; set; }

[JsonProperty("type", Required = Required.Always)]
public required string Type { get; set; }
public string Type { get; set; }

public override string ToString()
{
Expand Down
8 changes: 4 additions & 4 deletions csharp/Svix/Models/BackgroundTaskFinishedEvent2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace Svix.Models
public class BackgroundTaskFinishedEvent2
{
[JsonProperty("data", Required = Required.Always)]
public required Object Data { get; set; }
public Object Data { get; set; }

[JsonProperty("status", Required = Required.Always)]
public required BackgroundTaskStatus Status { get; set; }
public BackgroundTaskStatus Status { get; set; }

[JsonProperty("task", Required = Required.Always)]
public required BackgroundTaskType Task { get; set; }
public BackgroundTaskType Task { get; set; }

[JsonProperty("taskId", Required = Required.Always)]
public required string TaskId { get; set; }
public string TaskId { get; set; }

public override string ToString()
{
Expand Down
8 changes: 4 additions & 4 deletions csharp/Svix/Models/BackgroundTaskOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ namespace Svix.Models
public class BackgroundTaskOut
{
[JsonProperty("data", Required = Required.Always)]
public required Object Data { get; set; }
public Object Data { get; set; }

[JsonProperty("id", Required = Required.Always)]
public required string Id { get; set; }
public string Id { get; set; }

[JsonProperty("status", Required = Required.Always)]
public required BackgroundTaskStatus Status { get; set; }
public BackgroundTaskStatus Status { get; set; }

[JsonProperty("task", Required = Required.Always)]
public required BackgroundTaskType Task { get; set; }
public BackgroundTaskType Task { get; set; }

public override string ToString()
{
Expand Down
6 changes: 3 additions & 3 deletions csharp/Svix/Models/ConnectorIn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public class ConnectorIn
public ConnectorKind? Kind { get; set; } = null;

[JsonProperty("logo", Required = Required.Always)]
public required string Logo { get; set; }
public string Logo { get; set; }

[JsonProperty("name", Required = Required.Always)]
public required string Name { get; set; }
public string Name { get; set; }

[JsonProperty("transformation", Required = Required.Always)]
public required string Transformation { get; set; }
public string Transformation { get; set; }

public override string ToString()
{
Expand Down
20 changes: 10 additions & 10 deletions csharp/Svix/Models/ConnectorOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ namespace Svix.Models
public class ConnectorOut
{
[JsonProperty("createdAt", Required = Required.Always)]
public required DateTime CreatedAt { get; set; }
public DateTime CreatedAt { get; set; }

[JsonProperty("description", Required = Required.Always)]
public required string Description { get; set; }
public string Description { get; set; }

[JsonProperty("featureFlag")]
public string? FeatureFlag { get; set; } = null;
Expand All @@ -19,31 +19,31 @@ public class ConnectorOut
public List<string>? FilterTypes { get; set; } = null;

[JsonProperty("id", Required = Required.Always)]
public required string Id { get; set; }
public string Id { get; set; }

[JsonProperty("instructions", Required = Required.Always)]
public required string Instructions { get; set; }
public string Instructions { get; set; }

[JsonProperty("instructionsLink")]
public string? InstructionsLink { get; set; } = null;

[JsonProperty("kind", Required = Required.Always)]
public required ConnectorKind Kind { get; set; }
public ConnectorKind Kind { get; set; }

[JsonProperty("logo", Required = Required.Always)]
public required string Logo { get; set; }
public string Logo { get; set; }

[JsonProperty("name", Required = Required.Always)]
public required string Name { get; set; }
public string Name { get; set; }

[JsonProperty("orgId", Required = Required.Always)]
public required string OrgId { get; set; }
public string OrgId { get; set; }

[JsonProperty("transformation", Required = Required.Always)]
public required string Transformation { get; set; }
public string Transformation { get; set; }

[JsonProperty("updatedAt", Required = Required.Always)]
public required DateTime UpdatedAt { get; set; }
public DateTime UpdatedAt { get; set; }

public override string ToString()
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/Svix/Models/CronConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public class CronConfig
public string? ContentType { get; set; } = null;

[JsonProperty("payload", Required = Required.Always)]
public required string Payload { get; set; }
public string Payload { get; set; }

[JsonProperty("schedule", Required = Required.Always)]
public required string Schedule { get; set; }
public string Schedule { get; set; }

public override string ToString()
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/Svix/Models/DashboardAccessOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ namespace Svix.Models
public class DashboardAccessOut
{
[JsonProperty("token", Required = Required.Always)]
public required string Token { get; set; }
public string Token { get; set; }

[JsonProperty("url", Required = Required.Always)]
public required string Url { get; set; }
public string Url { get; set; }

public override string ToString()
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/Svix/Models/EndpointCreatedEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ namespace Svix.Models
public class EndpointCreatedEvent
{
[JsonProperty("data", Required = Required.Always)]
public required EndpointCreatedEventData Data { get; set; }
public EndpointCreatedEventData Data { get; set; }

[JsonProperty("type", Required = Required.Always)]
public required string Type { get; set; }
public string Type { get; set; }

public override string ToString()
{
Expand Down
4 changes: 2 additions & 2 deletions csharp/Svix/Models/EndpointCreatedEventData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ namespace Svix.Models
public class EndpointCreatedEventData
{
[JsonProperty("appId", Required = Required.Always)]
public required string AppId { get; set; }
public string AppId { get; set; }

[JsonProperty("appUid")]
public string? AppUid { get; set; } = null;

[JsonProperty("endpointId", Required = Required.Always)]
public required string EndpointId { get; set; }
public string EndpointId { get; set; }

[JsonProperty("endpointUid")]
public string? EndpointUid { get; set; } = null;
Expand Down
Loading