Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vocabularymanager) analysis fails with scalar. issue 723 #724

Merged
merged 1 commit into from
Oct 3, 2023

Conversation

dselman
Copy link
Contributor

@dselman dselman commented Oct 2, 2023

Closes #723

Ensures that VocabularyManager.validate works with models containing scalars.

Changes

  • Defensive tests that declaration.getOwnProperties always returns at least []
  • Update tests to use versioned namespaces
  • Update tests and snapshots

Flags

Screenshots or Video

Related Issues

  • Issue #
  • Pull Request #

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

Signed-off-by: Dan Selman <danscode@selman.org>
@dselman dselman marked this pull request as ready for review October 2, 2023 16:09
@dselman dselman requested a review from a team October 2, 2023 16:09
Comment on lines 152 to +156
missingTerms: modelFile.getAllDeclarations().flatMap( d => this.getTerm(d.getName())
? d.getOwnProperties().flatMap( p => this.getTerm(d.getName(), p.getName()) ? null : `${d.getName()}.${p.getName()}`)
? getOwnProperties(d).flatMap( p => this.getTerm(d.getName(), p.getName()) ? null : `${d.getName()}.${p.getName()}`)
: d.getName() ).filter( i => i !== null),
additionalTerms: this.content.declarations.flatMap( k => modelFile.getLocalType(Object.keys(k)[0])
? k.properties ? k.properties.flatMap( p => modelFile.getLocalType(Object.keys(k)[0]).getOwnProperty(Object.keys(p)[0]) ? null : `${Object.keys(k)[0]}.${Object.keys(p)[0]}`) : null
? Array.isArray(k.properties) ? k.properties.flatMap( p => modelFile.getLocalType(Object.keys(k)[0]).getOwnProperty(Object.keys(p)[0]) ? null : `${Object.keys(k)[0]}.${Object.keys(p)[0]}`) : null
Copy link
Member

Choose a reason for hiding this comment

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

These ternary expressions are starting to get very difficult to read. Time for a refactor?

@dselman dselman merged commit c637f19 into main Oct 3, 2023
11 checks passed
@dselman dselman deleted the ds-fix-723 branch October 3, 2023 09:47
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.

Issue trying to validate declarations without properties
2 participants