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

Seperates Create & Update Request Schema and Updates Documentations #1

Open
wants to merge 87 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
4321390
Updates .gitignore
muhammadnawzad Jul 28, 2023
c12bdc8
Updates attributes in excluded_request_attributes generated method
muhammadnawzad Jul 28, 2023
33d42c8
Fixes bug where required attributes were not caught properly due case…
muhammadnawzad Jul 29, 2023
55c7ec7
Separates create and update request schema and prettifies documentations
muhammadnawzad Jul 29, 2023
ec3a318
Separates create and update excluded request attributes on file gener…
muhammadnawzad Jul 29, 2023
64f81a3
Updates version
muhammadnawzad Jul 29, 2023
9f6ecb9
Fixes rubocop offenses
muhammadnawzad Jul 29, 2023
cddc117
Uses configs to check whether to use string or number for decimal and…
muhammadnawzad Sep 26, 2023
6715712
Updates gem version
muhammadnawzad Sep 26, 2023
7396dde
Updates Rubocop
muhammadnawzad Nov 8, 2023
923f3eb
Adds SchemaModifier Class
muhammadnawzad Nov 9, 2023
01049c4
Adds Configuration class for global configurations
muhammadnawzad Nov 9, 2023
bfdf652
Adds Constants module to store constants
muhammadnawzad Nov 9, 2023
5a0efd1
Uses any for values of a Hash in .rbs files
muhammadnawzad Nov 9, 2023
bda6e08
Adds custom_defined_enum_method config to global configs
muhammadnawzad Nov 9, 2023
33c2ef4
Adds use_serialized_instance config
muhammadnawzad Nov 9, 2023
213fece
Adds AttributeSchemaGenerator class
muhammadnawzad Nov 9, 2023
15fae70
Updates method names and generate_attributes_schema's logic
muhammadnawzad Nov 9, 2023
00c4b7f
Invokes attributes from @model_definition
muhammadnawzad Nov 9, 2023
cab9577
Moves types map into configuration
muhammadnawzad Nov 9, 2023
b4e995a
Temporarily Updates Schemable Module
muhammadnawzad Nov 9, 2023
8e3cd6e
Adds incomplete Definitions class
muhammadnawzad Nov 9, 2023
dd7598b
Adds configurations to infer attributes from
muhammadnawzad Nov 9, 2023
01d459b
Updates Definition Class
muhammadnawzad Nov 9, 2023
8b00983
Deletes Blanks
muhammadnawzad Nov 9, 2023
b480c82
Sets configurations by default
muhammadnawzad Nov 10, 2023
0118d57
Sets configuration by default
muhammadnawzad Nov 10, 2023
0da8634
Adds Relationship Generator Class
muhammadnawzad Nov 10, 2023
b03fcc6
Uses model_name as an instance method
muhammadnawzad Nov 10, 2023
21d601e
No need to pass in configuration instance on definition descendant in…
muhammadnawzad Nov 10, 2023
e046194
Adds included schema generator
muhammadnawzad Nov 12, 2023
e2ba1a7
Updates RelationshipSchemaGenerator to correctly generate schemas
muhammadnawzad Nov 12, 2023
861a740
Renames method
muhammadnawzad Nov 12, 2023
15fb52e
Passes parameters to the function on invoke rather than on class init…
muhammadnawzad Nov 12, 2023
2d7dd77
Adds ResponseSchemaGenerator Class
muhammadnawzad Nov 12, 2023
215c101
Properly adds meta and jsonapi
muhammadnawzad Nov 12, 2023
159dfc5
Properly adds relationships
muhammadnawzad Nov 12, 2023
5d80d66
Includes IncludedSchemaGenerator in Schemable
muhammadnawzad Nov 12, 2023
ac70f1e
Adds RequestSchemaGenerator class
muhammadnawzad Nov 12, 2023
92d9f33
Changes Exclude Logic
muhammadnawzad Nov 12, 2023
e25dfff
Adds Camelize Keys Method to Definitions
muhammadnawzad Nov 12, 2023
06aafcf
Speeds up the definition's retrieval
muhammadnawzad Nov 13, 2023
2b57b1e
Adds mongoid specific configurations
muhammadnawzad Nov 13, 2023
5a630a7
Adds mongoid specific conditions
muhammadnawzad Nov 13, 2023
1d9e06a
Adds missing signature
muhammadnawzad Nov 13, 2023
a9fbe3e
Updates Schemable Module
muhammadnawzad Nov 13, 2023
dcfc80d
Adds generate method
muhammadnawzad Nov 13, 2023
b8928ee
Uses attribute reader instead of accessor
muhammadnawzad Nov 13, 2023
d7d260f
Updates Gem Version
muhammadnawzad Nov 14, 2023
a832924
Updates some of the old documentations
muhammadnawzad Nov 14, 2023
ac5a10e
Slightly Updates Readme
muhammadnawzad Nov 14, 2023
2e8cb4b
Add documentation for Schemable module
muhammadnawzad Nov 16, 2023
86e208d
Add documentation for SchemaModifier class
muhammadnawzad Nov 16, 2023
e75e18c
Add documentation for Configuration class
muhammadnawzad Nov 16, 2023
c4a2af5
Add documentation for AttributeSchemaGenerator class
muhammadnawzad Nov 16, 2023
f95b047
Fixes Indentation
muhammadnawzad Nov 16, 2023
26ec4d9
Adds documentations for definition class
muhammadnawzad Nov 17, 2023
dc89944
Fixes typos and ensures type safety
muhammadnawzad Nov 17, 2023
6908df3
Ensures type safety
muhammadnawzad Nov 17, 2023
6fa863a
Removes timestamps config
muhammadnawzad Nov 17, 2023
04f7ded
Adds documentations for IncludedSchemaGenerator
muhammadnawzad Nov 17, 2023
f4f2734
Adds documentations for RelationshipSchemaGenerator
muhammadnawzad Nov 17, 2023
d2f3c8f
Adds documentations for RequestSchemaGenerator class
muhammadnawzad Nov 17, 2023
e522958
Allows custom meta for response
muhammadnawzad Nov 17, 2023
561a909
Adds documentations for ResponseSchemaGenerator
muhammadnawzad Nov 17, 2023
86460ae
Removes factory bot option
muhammadnawzad Nov 17, 2023
9b7c7d4
Updates the gem's generators
muhammadnawzad Nov 17, 2023
9aba52b
Fixes rubocop offenses
muhammadnawzad Nov 17, 2023
7fb82b3
Updates gems
muhammadnawzad Nov 17, 2023
9abdfe2
Moves example to readme documentations
muhammadnawzad Nov 17, 2023
33a11e9
Updates the gem's documentation
muhammadnawzad Nov 17, 2023
5b32cb2
Adds `default_value_for_enum_attributes` method to Schemable::Definition
muhammadnawzad Jan 29, 2024
d00737f
Update gem versions
muhammadnawzad Jan 29, 2024
e1a9a0d
Refactor enum attribute handling in attribute_schema_generator to set…
muhammadnawzad Jan 29, 2024
e95a143
Adds documentations for `default_value_for_enum_attributes` method
muhammadnawzad Jan 29, 2024
72bf660
Update Schemable version to 1.0.1
muhammadnawzad Jan 29, 2024
a2fb1cf
Updates changelog for `v1.0.1`
muhammadnawzad Jan 29, 2024
213a265
Add nullable_relationships method to Schemable::Definition
muhammadnawzad Jan 30, 2024
dbfb9c1
Refactor generate_schema method to handle nullable relationships
muhammadnawzad Jan 30, 2024
51d1113
Adds docs for nullable_relationships method
muhammadnawzad Jan 30, 2024
e894e46
Updates Changelog
muhammadnawzad Jan 30, 2024
1afb31b
Update Schemable gem version to 1.0.2
muhammadnawzad Jan 30, 2024
49992ff
Add expand_nested parameter to generate method
muhammadnawzad Jan 30, 2024
f90a997
Adds infer_expand_nested_from_expand global configuration option
muhammadnawzad Jan 30, 2024
d212a29
Add infer_expand_nested_from_expand configuration docs
muhammadnawzad Jan 30, 2024
96911aa
Updates change log for `v1.0.3`
muhammadnawzad Jan 30, 2024
aaf209b
Bump version to 1.0.3
muhammadnawzad Jan 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
# rspec failure tracking
.rspec_status

