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

Filling gaps in config validation for rest settings for entities #1496

Merged
merged 271 commits into from
Jul 12, 2023

Conversation

ayush3797
Copy link
Contributor

@ayush3797 ayush3797 commented May 15, 2023

Why make this change?

There were a lot of validation failure cases that were not in place for runtime config validation and hence were not getting caught as mentioned in the issue: #1494. This PR addresses the same.

What is this change?

Added validations for the below mentioned cases for REST settings for entity:
path:

  1. it cannot have the same value for 2 different entities,
  2. It cannot be empty.
  3. It cannot contain any reserved characters

How was this tested?

  • Unit Tests

Removed some tests that weren't testing the CLI but dependencies (such as CommandLineParser or ILogger)
…them simpler and clearer with the new object structure
Moved logic for Entities defaults to RuntimeEntities rather than deserialiser, as that is a more logical place. We always pass that type around, so we can assume the ctor ran, but we aren't always assuming the deserialiser ran (such as what happens with tests)
Moving to a model where we load the config initially from disk and then generate an in-memory provider using an edited version of the config for the tests
Had introduced a regression that meant custom file names weren't supported on the engine directly. Now that can be passed to the RuntimeConfigLoader, otherwise the default filename is used. This means we're more flexible on the name of the file (useful in tests)
Singular/Plural were collapsed one level early, needed to nest them on a Type property
- Removing shared state as it can cause conflicts
- Better modeling of a config for the tests, and swapping in mock services
- Fixing the lookup for entities with the @model directive
Had forgotten to remove some old code in the deserializer of RuntimeEntities as well
Since there's a new dependency, Snapshooter, which isn't in the central package repo, we need to override NuGet and tell it to look for it elsewhere. This commit will be reverted when Snapshooter.MSTest is on the primary package feed
Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

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

lgtm. Just one nit from me and Ani's comments remain.

Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

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

question about alternative approach to creating record type properties just for lowercase string

Copy link
Contributor

@Aniruddh25 Aniruddh25 left a comment

Choose a reason for hiding this comment

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

LGTM, after resolving remaining comments.

@seantleonard seantleonard requested a review from aaronpowell July 11, 2023 20:58
@ayush3797 ayush3797 enabled auto-merge (squash) July 12, 2023 04:50
@Aniruddh25 Aniruddh25 dismissed aaronpowell’s stale review July 12, 2023 19:17

All the concerns have been resolved and the latest changes are building on top of PR #1402.

@ayush3797 ayush3797 merged commit 7c20fe2 into main Jul 12, 2023
@ayush3797 ayush3797 deleted the dev/agarwalayush/fillingGapsInConfigValidation branch July 12, 2023 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli validation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scenarios for rest path/methods not validated for entities
4 participants