Skip to content

Commit 4101258

Browse files
authored
ignore date length validation (#21217)
1 parent e22d079 commit 4101258

File tree

21 files changed

+46
-0
lines changed

21 files changed

+46
-0
lines changed

modules/openapi-generator/src/main/resources/csharp/validatable.mustache

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
{{#vars}}
6161
{{#hasValidation}}
6262
{{^isEnum}}
63+
{{^isDateTime}}
64+
{{^isDate}}
65+
{{^isTime}}
6366
{{#maxLength}}
6467
// {{{name}}} ({{{dataType}}}) maxLength
6568
if (this.{{{name}}} != null && this.{{{name}}}.Length > {{maxLength}})
@@ -76,6 +79,9 @@
7679
}
7780

7881
{{/minLength}}
82+
{{/isTime}}
83+
{{/isDate}}
84+
{{/isDateTime}}
7985
{{#maximum}}
8086
// {{{name}}} ({{{dataType}}}) maximum
8187
if ({{#useGenericHost}}{{^required}}this.{{{name}}}Option.IsSet && {{/required}}{{/useGenericHost}}this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} {{#exclusiveMaximum}}<={{/exclusiveMaximum}}{{^exclusiveMaximum}}>{{/exclusiveMaximum}} ({{{dataType}}}){{maximum}})

modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,6 +1747,8 @@ components:
17471747
type: string
17481748
format: date
17491749
example: '2020-02-02'
1750+
minLength: 1
1751+
maxLength: 1
17501752
dateTime:
17511753
type: string
17521754
format: date-time

samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,8 @@ components:
16371637
date:
16381638
example: 2020-02-02
16391639
format: date
1640+
maxLength: 1
1641+
minLength: 1
16401642
type: string
16411643
dateTime:
16421644
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,8 @@ components:
16371637
date:
16381638
example: 2020-02-02
16391639
format: date
1640+
maxLength: 1
1641+
minLength: 1
16401642
type: string
16411643
dateTime:
16421644
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,8 @@ components:
16371637
date:
16381638
example: 2020-02-02
16391639
format: date
1640+
maxLength: 1
1641+
minLength: 1
16401642
type: string
16411643
dateTime:
16421644
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1637,6 +1637,8 @@ components:
16371637
date:
16381638
example: 2020-02-02
16391639
format: date
1640+
maxLength: 1
1641+
minLength: 1
16401642
type: string
16411643
dateTime:
16421644
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,6 +1678,8 @@ components:
16781678
date:
16791679
example: 2020-02-02
16801680
format: date
1681+
maxLength: 1
1682+
minLength: 1
16811683
type: string
16821684
dateTime:
16831685
example: 2007-12-03T10:15:30+01:00

0 commit comments

Comments
 (0)