Skip to content

fix(language): keep official schema serialization round-trippable#201

Merged
kgruszka merged 1 commit into
developfrom
fix/schema-official-roundtrip
Jun 5, 2026
Merged

fix(language): keep official schema serialization round-trippable#201
kgruszka merged 1 commit into
developfrom
fix/schema-official-roundtrip

Conversation

@kgruszka

@kgruszka kgruszka commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8693bd8ca3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread libs/language/src/lib/utils/NodeToMapListOrValue.ts Outdated
@kgruszka
kgruszka force-pushed the fix/schema-official-roundtrip branch from 8693bd8 to e516653 Compare June 5, 2026 23:31
@kgruszka
kgruszka merged commit ac1c553 into develop Jun 5, 2026
1 check failed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e516653838

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

valueConverter: ValueConverter,
): JsonValue {
return this.isPlainScalar(node)
? (valueConverter(node.getValue()) ?? nodeConverter(node))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve out-of-range numeric schema scalars

When a numeric schema keyword such as minimum is backed by a plain BigIntegerNumber outside JavaScript's safe range, NodeToMapListOrValue.handleValue converts it to a string, and this branch emits that string as the bare schema value. NodeDeserializer.validateSchemaKeywordShape only accepts a number or an explicit numeric scalar node for these keywords, so blue.nodeToJson() can now produce schema.minimum: "9007199254740992" that jsonValueToNode() rejects; fall back to the explicit node form whenever the converted scalar is not numeric.

Useful? React with 👍 / 👎.

valueConverter: ValueConverter,
): JsonValue {
return this.isPlainScalar(node)
? (valueConverter(node.getValue()) ?? nodeConverter(node))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve large numeric enum values as nodes

For schema.enum values that are plain large integers, this flattening path converts a BigIntegerNumber outside the safe JSON range into a string and emits it as a bare enum item. On readback that item is parsed as Text rather than Integer, whereas the previous per-node serialization would include the inferred Integer type, so round-tripping a numeric enum such as 9007199254740992 silently changes the allowed value's type.

Useful? React with 👍 / 👎.

Comment on lines +395 to +398
const value = node.getValue();
const type = node.getType();
if (isBigNumber(value) || typeof value === 'number') {
return type === undefined || NodeDeserializer.isNumericType(type);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept numeric schema nodes using type aliases

Explicit numeric schema constraints authored with the documented shorthand type: Integer and a quoted value are rejected here because getValue() only coerces strings when the type node carries the core type BlueId; for an inline alias it returns the raw string, so the numeric check fails before isNumericType(type) can recognize the alias. This makes valid inputs like schema.minimum: { type: Integer, value: "9007199254740992" } fail deserialization even though the validator is intended to allow explicit numeric scalar nodes.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant