Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Format schema with oneOf doesn't work correctly #7055

@avkos

Description

@avkos
const schema = {
  type: 'object',
  properties: {
    from: {
      format: 'address',
    },
    to: {
      oneOf: [{ format: 'string' }, { type: 'null' }],
    },
  },
};

const data = {
  from: '0x7ed0e85b8e1e925600b4373e6d108f34ab38a401',
  to: 123,
};

const res = format(schema, data);

// res { from: '0x7ed0e85b8e1e925600b4373e6d108f34ab38a401', to: 123 }

Actual Behaviour:
to is not formatted

Expected Behaviour:
to should be formatted to a string

Metadata

Metadata

Assignees

No one assigned

    Labels

    4.x4.0 relatedBugAddressing a bugGood First IssueGreat to learn the internals of web3.js

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions