File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/dd-trace/src/datastreams/schemas Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,8 @@ class OpenApiComponents {
99
99
// This adds a single whitespace between entries without adding newlines.
100
100
// This differs from JSON.stringify and is used to align with the output
101
101
// in other platforms.
102
+ // TODO: Add tests to verify this behavior. A couple of cases are not
103
+ // covered by the existing tests.
102
104
function toJSON ( value ) {
103
105
// eslint-disable-next-line eslint-rules/eslint-safe-typeof-object
104
106
if ( typeof value === 'object' ) {
@@ -108,10 +110,12 @@ function toJSON (value) {
108
110
if ( Array . isArray ( value ) ) {
109
111
let result = '['
110
112
for ( let i = 0 ; i < value . length ; i ++ ) {
111
- if ( i > 0 ) {
112
- result += ', '
113
+ if ( value [ i ] !== null ) {
114
+ if ( i !== 0 ) {
115
+ result += ', '
116
+ }
117
+ result += value [ i ] === undefined ? 'null' : toJSON ( value [ i ] )
113
118
}
114
- result += value [ i ] == null ? 'null' : toJSON ( value [ i ] )
115
119
}
116
120
return `${ result } ]`
117
121
}
You can’t perform that action at this time.
0 commit comments