Skip to content
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

Use multiline comments for examples in csharp generator #19079

Merged
merged 2 commits into from
Sep 22, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace {{packageName}}.Models
/// <value>{{.}}</value>
{{/description}}
{{#example}}
/// <example>{{.}}</example>
/* <example>{{.}}</example> */
{{/example}}
{{#required}}
[Required]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace {{modelPackage}}
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}{{#example}}
/// <example>{{.}}</example>{{/example}}{{#required}}
/* <example>{{.}}</example> */{{/example}}{{#required}}
[Required]{{/required}}{{#pattern}}
[RegularExpression("{{{.}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}
[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ namespace {{modelPackage}}
/// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}}
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}{{#example}}
/// <example>{{.}}</example>{{/example}}{{#required}}
/* <example>{{.}}</example> */{{/example}}{{#required}}
[Required]{{/required}}{{#pattern}}
[RegularExpression("{{{.}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}
[StringLength({{maxLength}}, MinimumLength={{minLength}})]{{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/// <value>{{description}}</value>
{{/description}}
{{#example}}
/// <example>{{.}}</example>
/* <example>{{.}}</example> */
{{/example}}
{{^conditionalSerialization}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#required}}true{{/required}}{{^required}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/required}}{{/vendorExtensions.x-emit-default-value}})]
Expand Down Expand Up @@ -183,7 +183,7 @@
/// </summary>{{#description}}
/// <value>{{description}}</value>{{/description}}
{{#example}}
/// <example>{{.}}</example>
/* <example>{{.}}</example> */
{{/example}}
{{^conditionalSerialization}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#required}}true{{/required}}{{^required}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/required}}{{/vendorExtensions.x-emit-default-value}})]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
/// <value>{{.}}</value>
{{/description}}
{{#example}}
/// <example>{{.}}</example>
/* <example>{{.}}</example> */
{{/example}}
[JsonPropertyName("{{baseName}}")]
{{#deprecated}}
Expand All @@ -136,7 +136,7 @@
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{#example}}
/// <example>{{.}}</example>
/* <example>{{.}}</example> */
{{/example}}
{{#deprecated}}
[Obsolete]
Expand All @@ -152,7 +152,7 @@
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{#example}}
/// <example>{{.}}</example>
/* <example>{{.}}</example> */
{{/example}}
{{#deprecated}}
[Obsolete]
Expand Down Expand Up @@ -193,7 +193,7 @@
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{#example}}
/// <example>{{.}}</example>
/* <example>{{.}}</example> */
{{/example}}
[JsonPropertyName("{{baseName}}")]
{{#deprecated}}
Expand All @@ -218,7 +218,7 @@
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{#example}}
/// <example>{{.}}</example>
/* <example>{{.}}</example> */
{{/example}}
[JsonPropertyName("{{baseName}}")]
{{#deprecated}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
/// <value>{{.}}</value>
{{/description}}
{{#example}}
/// <example>{{.}}</example>
/*
<example>{{.}}</example>
*/
{{/example}}
{{^conditionalSerialization}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#required}}true{{/required}}{{^required}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/required}}{{/vendorExtensions.x-emit-default-value}})]
Expand Down Expand Up @@ -214,7 +216,9 @@
/// </summary>{{#description}}
/// <value>{{.}}</value>{{/description}}
{{#example}}
/// <example>{{.}}</example>
/*
<example>{{.}}</example>
*/
{{/example}}
{{^conditionalSerialization}}
[DataMember(Name = "{{baseName}}"{{#required}}, IsRequired = true{{/required}}, EmitDefaultValue = {{#vendorExtensions.x-emit-default-value}}true{{/vendorExtensions.x-emit-default-value}}{{^vendorExtensions.x-emit-default-value}}{{#required}}true{{/required}}{{^required}}{{#isBoolean}}true{{/isBoolean}}{{^isBoolean}}{{#isNullable}}true{{/isNullable}}{{^isNullable}}false{{/isNullable}}{{/isBoolean}}{{/required}}{{/vendorExtensions.x-emit-default-value}})]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@ public partial class Category : IEquatable<Category>, IValidatableObject
/// <summary>
/// Gets or Sets Id
/// </summary>
/// <example>1</example>
/*
<example>1</example>
*/
[DataMember(Name = "id", EmitDefaultValue = false)]
public long Id { get; set; }

/// <summary>
/// Gets or Sets Name
/// </summary>
/// <example>Dogs</example>
/*
<example>Dogs</example>
*/
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
/// Some text containing white spaces
/// </summary>
/// <value>Some text containing white spaces</value>
/// <example>Some text</example>
/*
<example>Some text</example>
*/
[DataMember(Name = "text", EmitDefaultValue = false)]
public string Text { get; set; }

Expand Down Expand Up @@ -128,7 +130,7 @@
) && base.Equals(input) &&
(
this.Date == input.Date ||
(this.Date != null &&

Check warning on line 133 in samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/DataQuery.cs

View workflow job for this annotation

GitHub Actions / Build .Net clients (samples/client/echo_api/csharp-restsharp/)

The result of the expression is always 'true' since a value of type 'DateTime' is never equal to 'null' of type 'DateTime?'

Check warning on line 133 in samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/DataQuery.cs

View workflow job for this annotation

GitHub Actions / Build .Net clients (samples/client/echo_api/csharp-restsharp/)

The result of the expression is always 'true' since a value of type 'DateTime' is never equal to 'null' of type 'DateTime?'
this.Date.Equals(input.Date))
);
}
Expand All @@ -150,7 +152,7 @@
{
hashCode = (hashCode * 59) + this.Text.GetHashCode();
}
if (this.Date != null)

Check warning on line 155 in samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/DataQuery.cs

View workflow job for this annotation

GitHub Actions / Build .Net clients (samples/client/echo_api/csharp-restsharp/)

The result of the expression is always 'true' since a value of type 'DateTime' is never equal to 'null' of type 'DateTime?'

Check warning on line 155 in samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/DataQuery.cs

View workflow job for this annotation

GitHub Actions / Build .Net clients (samples/client/echo_api/csharp-restsharp/)

The result of the expression is always 'true' since a value of type 'DateTime' is never equal to 'null' of type 'DateTime?'
{
hashCode = (hashCode * 59) + this.Date.GetHashCode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,18 @@ protected Pet() { }
/// <summary>
/// Gets or Sets Id
/// </summary>
/// <example>10</example>
/*
<example>10</example>
*/
[DataMember(Name = "id", EmitDefaultValue = false)]
public long Id { get; set; }

/// <summary>
/// Gets or Sets Name
/// </summary>
/// <example>doggie</example>
/*
<example>doggie</example>
*/
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ public partial class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectPa
/// <summary>
/// Gets or Sets Id
/// </summary>
/// <example>1</example>
/*
<example>1</example>
*/
[DataMember(Name = "id", EmitDefaultValue = false)]
public long Id { get; set; }

/// <summary>
/// Gets or Sets Name
/// </summary>
/// <example>Dogs</example>
/*
<example>Dogs</example>
*/
[DataMember(Name = "name", EmitDefaultValue = false)]
public string Name { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public DateOnlyClass(Option<DateTime?> dateOnlyProperty = default)
/// <summary>
/// Gets or Sets DateOnlyProperty
/// </summary>
/// <example>Fri Jul 21 00:00:00 UTC 2017</example>
/* <example>Fri Jul 21 00:00:00 UTC 2017</example> */
[JsonPropertyName("dateOnlyProperty")]
public DateTime? DateOnlyProperty { get { return this.DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new Option<DateTime?>(value); } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public FormatTest(byte[] @byte, DateTime date, decimal number, string password,
/// <summary>
/// Gets or Sets Date
/// </summary>
/// <example>Sun Feb 02 00:00:00 UTC 2020</example>
/* <example>Sun Feb 02 00:00:00 UTC 2020</example> */
[JsonPropertyName("date")]
public DateTime Date { get; set; }

Expand Down Expand Up @@ -126,7 +126,7 @@ public FormatTest(byte[] @byte, DateTime date, decimal number, string password,
/// <summary>
/// Gets or Sets DateTime
/// </summary>
/// <example>2007-12-03T10:15:30+01:00</example>
/* <example>2007-12-03T10:15:30+01:00</example> */
[JsonPropertyName("dateTime")]
public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new Option<DateTime?>(value); } }

Expand Down Expand Up @@ -299,7 +299,7 @@ public FormatTest(byte[] @byte, DateTime date, decimal number, string password,
/// <summary>
/// Gets or Sets Uuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("uuid")]
public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<Guid?>(value); } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public NullableGuidClass(Option<Guid?> uuid = default)
/// <summary>
/// Gets or Sets Uuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("uuid")]
public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<Guid?>(value); } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public Order(Option<bool?> complete = default, Option<long?> id = default, Optio
/// <summary>
/// Gets or Sets ShipDate
/// </summary>
/// <example>2020-02-02T20:20:20.000222Z</example>
/* <example>2020-02-02T20:20:20.000222Z</example> */
[JsonPropertyName("shipDate")]
public DateTime? ShipDate { get { return this.ShipDateOption; } set { this.ShipDateOption = new Option<DateTime?>(value); } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public Pet(string name, List<string> photoUrls, Option<Category> category = defa
/// <summary>
/// Gets or Sets Name
/// </summary>
/// <example>doggie</example>
/* <example>doggie</example> */
[JsonPropertyName("name")]
public string Name { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List<string> required
/// <summary>
/// Gets or Sets RequiredNotnullableUuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("required_notnullable_uuid")]
public Guid RequiredNotnullableUuid { get; set; }

Expand Down Expand Up @@ -437,7 +437,7 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List<string> required
/// <summary>
/// Gets or Sets NotrequiredNotnullableUuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("notrequired_notnullable_uuid")]
public Guid? NotrequiredNotnullableUuid { get { return this.NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new Option<Guid?>(value); } }

Expand Down Expand Up @@ -503,7 +503,7 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List<string> required
/// <summary>
/// Gets or Sets NotrequiredNullableUuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("notrequired_nullable_uuid")]
public Guid? NotrequiredNullableUuid { get { return this.NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new Option<Guid?>(value); } }

Expand Down Expand Up @@ -546,7 +546,7 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List<string> required
/// <summary>
/// Gets or Sets RequiredNullableUuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("required_nullable_uuid")]
public Guid? RequiredNullableUuid { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public DateOnlyClass(Option<DateTime?> dateOnlyProperty = default)
/// <summary>
/// Gets or Sets DateOnlyProperty
/// </summary>
/// <example>Fri Jul 21 00:00:00 UTC 2017</example>
/* <example>Fri Jul 21 00:00:00 UTC 2017</example> */
[JsonPropertyName("dateOnlyProperty")]
public DateTime? DateOnlyProperty { get { return this.DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new Option<DateTime?>(value); } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public FormatTest(byte[] @byte, DateTime date, decimal number, string password,
/// <summary>
/// Gets or Sets Date
/// </summary>
/// <example>Sun Feb 02 00:00:00 UTC 2020</example>
/* <example>Sun Feb 02 00:00:00 UTC 2020</example> */
[JsonPropertyName("date")]
public DateTime Date { get; set; }

Expand Down Expand Up @@ -126,7 +126,7 @@ public FormatTest(byte[] @byte, DateTime date, decimal number, string password,
/// <summary>
/// Gets or Sets DateTime
/// </summary>
/// <example>2007-12-03T10:15:30+01:00</example>
/* <example>2007-12-03T10:15:30+01:00</example> */
[JsonPropertyName("dateTime")]
public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new Option<DateTime?>(value); } }

Expand Down Expand Up @@ -299,7 +299,7 @@ public FormatTest(byte[] @byte, DateTime date, decimal number, string password,
/// <summary>
/// Gets or Sets Uuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("uuid")]
public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<Guid?>(value); } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public NullableGuidClass(Option<Guid?> uuid = default)
/// <summary>
/// Gets or Sets Uuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("uuid")]
public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new Option<Guid?>(value); } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value)
/// <summary>
/// Gets or Sets ShipDate
/// </summary>
/// <example>2020-02-02T20:20:20.000222Z</example>
/* <example>2020-02-02T20:20:20.000222Z</example> */
[JsonPropertyName("shipDate")]
public DateTime? ShipDate { get { return this.ShipDateOption; } set { this.ShipDateOption = new Option<DateTime?>(value); } }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value)
/// <summary>
/// Gets or Sets Name
/// </summary>
/// <example>doggie</example>
/* <example>doggie</example> */
[JsonPropertyName("name")]
public string Name { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableE
/// <summary>
/// Gets or Sets RequiredNotnullableUuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("required_notnullable_uuid")]
public Guid RequiredNotnullableUuid { get; set; }

Expand Down Expand Up @@ -1515,7 +1515,7 @@ public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableE
/// <summary>
/// Gets or Sets NotrequiredNotnullableUuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("notrequired_notnullable_uuid")]
public Guid? NotrequiredNotnullableUuid { get { return this.NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new Option<Guid?>(value); } }

Expand Down Expand Up @@ -1581,7 +1581,7 @@ public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableE
/// <summary>
/// Gets or Sets NotrequiredNullableUuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("notrequired_nullable_uuid")]
public Guid? NotrequiredNullableUuid { get { return this.NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new Option<Guid?>(value); } }

Expand Down Expand Up @@ -1624,7 +1624,7 @@ public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableE
/// <summary>
/// Gets or Sets RequiredNullableUuid
/// </summary>
/// <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example>
/* <example>72f98069-206d-4f12-9f12-3d1e525a8e84</example> */
[JsonPropertyName("required_nullable_uuid")]
public Guid? RequiredNullableUuid { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public DateOnlyClass(Option<DateTime?> dateOnlyProperty = default)
/// <summary>
/// Gets or Sets DateOnlyProperty
/// </summary>
/// <example>Fri Jul 21 00:00:00 UTC 2017</example>
/* <example>Fri Jul 21 00:00:00 UTC 2017</example> */
[JsonPropertyName("dateOnlyProperty")]
public DateTime? DateOnlyProperty { get { return this.DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new Option<DateTime?>(value); } }

Expand Down
Loading
Loading