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

Separate into required and optional attributes #20

Merged
merged 26 commits into from
Jun 6, 2024

Conversation

afuno
Copy link
Member

@afuno afuno commented May 18, 2024

No description provided.

afuno added 2 commits May 18, 2024 23:10
The commit enforces non-null values for 'number', 'value', 'quantity', 'status', 'title', 'code', and 'iso2' attributes across various models by replacing keywords such as 'string' and 'integer' with 'string!' and 'integer!'. Additionally, it has added the optional attribute 'link_url' to the rating model.
Extended the 'Season' model in 'season.rb' by adding the 'ended_on' attribute. Also updated the 'date!' and 'date?' methods in 'dsl.rb' to accommodate for the new attribute. Corresponding tests have been updated accordingly in 'serial_spec.rb'.
@afuno afuno added the feature label May 18, 2024
@afuno afuno added this to the v1.0.0 milestone May 18, 2024
@afuno afuno self-assigned this May 18, 2024
afuno added 23 commits May 18, 2024 23:25
The methods 'uuid', 'money', 'duration', 'time' and 'datetime' have been updated to use bang notation, indicating the operation will mutate their caller. The non-bang methods ('uuid', 'money', 'duration', 'time', and 'datetime') have been aliased to the bang methods and are expected to be deprecated in the future. The changes have been propagated to the Example1 and Example2 modules.
A comment about a needed update in the date? method has been clarified. Previously, the comment was just "FIXME," but it has now specifically indicated what needs to be fixed or updated: adding examples and tests.
This commit introduces optional support for one-to-many and many-to-many relationships in the Datory library. This includes adding new methods "one?" and "many?" to define these optional relationships. The attribute serialization and deserialization have been updated to handle these new cases. Test cases and examples have been adjusted accordingly.
This commit enables the commented out optional attribute 'lastEOLVersion' in files language.rb and language_spec.rb. It also accounts for this attribute during serialization and deserialization, preventing errors when the attribute is not passed. Tests have been updated accordingly to reflect these changes.
A TODO comment was added in language.rb under 'examples/usual/example3' directory to prepare a specific versions example. This example outlines a data structure for managing the current, maintenance, and end-of-life (EOL) versions.
Added TODO comments for implementing optional versions in uuid, money, duration, time, and datetime functions in the `datory/attributes/dsl.rb` file. This is a note to track the requirement of adding optional versions for these functionalities in the future updates.
This commit adds clarifying comments to instances where the attribute `link_url` is explicitly passed a `nil` value in the test cases from the `serial_spec.rb` file. This brings clarity to these instances, indicating that `nil` is an intentional and optional value.
In this commit, we disabled multiple Rubocop metrics in various classes and modules. These changes were made to correct Rubocop warnings without modifying the essential codebase. It involves three files: dsl.rb, serial_spec.rb and attribute.rb. The Rubocop metrics disabled include Metrics/ModuleLength, Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, and Metrics/PerceivedComplexity. Minor syntax corrections were made in serial_spec.rb.
The ID values used in the 'perform.update' and 'perform.update_by' method calls within the aggregate_failures tests in language_spec.rb have been updated. This change ensures that the tests reflect the current state of the code and the actual IDs in use.
Updated the attribute method calls from 'string' to 'string!', 'integer' to 'integer!', introduced a 'money?' for optional money, and updated associated tests. This commit also makes 'date' optional, and adds 'discount' to the product example and its tests.
The Gemfile.lock file has been updated to reflect the latest version of several dependencies. Notable updates include activesupport, bigdecimal, i18n, minitest, servactory, and zeitwerk. Be sure to run a 'bundle install' to sync your environment with these changes.
An optional `duration` attribute has been added to the product model, allowing for a possible installment duration attribute. This attribute allows for either a String or NilClass, and it can be converted into an ActiveSupport::Duration or NilClass. Tests and examples have been modified accordingly to reflect this new change.
Replaced string! method with attribute in date!, time!, and datetime!. This change ensures appropriate attribute type is linked to its corresponding method, improving code readability and accuracy.
An optional version for the `uuid` has been implemented in the `dsl.rb` file. This new version, `uuid?`, takes `name` and `options` as arguments and merges `format: :uuid` into the `options` for processing.
Updated variable names in the language_spec.rb test file. The variables 'product' and 'products' have been replaced with 'language' and 'languages', respectively, to match the context of the module being tested.
This commit introduces the Comment model in the Usual Example4 module along with comprehensive tests. Also included are serialization, deserialization functions and their tests. The model includes three attributes: id, parentId and content.
The codebase now includes an optional datetime attribute called 'publishedAt' to the Comment model. Also made corresponding adjustments in the spec and DSL files to handle the possible lack of this attribute. To handle nil values, conditional checking is added before calling the transformations in the builder service file.
The 'editedAt' field has been added to 'comment' model as optional. It represents the time when a comment was last edited. Corresponding changes have been made to the tests and the attributes/dsl file to accommodate this new field.
The DSL file has been updated to handle null date attributes. The 'date?' method now includes NilClass in its list of acceptable formats, allowing for attributes to have null dates. In order to reflect this change, the 'language_spec.rb' and 'version.rb' files have also been updated. This change should improve data handling in code sections dealing with date attributes.
The update will handle optional attributes during deserialization in the builder service. If the attribute type is an array (indicating an optional attribute), the NilClass is excluded to correctly fetch the type transformation.
There were changes in the table format of 'Usual::Example1::Season' in serial_spec.rb to improve readability. This included widening the table columns and updating the type value of 'ended_on' attribute from 'Date' to '[Date, NilClass]'.
Modified two return conditions within the 'workspace.rb' and 'attribute.rb' files. A clarifying note has been added to notify that these conditions will return nil when the pertinent 'one' parameter is optional and not provided, helping improving code understandability.
@afuno afuno marked this pull request as ready for review May 19, 2024 15:56
In both product.rb and product_spec.rb, the attribute 'installment_duration' has been changed to 'installmentDuration' to maintain consistent case style across the entire codebase. All occurrences and references to 'installment_duration' have been replaced with 'installmentDuration', with care taken to modify test cases and output as well.
@afuno afuno merged commit c9d615e into main Jun 6, 2024
26 checks passed
@afuno afuno deleted the features/SRV-131/optional branch June 6, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant