blueprinter_schema 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 624ef3521849ad9f4b406b1236f7466ca0938ae3b1070b831ab29ef87d0e759e
4
- data.tar.gz: e71133b659e4fe5b40ff09319be9fe196894d698f8138811609eddfa4211a5f1
3
+ metadata.gz: 62a979f21048d765a9ee74d4525c1d15e354c079432beef7ba8d730b4f8f2dd0
4
+ data.tar.gz: 778688f0c08a12f682b0fd8aa82a3b0ecbe25c96f82172d92ebf884230cba7fd
5
5
  SHA512:
6
- metadata.gz: '080d444267259e5323f40c2a43a95bac153e3a7aadf4f82e099500b92a43251ac4eb75bad2df1a3a6a50e45f70710bac5b3120d8b20a83db65679ed403189ba0'
7
- data.tar.gz: 812e6fdffdbaffb41fa62c3d37ff146f115069e4710b3447d73046561274b19d86dd168edb9bcc34e30975f16aea489d49f65c19c1662581bb0e5bde6a9dfd6c
6
+ metadata.gz: '08fbf14b76e149fd139b7678c8e06908f12c06858e90d42b9f5f28d71155a12317b4ed5efb8ffd9f399b7348a7074ae8d710ae266638c6bae7931a594aed87dd'
7
+ data.tar.gz: 997fa37f5e23f7a6081ea52a377afe58a22498b414f6cfd31cfb4ba6eef2c15d10bb496947e776c48257bf08c357bd351406730211da629efec508c971a2a5fd
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blueprinter_schema",
3
- "dockerComposeFile": "../docker-compose.yml",
3
+ "dockerComposeFile": "../compose.yml",
4
4
  "service": "ruby",
5
5
  "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
6
6
 
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 4.0.1
data/Dockerfile CHANGED
@@ -4,7 +4,6 @@
4
4
  ARG RUBY_VERSION=3.4.3
5
5
  FROM docker.io/library/ruby:$RUBY_VERSION-slim
6
6
 
7
- # Rails app lives here
8
7
  WORKDIR /workspaces/blueprinter_schema
9
8
 
10
9
  # Install packages needed to build gems
data/README.md CHANGED
@@ -47,7 +47,7 @@ BlueprinterSchema.generate(serializer: UserSerializer)
47
47
  }
48
48
  ```
49
49
 
50
- You can pass an ActiveRecord Model to automatically infer types from DB fields:
50
+ ### Pass an ActiveRecord Model to automatically infer types from DB fields:
51
51
 
52
52
  ```rb
53
53
  class UserSerializer < Blueprinter::Base
@@ -82,7 +82,7 @@ BlueprinterSchema.generate(serializer: UserSerializer, model: User)
82
82
  }
83
83
  ```
84
84
 
85
- You can use associations:
85
+ ### Use associations:
86
86
 
87
87
  ```rb
88
88
  class UserSerializer < Blueprinter::Base
@@ -156,16 +156,10 @@ BlueprinterSchema.generate(
156
156
  Devcontainer / Codespaces / Native
157
157
 
158
158
  ```sh
159
+ mise install
159
160
  bin/setup
160
161
  ```
161
162
 
162
- Docker
163
-
164
- ```sh
165
- docker compose up -d
166
- docker compose exec ruby bin/setup
167
- ```
168
-
169
163
  Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
170
164
 
171
165
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -127,18 +127,19 @@ module BlueprinterSchema
127
127
  ar_association = @model&.reflect_on_association(association.name)
128
128
  is_collection = ar_association ? ar_association.collection? : association.options[:collection]
129
129
 
130
- associated_schema = recursive_generate(blueprint_class, ar_association&.klass)
130
+ view = association.options[:view] || :default
131
+ associated_schema = recursive_generate(blueprint_class, ar_association&.klass, view)
131
132
 
132
133
  is_collection ? { 'type' => 'array', 'items' => associated_schema } : associated_schema
133
134
  end
134
135
 
135
- def recursive_generate(serializer, model)
136
+ def recursive_generate(serializer, model, view)
136
137
  BlueprinterSchema.generate(
137
138
  serializer:,
138
139
  model:,
139
140
  skip_conditional_fields: @skip_conditional_fields,
140
141
  fallback_definition: @fallback_definition,
141
- view: @view
142
+ view:
142
143
  )
143
144
  end
144
145
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlueprinterSchema
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.2'
5
5
  end
metadata CHANGED
@@ -1,42 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blueprinter_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - thisismydesign
8
8
  bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
- dependencies:
12
- - !ruby/object:Gem::Dependency
13
- name: activerecord
14
- requirement: !ruby/object:Gem::Requirement
15
- requirements:
16
- - - ">="
17
- - !ruby/object:Gem::Version
18
- version: '0'
19
- type: :runtime
20
- prerelease: false
21
- version_requirements: !ruby/object:Gem::Requirement
22
- requirements:
23
- - - ">="
24
- - !ruby/object:Gem::Version
25
- version: '0'
26
- - !ruby/object:Gem::Dependency
27
- name: blueprinter
28
- requirement: !ruby/object:Gem::Requirement
29
- requirements:
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: '0'
33
- type: :runtime
34
- prerelease: false
35
- version_requirements: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ">="
38
- - !ruby/object:Gem::Version
39
- version: '0'
11
+ dependencies: []
40
12
  email:
41
13
  - git.thisismydesign@gmail.com
42
14
  executables: []
@@ -46,12 +18,12 @@ files:
46
18
  - ".devcontainer/devcontainer.json"
47
19
  - ".rspec"
48
20
  - ".rubocop.yml"
49
- - ".ruby-version"
21
+ - ".tool-versions"
50
22
  - Dockerfile
51
23
  - LICENSE.txt
52
24
  - README.md
53
25
  - Rakefile
54
- - docker-compose.yml
26
+ - compose.yml
55
27
  - lib/blueprinter_schema.rb
56
28
  - lib/blueprinter_schema/generator.rb
57
29
  - lib/blueprinter_schema/version.rb
@@ -77,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
49
  - !ruby/object:Gem::Version
78
50
  version: '0'
79
51
  requirements: []
80
- rubygems_version: 3.6.7
52
+ rubygems_version: 4.0.3
81
53
  specification_version: 4
82
54
  summary: Create JSON Schema from Blueprinter serializers and ActiveRecord Models.
83
55
  test_files: []
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- ruby-3.4.3
File without changes