Skip to content

Commit bc9ea55

Browse files
committed
[js] Update cddl to 0.21.0 to fix quoted reserved-word parsing in BiDi codegen
1 parent 3936678 commit bc9ea55

4 files changed

Lines changed: 16 additions & 21 deletions

File tree

‎javascript/selenium-webdriver/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
},
3131
"devDependencies": {
3232
"@eslint/js": "^10.0.1",
33-
"cddl": "^0.20.1",
34-
"cddl2ts": "^0.9.1",
33+
"cddl": "^0.21.0",
34+
"cddl2ts": "^0.10.0",
3535
"clean-jsdoc-theme": "^4.3.2",
3636
"eslint": "^10.5.0",
3737
"eslint-config-prettier": "^10.1.8",

‎javascript/selenium-webdriver/project_bidi_schema.mjs‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ function projectRef(type) {
9292
// catches it instead of silently producing a valid-looking `null`.
9393
if (all.length === 0) return { primitive: 'unknown' }
9494
const entries = all.filter((e) => !isNullAlt(e))
95-
// The only sole-`null` field in the spec is NullValue.type, whose CDDL source is
96-
// the quoted string literal "null" (its discriminator tag); the cddl parser strips
97-
// the quotes, collapsing it to the bareword null type. Genuine nullability is
98-
// always `X / null` (handled below), so a sole null here is that string tag.
99-
if (entries.length === 0) return { const: 'null' }
10095
const node =
10196
entries.length > 1
10297
? entries.every(isLiteral)

‎javascript/selenium-webdriver/project_bidi_schema_test.mjs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,16 @@ describe('unionSelector', () => {
226226
union('x.Value', ['x.Prim', 'x.Date', 'x.Reference']),
227227
union('x.Prim', ['x.StringValue', 'x.NullValue']),
228228
recAst('x.StringValue', 'string'),
229-
{ ...recAst('x.NullValue', null), Properties: [field('type', ['null'])] },
229+
recAst('x.NullValue', 'null'),
230230
recAst('x.Date', 'date'),
231231
group('x.Reference', [field('refId', ['text'])]),
232232
]
233233
const s = projectSchema(ast, {})
234234
const sel = s.types['x.Value'].selector
235235
assert.equal(sel.by, 'type')
236236
assert.equal(sel.default, 'x.Reference')
237-
// A sole bareword `null` field is the quoted string tag "null", not the JSON
238-
// null type, so NullValue dispatches on the string "null" (not JSON null).
237+
// NullValue's `type` is the string literal "null" (its discriminator tag), so it
238+
// dispatches on the string "null" — not the JSON null type.
239239
assert.deepEqual(s.types['x.NullValue'].fields[0].type, { const: 'null' })
240240
assert.deepEqual(
241241
new Map(sel.variants.map((v) => [JSON.stringify(v.value), v.ref])),

‎pnpm-lock.yaml‎

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)