Skip to content

Add a test for combinators and pass resolved subschema to createLabel#2165

Merged
sdirix merged 7 commits into
eclipsesource:masterfrom
DrewHoo:2164-fix-renderinfo-labels-for-anyOf-refs
Aug 8, 2023
Merged

Add a test for combinators and pass resolved subschema to createLabel#2165
sdirix merged 7 commits into
eclipsesource:masterfrom
DrewHoo:2164-fix-renderinfo-labels-for-anyOf-refs

Conversation

@DrewHoo

@DrewHoo DrewHoo commented Jul 18, 2023

Copy link
Copy Markdown
Contributor

Resolves #2164

  • Passes resolved subschema to createLabel so that label can actually use the title of the subschema
  • Adds a test for combinators that fails if the resolved schema isn't passed

@netlify

netlify Bot commented Jul 18, 2023

Copy link
Copy Markdown

Deploy Preview for jsonforms-examples ready!

Name Link
🔨 Latest commit 155c88b
🔍 Latest deploy log https://app.netlify.com/sites/jsonforms-examples/deploys/64d2c37e35412600080aff97
😎 Deploy Preview https://deploy-preview-2165--jsonforms-examples.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@CLAassistant

CLAassistant commented Jul 18, 2023

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@DrewHoo

DrewHoo commented Jul 26, 2023

Copy link
Copy Markdown
Contributor Author

Hi @sdirix do I need to do anything additional to get this PR reviewed?

@sdirix sdirix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @DrewHoo,

Thanks for the contribution!

While this fixes the use case of the test case, another use case is now broken:

{
  type: 'object',
  properties: {
    widget: {
      anyOf: [
        {
          title: 'DuaOverride',
          $ref: '#/definitions/Dua',
        },
        {
          title: 'LipaOverride',
          $ref: '#/definitions/Lipa',
        },
      ],
    },
  },
  definitions: {
    Dua: {
      title: 'Dua',
      type: 'object',
      properties: { name: { type: 'string' } },
    },
    Lipa: {
      title: 'Lipa',
      type: 'object',
      properties: { name: { type: 'string' } },
    },
  },
};

DuaOverride and LipaOverride are no longer considered.

We should check both title and use the outer one in case both exist.

@coveralls

coveralls commented Jul 26, 2023

Copy link
Copy Markdown

Coverage Status

coverage: 84.469% (+0.2%) from 84.254% when pulling 155c88b on DrewHoo:2164-fix-renderinfo-labels-for-anyOf-refs into d6f1fda on eclipsesource:master.

@DrewHoo

DrewHoo commented Jul 27, 2023

Copy link
Copy Markdown
Contributor Author

@sdirix Thanks for the suggestion! I added the test case you described and merged the two schemas before passing them to createLabel, giving the outer properties preference -- not sure if merged schema would also be appropriate for other places the sub-schema is used within the combinators function, so I only modified what's passed to createLabel.

@sdirix sdirix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good! one more small suggestion ;)

Comment thread packages/core/src/util/combinators.ts Outdated
@sdirix
sdirix merged commit 22d14d3 into eclipsesource:master Aug 8, 2023
@sdirix

sdirix commented Aug 8, 2023

Copy link
Copy Markdown
Member

@DrewHoo Thanks a lot for the contribution ❤️

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.

AnyOf subschemas defined in refs don't get correct labels from createCombinatorRenderInfos

4 participants