Skip to content

Conversation

@joente
Copy link
Member

@joente joente commented Oct 30, 2025

Description

This pull request allows defining nested structure in wrap type.

Consider the following structure:

set_type('M1', {
  id: '#',
  num: 'int',
}, true);

set_type('T1', {
  metrics: '&{M1}',
}, true, true);

set_type('C1', {
  x: '#',
  name: 'str',
  type: '&T1',
}, true);

In this scenario, we actually need "C1" to wrap an object and the types "T1" and "M1" are just defined because of the nested structure.

With this pull request implemented, we can write the above as the following:

set_type('C2', {
  x: '#',
  name: 'str',
  type: {
    metrics: [{
      id: '#',
      num: 'int',
    }],
  },
}, true);

Note that for each nested structure, in this case type and metrics, the & flag is implied. For the "id" to be returned, the # property must be explicitly defined, otherwise the type will be created with the "hide id" flag and it will not appear in the result.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • New test wrap nested

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes

@joente joente self-assigned this Oct 30, 2025
@joente joente merged commit e8951ff into main Oct 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants