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

Implement schema presets #146

Merged
merged 35 commits into from
Apr 6, 2024
Merged

Implement schema presets #146

merged 35 commits into from
Apr 6, 2024

Conversation

SmetDenis
Copy link
Member

No description provided.

This commit addresses significant changes in several classes. In Schema.php, the constructor was refactored and stricter validation was added to handle the filename correctly. ValidatorSchema and SchemaDataPrep saw improvements in the way aliases are matched and validated. In Utils.php, added explicit casting to ensure the first array in mergeConfigs function is indeed an array. These changes combined improve the implementation of schema inheritance and make the code more readable and reliable.
The changes in various classes improve reliability and readability of the code. In Schema.php, a refactored constructor and stricter filename validation ensures correct file handling. Enhanced match and validation handling in ValidatorSchema and SchemaDataPrep improves alias processing. Furthermore, explicit casting in Utils.php's mergeConfigs function ensures reliable array handling.
@coveralls
Copy link

coveralls commented Apr 5, 2024

Pull Request Test Coverage Report for Build 8583732193

Details

  • 188 of 207 (90.82%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 96.68%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/Validators/ValidatorSchema.php 8 10 80.0%
src/Schema.php 40 44 90.91%
src/Commands/AbstractValidate.php 10 15 66.67%
src/SchemaDataPrep.php 81 89 91.01%
Totals Coverage Status
Change from base Build 8559776665: -0.2%
Covered Lines: 3058
Relevant Lines: 3163

💛 - Coveralls

Removed the 'inherit' attribute from different functions in 'SchemaDataPrep.php'. Both tests and examples have been updated to reflect these changes. This increases code readability and reliability, while reducing complexity.
The 'inherit' attribute has been replaced with 'preset' in the SchemaDataPrep class to align with new design decisions. Corresponding tests are updated to reflect these changes, ensuring the new attribute works expectedly. This change simplifies the codebase and improves readability.
The term 'includes' was replaced with 'presets' in multiple files including the SchemaDataPrep class, test files and schemas. This change was made to improve code readability and adherence to design decisions. The updates also ensure that tests properly validate the usage of the new terminology.
The term 'includes' was replaced with 'presets' in multiple files including the SchemaDataPrep class, test files and schemas. This change was made to improve code readability and adherence to design decisions. The updates also ensure that tests properly validate the usage of the new terminology.
@SmetDenis SmetDenis changed the title Implement schema inheritance Implement schema presets Apr 6, 2024
SmetDenis added 21 commits April 6, 2024 14:39
Two new schemas for sample and usage presets were added under the 'schema-examples' directory. These presets contain common validation rules for user data. In the ContainsNone rule, the error message was updated for better clarity by changing the phrase from containing "any of the following" to "the string". This makes it clear that a particular string is being contained, which improves readability and understandability of error messages.
The 'name' and 'description' fields in preset_usage.yml have been updated for better clarity. The 'name' field now specifies that it's a "Real schema with presets" and the 'description' field explains how the schema uses and overrides presets. These changes will aid in understanding the purpose and functionality of the presets.
The codebase has been refactored to allow the reuse of schemas through presets. This introduces flexibility, reduces redundancy, and enhances maintainability. The updated approach simplifies schema setup, propagates centralized updates to all dependent schemas, and maintains consistency across various CSV files and schemas. A comprehensive example demonstrating all available preset features has been included.
Removed the unnecessary YML content manipulation from the Readme test in ReadmeTest.php. Furthermore, updated the regex pattern for alias in presets in the README.md file to case insensitive, easing the matching process. Improved the readability of the description for the preset_database.yml.
Removed the unnecessary YML content manipulation from the Readme test in ReadmeTest.php. Furthermore, updated the regex pattern for alias in presets in the README.md file to case insensitive, easing the matching process. Improved the readability of the description for the preset_database.yml.
This commit streamlines the instructions and readability in the preset schema examples and README.md for improved comprehensibility. Unnecessary manipulations are removed from the Readme test, reducing visual clutter. Additionally, minor modifications have been made to the alias regex pattern in presets for better matching, enhancing the overall user experience. This update aims to reduce complexities and support better user understanding of pattern usage.
This commit refines text and instructions in README.md and the preset schema examples to enhance understanding and reduce complexity. Changes include removing unnecessary elements from the README text, and altering the regex pattern in the schema examples for improved match accuracy.
This commit refines text and instructions in README.md and the preset schema examples to enhance understanding and reduce complexity. Changes include removing unnecessary elements from the README text, and altering the regex pattern in the schema examples for improved match accuracy.
The preset usage in schema examples has been improved across json, php, and yml files. The corresponding documentation in README.md has been updated for better clarity and understanding. This change also fixes an issue with regex pattern matching while reducing complexity in schema preset utilization.
Modified Schema.php to handle potential exceptions during schema data preparation. This improves error handling by throwing an InvalidArgumentException with detailed information. Corresponding unit test for handling invalid preset file data has also been added in SchemaPresetTest.php. Minor text refinement was made in README.md.
Added an option to dump the final schema of the CSV file for inspection after all includes and inheritance. Implementation involves modification in Commands classes to use this new option, and within the Schema class to convert the schema data to a string in YAML format. Documentation and relevant test files have been updated to reflect this change.
The 'Important notes' header in the README file has been bolded to improve readability. A new troubleshooting section, 'If something went wrong,' has been added with instructions on how to dump and validate the schema.
Adjusted printDumpOfSchema to handle null schema and improve display of dumped schema in XML format. Moved calling of printDumpOfSchema method after possible exceptions in ValidateCsv. Also, clarified instructions for troubleshooting faulty presets in the README documentation.
Simplified preset settings in 'preset_features.yml' and 'preset_usage.yml' files by combining several lines into one. These changes enhance the readability and maintainability of the code. Additionally, alignments and comments in 'preset_features.yml' and README file were adjusted for consistency and better readability.
Simplified preset settings in 'preset_features.yml' and 'preset_usage.yml' files by combining several lines into one. These changes enhance the readability and maintainability of the code. Additionally, alignments and comments in 'preset_features.yml' and README file were adjusted for consistency and better readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
Added a new test in ReadmeTest to check if real examples of preset usage are correctly inserted in README. Updated README to offer users more detailed real-life example showcasing the benefits and scalability of using presets. The example is presented in an expandable details section for improved readability.
The GitHub Actions workflow has been updated with additional verification test steps. This includes adding "Checkout code", "Valid CSV files" and "Invalid CSV files" steps under the "Verify GitHub Actions - Scratch" job. The update aims to ensure valid code and correct CSV file handling.
The GitHub Actions workflow has been updated with additional verification test steps. This includes adding "Checkout code", "Valid CSV files" and "Invalid CSV files" steps under the "Verify GitHub Actions - Scratch" job. The update aims to ensure valid code and correct CSV file handling.
The GitHub Actions workflow has been updated with additional verification test steps. This includes adding "Checkout code", "Valid CSV files" and "Invalid CSV files" steps under the "Verify GitHub Actions - Scratch" job. The update aims to ensure valid code and correct CSV file handling.
@SmetDenis SmetDenis merged commit 7a40ce8 into master Apr 6, 2024
9 of 10 checks passed
@SmetDenis SmetDenis deleted the includes branch April 6, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants