Skip to content

Commit

Permalink
Fix ConfigurationSchemaGenerator to use correct TimeSpan format (dotn…
Browse files Browse the repository at this point in the history
…et#3320)

* Fix ConfigurationSchemaGenerator to use correct TimeSpan format

'duration' isn't an acceptable description of how to represent a TimeSpan. Instead use a custom regular expression to represent TimeSpan formats.

* Add tests for the timespan regex.

* Fix outdated JSON config schema tests

* Fix more tests
  • Loading branch information
eerhardt authored and radical committed Apr 3, 2024
1 parent be60a0f commit 2dd9515
Show file tree
Hide file tree
Showing 23 changed files with 115 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@
"properties": {
"Delay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The delay between retry attempts for a fixed approach or the delay\non which to base calculations for a backoff-based approach.\nIf the service provides a Retry-After response header, the next retry will be delayed by the duration specified by the header value."
},
"MaxDelay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum permissible delay between retry attempts when the service does not provide a Retry-After response header.\nIf the service provides a Retry-After response header, the next retry will be delayed by the duration specified by the header value."
},
"MaxRetries": {
Expand All @@ -90,7 +90,7 @@
},
"NetworkTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The timeout applied to an individual network operations."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
"properties": {
"Delay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The delay between retry attempts for a fixed approach or the delay\non which to base calculations for a backoff-based approach.\nIf the service provides a Retry-After response header, the next retry will be delayed by the duration specified by the header value."
},
"MaxDelay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum permissible delay between retry attempts when the service does not provide a Retry-After response header.\nIf the service provides a Retry-After response header, the next retry will be delayed by the duration specified by the header value."
},
"MaxRetries": {
Expand All @@ -94,7 +94,7 @@
},
"NetworkTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The timeout applied to an individual network operations."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"properties": {
"ConnectionIdleTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The amount of time to allow a connection to have no observed traffic before considering\nit idle and eligible to close."
},
"CustomEndpointAddress": {
Expand Down Expand Up @@ -76,12 +76,12 @@
"properties": {
"Delay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The delay between retry attempts for a fixed approach or the delay\non which to base calculations for a backoff-based approach."
},
"MaximumDelay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum permissible delay between retry attempts."
},
"MaximumRetries": {
Expand All @@ -97,7 +97,7 @@
},
"TryTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum duration to wait for completion of a single attempt, whether the initial\nattempt or a retry."
}
},
Expand Down Expand Up @@ -140,7 +140,7 @@
"properties": {
"ConnectionIdleTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The amount of time to allow a connection to have no observed traffic before considering\nit idle and eligible to close."
},
"CustomEndpointAddress": {
Expand Down Expand Up @@ -175,12 +175,12 @@
"properties": {
"Delay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The delay between retry attempts for a fixed approach or the delay\non which to base calculations for a backoff-based approach."
},
"MaximumDelay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum permissible delay between retry attempts."
},
"MaximumRetries": {
Expand All @@ -196,7 +196,7 @@
},
"TryTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum duration to wait for completion of a single attempt, whether the initial\nattempt or a retry."
}
},
Expand Down Expand Up @@ -247,7 +247,7 @@
"properties": {
"ConnectionIdleTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The amount of time to allow a connection to have no observed traffic before considering\nit idle and eligible to close."
},
"CustomEndpointAddress": {
Expand Down Expand Up @@ -286,17 +286,17 @@
},
"LoadBalancingUpdateInterval": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The desired amount of time to allow between load balancing verification attempts."
},
"MaximumWaitTime": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum amount of time to wait for an event to become available for a given partition before emitting\nan empty event."
},
"PartitionOwnershipExpirationInterval": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The desired amount of time to consider a partition owned by a specific event processor\ninstance before the ownership is considered stale and the partition becomes eligible to be\nrequested by another event processor that wishes to assume responsibility for processing it."
},
"PrefetchCount": {
Expand All @@ -312,12 +312,12 @@
"properties": {
"Delay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The delay between retry attempts for a fixed approach or the delay\non which to base calculations for a backoff-based approach."
},
"MaximumDelay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum permissible delay between retry attempts."
},
"MaximumRetries": {
Expand All @@ -333,7 +333,7 @@
},
"TryTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum duration to wait for completion of a single attempt, whether the initial\nattempt or a retry."
}
},
Expand Down Expand Up @@ -380,7 +380,7 @@
"properties": {
"ConnectionIdleTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The amount of time to allow a connection to have no observed traffic before considering\nit idle and eligible to close."
},
"CustomEndpointAddress": {
Expand Down Expand Up @@ -408,7 +408,7 @@
},
"DefaultMaximumReceiveWaitTime": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The default amount of time to wait for the requested amount of messages when reading; if this\nperiod elapses before the requested amount of messages were available or read, then the set of\nmessages that were read will be returned."
},
"Identifier": {
Expand All @@ -432,12 +432,12 @@
"properties": {
"Delay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The delay between retry attempts for a fixed approach or the delay\non which to base calculations for a backoff-based approach."
},
"MaximumDelay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum permissible delay between retry attempts."
},
"MaximumRetries": {
Expand All @@ -453,7 +453,7 @@
},
"TryTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum duration to wait for completion of a single attempt, whether the initial\nattempt or a retry."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"properties": {
"ConnectionIdleTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The amount of time to allow a connection to have no observed traffic before considering\nit idle and eligible to close."
},
"CustomEndpointAddress": {
Expand All @@ -56,12 +56,12 @@
"properties": {
"Delay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The delay between retry attempts for a fixed approach or the delay\non which to base calculations for a backoff-based approach."
},
"MaxDelay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum permissible delay between retry attempts."
},
"MaxRetries": {
Expand All @@ -77,7 +77,7 @@
},
"TryTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum duration to wait for completion of a single attempt, whether the initial\nattempt or a retry."
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@
"properties": {
"Delay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The delay between retry attempts for a fixed approach or the delay\non which to base calculations for a backoff-based approach.\nIf the service provides a Retry-After response header, the next retry will be delayed by the duration specified by the header value."
},
"MaxDelay": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The maximum permissible delay between retry attempts when the service does not provide a Retry-After response header.\nIf the service provides a Retry-After response header, the next retry will be delayed by the duration specified by the header value."
},
"MaxRetries": {
Expand All @@ -93,7 +93,7 @@
},
"NetworkTimeout": {
"type": "string",
"format": "duration",
"pattern": "^-?(\\d{1,7}|((\\d{1,7}[\\.:])?(([01]?\\d|2[0-3]):[0-5]?\\d|([01]?\\d|2[0-3]):[0-5]?\\d:[0-5]?\\d)(\\.\\d{1,7})?))$",
"description": "The timeout applied to an individual network operations."
}
},
Expand Down
Loading

0 comments on commit 2dd9515

Please sign in to comment.