Skip to content

feat: implemented new linting of entities to support new scorecards#2495

Merged
AlbinaBlazhko17 merged 28 commits intomainfrom
feat/new-scorecard-pitch
Feb 11, 2026
Merged

feat: implemented new linting of entities to support new scorecards#2495
AlbinaBlazhko17 merged 28 commits intomainfrom
feat/new-scorecard-pitch

Conversation

@AlbinaBlazhko17
Copy link
Contributor

@AlbinaBlazhko17 AlbinaBlazhko17 commented Jan 12, 2026

What/Why/How?

  • Implemented lintEntityWithScorecardLevel, which will be used in portal to lint new entities with new scorecard functionality.
  • Implemented lintSchema for linting specific schema. If entity has data-schema type we need to lint only provided schema.
  • Added support for Assertions (custom rules) in lintEntityFile.
  • The main goal of helper functions are to transform assertion subject to type, which is provided in @redocly/config.
  • Changed json-schema-adapter.ts to handle nodeTypeName if provided. Added returning of discriminatorFunc from adapter to get proper rootType. Added functionality to discriminatorFunc for handling mapping the default naming and provided nodeTypeName.
  • Fixed tests to match new structure.

Opened questions:

  • How to handle entities with the type of api-operations.
  • Adding support of custom rules for arrays. Currently, we don't have any Assertions (e.g. lt, lte, gte, etc.) for arrays.

Reference

Testing

Ran tests in CLI and Realm.

Screenshots (optional)

Check yourself

  • Code changed? - Tested with Redoc/Realm/Reunite (internal)
  • All new/updated code is covered by tests
  • New package installed? - Tested in different environments (browser/node)
  • Documentation update considered

Security

  • The security impact of the change has been considered
  • Code follows company security practices and guidelines

@changeset-bot
Copy link

changeset-bot bot commented Jan 12, 2026

🦋 Changeset detected

Latest commit: 1a28502

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@redocly/openapi-core Minor
@redocly/cli Minor
@redocly/respect-core Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

CLI Version Mean Time ± Std Dev (s) Relative Performance (Lower is Faster)
cli-latest 3.509s ± 0.038s ▓ 1.00x
cli-next 3.509s ± 0.035s ▓ 1.00x (Fastest)

@github-actions
Copy link
Contributor

github-actions bot commented Jan 13, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.4% (🎯 78%) 6313 / 7950
🔵 Statements 78.82% (🎯 78%) 6520 / 8271
🔵 Functions 83.32% (🎯 82%) 1294 / 1553
🔵 Branches 70.97% (🎯 70%) 4296 / 6053
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/lint-entity.ts 96.55% 80% 100% 96.49% 175, 179-181
packages/core/src/lint.ts 91.66% 84.21% 100% 91.42% 106-117, 140
packages/core/src/types/entity.ts 92.85% 75% 100% 92.3% 39
packages/core/src/types/json-schema-adapter.ts 85.41% 81.81% 100% 84.61% 22, 40, 44, 48, 52-54, 76, 80, 98, 106-108, 112-114, 159, 163, 167, 171-173
packages/core/src/types/redocly-yaml.ts 92.3% 82.85% 100% 91.93% 365-372, 374, 519-524, 527-532, 535-540
packages/core/src/utils/scorecards.ts 88.63% 83.33% 90% 90.69% 40, 79, 87, 98, 121-127
Generated in workflow #8591 for commit 1a28502 by the Vitest Coverage Report Action

@AlbinaBlazhko17 AlbinaBlazhko17 self-assigned this Jan 26, 2026
@AlbinaBlazhko17 AlbinaBlazhko17 marked this pull request as ready for review January 26, 2026 17:56
@AlbinaBlazhko17 AlbinaBlazhko17 requested review from a team as code owners January 26, 2026 17:56

// Store mapping from discriminator value to actual type name
if (typeof actualTypeName === 'string') {
discriminatorMapping[discriminatorValue] = actualTypeName;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why do we need to mutate it here. Don't we receive the discriminator mapping in the needed form already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added here this logic to return proper nodeName, so i can use the discriminator function without any additional logic. Without it i will pass e.g. 'domain' and this function will return 'domain' instead of 'DomainEntity'. I can remove this logic from the discriminator function, but in this case for me this function does not make sense. WDYT?

@AlbinaBlazhko17 AlbinaBlazhko17 force-pushed the feat/new-scorecard-pitch branch from 4257ecb to 0c4911a Compare February 11, 2026 08:03
@AlbinaBlazhko17 AlbinaBlazhko17 force-pushed the feat/new-scorecard-pitch branch from 260b5e9 to 1a28502 Compare February 11, 2026 10:59
@AlbinaBlazhko17 AlbinaBlazhko17 merged commit 1b2c901 into main Feb 11, 2026
40 checks passed
@AlbinaBlazhko17 AlbinaBlazhko17 deleted the feat/new-scorecard-pitch branch February 11, 2026 11:24
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.

3 participants