*.gem
*.gem

.idea
22 changes: 20 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,28 @@ Metrics/AbcSize:
Metrics/MethodLength:
Enabled: false
Metrics/CyclomaticComplexity:
Max: 15
Enabled: false
Metrics/PerceivedComplexity:
Max: 15
Enabled: false
Lint/DuplicateMethods: # Disables duplicate methods warning
Enabled: false
Gemspec/RequiredRubyVersion: # Disables required ruby version warning
Enabled: false
Metrics/ParameterLists: # Disables parameter lists warning
Enabled: false
Lint/NextWithoutAccumulator: # Disables next without accumulator warning
Enabled: false
Lint/ShadowingOuterLocalVariable: # Disables shadowing outer local variable warning
Enabled: false
Metrics/ModuleLength: # Disables module length warning
Enabled: false
Layout/EmptyLinesAroundClassBody: # Disables empty lines around class body warning
Enabled: false
Layout/HeredocIndentation: # Disables heredoc indentation warning
Enabled: false
Layout/ClosingHeredocIndentation: # Disables closing heredoc indentation warning
Enabled: false
Rails/Output: # Disables rails output warning
Enabled: false
Metrics/ClassLength: # Disables class length warning
Max: 150
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
## [Unreleased]
# Changelog
This file is used to list changes made in each version of the Schemable gem.

## [0.1.0] - 2023-05-10
## Schemable 1.0.3 (2024-01-30)

- Initial release
* Added configuration for preventing expansion for nested relationships. This can be done by setting the `expand_nested` to `true` when invoking `ResponseSchemaGenerator`'s `generate` instance method (e.g. `ResponseSchemaGenerator.new(instance).generate(expand: true, expand_nested: true)`. Additionally, you could globally set the value of `expand_nested` to the same value as `expand` by setting the configuration `infer_expand_nested_from_expand` to `true` in the `/config/initializers/schemable.rb`.

## Schemable 1.0.2 (2024-01-30)

* Added configuration for making certain associations nullable in the response's relationship. This can be done by adding the name of the relation in the `nullable_relationships` method's array of strings.

## Schemable 1.0.1 (2024-01-29)

* Added configuration for changing the default value of enums. By default first key is used, or alternatively default can be set manually by the method `default_value_for_enum_attributes` from the definition.

## Schemable 1.0.0 (2023-11-17)

* Initial release
13 changes: 7 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# frozen_string_literal: true

source "https://rubygems.org"
source 'https://rubygems.org'

gemspec

gem "rake", "~> 13.0"
gem "rspec", "~> 3.0"
gem "rubocop", "~> 1.21"
gem 'rake', '~> 13.1.0'
gem 'rspec', '~> 3.12.0'
gem 'rubocop', '~> 1.60.2'
gem 'rubocop-rails', '~> 2.23.1'

group :development, :test do
gem 'factory_bot_rails', '~> 6.4.3'
gem 'jsonapi-rails', '~> 0.4.1'
gem 'factory_bot_rails', '~> 6.2'
end
end
128 changes: 0 additions & 128 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,128 +0,0 @@
PATH
remote: .
specs:
schemable (0.1.2)
factory_bot_rails (~> 6.2.0)
jsonapi-rails (~> 0.4.1)

GEM
remote: https://rubygems.org/
specs:
actionpack (7.0.4.3)
actionview (= 7.0.4.3)
activesupport (= 7.0.4.3)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.4.3)
activesupport (= 7.0.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
ast (2.4.2)
builder (3.2.4)
concurrent-ruby (1.2.2)
crass (1.0.6)
diff-lcs (1.5.0)
erubi (1.12.0)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
i18n (1.13.0)
concurrent-ruby (~> 1.0)
json (2.6.3)
jsonapi-deserializable (0.2.0)
jsonapi-parser (0.1.1)
jsonapi-rails (0.4.1)
jsonapi-parser (~> 0.1.0)
jsonapi-rb (~> 0.5.0)
jsonapi-rb (0.5.0)
jsonapi-deserializable (~> 0.2.0)
jsonapi-serializable (~> 0.3.0)
jsonapi-renderer (0.2.2)
jsonapi-serializable (0.3.1)
jsonapi-renderer (~> 0.2.0)
loofah (2.21.2)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
method_source (1.0.0)
minitest (5.18.0)
nokogiri (1.14.4-x86_64-linux)
racc (~> 1.4)
parallel (1.23.0)
parser (3.2.2.1)
ast (~> 2.4.1)
racc (1.6.2)
rack (2.2.7)
rack-test (2.1.0)
rack (>= 1.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
railties (7.0.4.3)
actionpack (= 7.0.4.3)
activesupport (= 7.0.4.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.8.0)
rexml (3.2.5)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.51.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.28.1)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
thor (1.2.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.4.2)
zeitwerk (2.6.8)

PLATFORMS
x86_64-linux

DEPENDENCIES
factory_bot_rails (~> 6.2)
jsonapi-rails (~> 0.4.1)
rake (~> 13.0)
rspec (~> 3.0)
rubocop (~> 1.21)
schemable!

BUNDLED WITH
2.4.12
Loading
Loading