praxis 2.0.pre.36 → 2.0.pre.37

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 832a3ffb62fa691ed10139478a2cc262978c8a4c382baf9392357d1b78548164
4
- data.tar.gz: 85a4bf51dac77883338be30112725f380483db6b7cad121d193652095e886ab9
3
+ metadata.gz: 39d8a10f82b2ea044527e35af0bc2844c17999395207a3694b2a585ed5894b74
4
+ data.tar.gz: 17d1a29e900aa9522514090b49241e07c020f2116ad26354349d4c1da5cd6df1
5
5
  SHA512:
6
- metadata.gz: 78a6a4546a9abdc6764d72c04d4419a1895b51399f9d77789f7dd6a4e1c86983d210deabf5744e072ebf98a807c20d3fc26129f2384c85e061745263d3bc4c15
7
- data.tar.gz: df6d66dbef7f356ee7adfa23211f8bcf6c8df4d67f1f158c410824d403fb354d7b472af707411f4b2e672a8a4356163c3e55978fb559b4f18f4b14cf971340ce
6
+ metadata.gz: 8f5d05fcb1753d8a8147900533b837ae0e822572b94351c2eab017cb41f2a6be6823b01911a35d5fbc2c781d0113f45a65be1b361e9e812cb57d8aa9722cfb02
7
+ data.tar.gz: cea6ed63af2625228b5c8c6c69e2b99d5036ee8a070828bf961adfad325cb39d6b667d56918884213c8c23d272819837f90cf90fecd5a4addd55ab5c46493dac
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.1
1
+ 3.2.2
data/CHANGELOG.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Praxis Changelog
2
2
 
3
- ## next
3
+ ## 2.0.pre.37
4
+
4
5
  - OpenAPI generation enhancement:
5
6
  - expose nullable: true, in situations where the 'null:' key isn't specified in an attribute, but the builtin default behavior is true
6
7
  - Change ActiveRecord query planner strategy for selecting fields in the root model when that model is also appearing in inner joins/associations (triggered by a new AR7 behavior)
@@ -11,6 +12,7 @@
11
12
  points to a loaded model with the same 'id' ... then we're at the mercy of whatever fields that initial model was loaded with.
12
13
  The current solution we've adopted, is to make our query planner smarter, and make sure that we use a top level model select clause that includes ALL of possible fields for that model, regardless of how deep the inner associations might be.
13
14
  This can technically add more loaded fields at the top (i.e., some memory bloat), but if that's the case, it is very likely that such extra bloat on field memory is compensated by the fact that any of the inner associations using the same model type will now likely not have to be loaded and instantiated. It really depends on the pattern of the query and the cardinality of such associations
15
+ - Update attributor to 8.0, this replaces the use of Randexp with (Faker)[https://github.com/faker-ruby/faker] and means support for generating examples from regular expressions is no longer supported.
14
16
 
15
17
  ## 2.0.pre.35
16
18
  - Fix reported nullability property in OpenAPI generation. Looking at null: true | false isn't enough. The system needs to look at the default null behavior from Attributor, to properly ascertain if the exclusion of a 'null' option means nullable or not. This PR fixes this.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  namespace :praxis do
4
- desc 'Run interactive pry/irb console'
4
+ desc 'Run interactive REPL'
5
5
  task :console do
6
6
  # Use irb if available (which it almost always is).
7
7
  require 'irb'
@@ -14,23 +14,29 @@ namespace :praxis do
14
14
  IRB.setup nil
15
15
  ARGV.concat(old_argv)
16
16
 
17
- # Allow reentrant IRB
17
+ # Ensure that multi-irb has a context to work with (and, indirectly an instance of IRB::Irb).
18
18
  IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
19
+
20
+ # Allow reentrant IRB
19
21
  require 'irb/ext/multi-irb'
20
22
 
23
+ # Ensure that we save history just like normal IRB
24
+ require 'irb/ext/save-history'
25
+
21
26
  # Remove main object from prompt (its stringify is not useful)
22
27
  nickname = File.basename(::Praxis::Application.instance.root)
23
28
  IRB.conf[:PROMPT][:DEFAULT] = {
24
29
  PROMPT_I: "%N(#{nickname}):%03n:%i> ",
25
30
  PROMPT_N: "%N(#{nickname}):%03n:%i> ",
26
31
  PROMPT_S: "%N(#{nickname}):%03n:%i%l ",
27
- PROMPT_C: "%N(#{nickname}):%03n:%i* "
32
+ PROMPT_C: "%N(#{nickname}):%03n:%i* ",
28
33
  }
29
34
 
30
35
  # Disable inefficient, distracting autocomplete
31
36
  IRB.conf[:USE_AUTOCOMPLETE] = false
32
37
 
33
- # Set the IRB main object.
38
+ # Invoke the REPL, then cleanly shut down
34
39
  IRB.irb(nil, Praxis::Application.instance)
40
+ IRB.irb_at_exit
35
41
  end
36
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Praxis
4
- VERSION = '2.0.pre.36'
4
+ VERSION = '2.0.pre.37'
5
5
  end
data/praxis.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
22
22
  spec.bindir = 'bin'
23
23
  spec.executables << 'praxis'
24
24
 
25
- spec.add_dependency 'activesupport', '>= 3'
26
- spec.add_dependency 'attributor', '>= 7.1'
25
+ spec.add_dependency 'activesupport', '>= 6'
26
+ spec.add_dependency 'attributor', '>= 8.0'
27
27
  spec.add_dependency 'mime', '~> 0'
28
28
  spec.add_dependency 'mustermann', '>=1.1'
29
29
  spec.add_dependency 'rack', '>= 1'
@@ -42,6 +42,7 @@ Gem::Specification.new do |spec|
42
42
  else
43
43
  spec.add_development_dependency 'jdbc-sqlite3'
44
44
  end
45
+ spec.add_development_dependency 'activerecord', '~> 6'
45
46
  spec.add_development_dependency 'coveralls_reborn', '~> 0.27.0'
46
47
  spec.add_development_dependency 'fuubar', '~> 2'
47
48
  spec.add_development_dependency 'guard', '~> 2'
@@ -51,4 +52,5 @@ Gem::Specification.new do |spec|
51
52
  spec.add_development_dependency 'rspec', '~> 3'
52
53
  spec.add_development_dependency 'rspec-collection_matchers', '~> 1'
53
54
  spec.add_development_dependency 'rspec-its', '~> 1'
55
+ spec.add_development_dependency 'sequel', '~> 5'
54
56
  end
@@ -366,8 +366,10 @@ describe 'Functional specs' do
366
366
  end
367
367
 
368
368
  context 'auth_plugin' do
369
+ let(:content_type) { 'application/json' }
370
+
369
371
  it 'can terminate' do
370
- post '/api/clouds/23/instances/1/terminate?api_version=1.0', nil, 'global_session' => session
372
+ post '/api/clouds/23/instances/1/terminate?api_version=1.0', nil, 'global_session' => session, 'CONTENT_TYPE' => content_type
371
373
  expect(last_response.status).to eq(200)
372
374
  end
373
375
 
@@ -392,7 +392,7 @@ describe Praxis::Blueprint do
392
392
  email: 'bob@example.com',
393
393
  aliases: [],
394
394
  prior_addresses: [],
395
- parents: { father: Randgen.first_name, mother: Randgen.first_name },
395
+ parents: { father: Faker::Name.first_name, mother: Faker::Name.first_name },
396
396
  href: 'www.example.com',
397
397
  alive: true
398
398
  }
@@ -3,9 +3,9 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Praxis::MediaType do
6
- let(:owner_resource) { instance_double(Person, id: 100, name: /[:name:]/.gen, href: '/') }
7
- let(:manager_resource) { instance_double(Person, id: 101, name: /[:name:]/.gen, href: '/') }
8
- let(:custodian_resource) { instance_double(Person, id: 102, name: /[:name:]/.gen, href: '/') }
6
+ let(:owner_resource) { instance_double(Person, id: 100, name: Faker::Name.first_name, href: '/') }
7
+ let(:manager_resource) { instance_double(Person, id: 101, name: Faker::Name.first_name, href: '/') }
8
+ let(:custodian_resource) { instance_double(Person, id: 102, name: Faker::Name.first_name, href: '/') }
9
9
  let(:residents_summary_resource) do
10
10
  instance_double(Person::CollectionSummary, href: '/people', size: 2)
11
11
  end
@@ -16,7 +16,7 @@ describe Praxis::Types::MultipartArray do
16
16
 
17
17
  file 'files', multiple: true do
18
18
  header 'Content-Type', 'application/octet-stream'
19
- filename String, regexp: /file/
19
+ filename String, regexp: /file/, example: 'file'
20
20
  payload Attributor::Tempfile
21
21
  end
22
22
 
@@ -6,7 +6,7 @@ class Instance < Praxis::MediaType
6
6
  attributes do
7
7
  attribute :id, Integer
8
8
  attribute :name, String,
9
- example: /[:first_name:]/,
9
+ example: proc { Faker::Name.first_name },
10
10
  regexp: /^\w+$/
11
11
 
12
12
  attribute :href, String
@@ -5,7 +5,7 @@ class VolumeSnapshot < Praxis::MediaType
5
5
 
6
6
  attributes do
7
7
  attribute :id, Integer
8
- attribute :name, String, regexp: /snapshot-(\w+)/
8
+ attribute :name, String, regexp: /snapshot-(\w+)/, example: proc { "snapshot-#{Faker::Number.number(digits: 8) }" }
9
9
  end
10
10
 
11
11
  default_fieldset do
@@ -17,7 +17,7 @@ class VolumeSnapshot < Praxis::MediaType
17
17
  identifier 'application/json'
18
18
 
19
19
  attributes do
20
- attribute :name, String, regexp: /snapshots-(\w+)/
20
+ attribute :name, String, regexp: /snapshots-(\w+)/, example: proc { "snapshot-#{Faker::Number.number(digits: 8) }" }
21
21
  attribute :size, Integer
22
22
  attribute :href, String
23
23
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  class PersonBlueprint < Praxis::Blueprint
4
4
  attributes do
5
- attribute :name, String, example: /[:first_name:]/
5
+ attribute :name, String, example: proc { Faker::Name.first_name }
6
6
  attribute :email, String, example: proc { |person| "#{person.name}@example.com" }
7
7
 
8
8
  attribute :age, Integer, min: 0
@@ -55,8 +55,8 @@ end
55
55
 
56
56
  class FullName < Attributor::Model
57
57
  attributes do
58
- attribute :first, String, example: /[:first_name:]/
59
- attribute :last, String, example: /[:last_name:]/
58
+ attribute :first, String, example: proc { Faker::Name.first_name }
59
+ attribute :last, String, example: proc { Faker::Name.last_name }
60
60
  end
61
61
  end
62
62
 
@@ -6,7 +6,7 @@ class Person < Praxis::MediaType
6
6
 
7
7
  attributes do
8
8
  attribute :id, Integer
9
- attribute :name, String, example: /[:name:]/
9
+ attribute :name, String, example: proc { Faker::Name.full_name }
10
10
  attribute :href, String, example: proc { |person| "/people/#{person.id}" }
11
11
  end
12
12
 
@@ -115,9 +115,9 @@ class Post < Praxis::MediaType
115
115
  description: 'Href for use with this API'
116
116
 
117
117
  attribute :title, String,
118
- example: /\w+/
118
+ example: proc { Faker::Lorem.sentence }
119
119
  attribute :content, String,
120
- example: /[:sentence:]{4,5}/
120
+ example: proc { Faker::Lorem.words(10) }
121
121
  attribute :url, String,
122
122
  description: 'URL for a web browser',
123
123
  example: proc { |o, _ctx| "example.com/posts/#{o.id}" }
@@ -163,8 +163,8 @@ class User < Praxis::MediaType
163
163
  attribute :href, String,
164
164
  example: proc { |o, _ctx| "/api/v1.0/users/#{o.id}" }
165
165
 
166
- attribute :first, String, example: /[:first_name:]/
167
- attribute :last, String, example: /[:last_name:]/
166
+ attribute :first, String, example: proc { Faker::Name.first_name }
167
+ attribute :last, String, example: proc { Faker::Name.last_name }
168
168
  attribute :posts, Attributor::Collection.of(Post)
169
169
 
170
170
  attribute :post_matrix, Attributor::Collection.of(Attributor::Collection.of(Post)),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: praxis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.pre.36
4
+ version: 2.0.pre.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep M. Blanquer
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-17 00:00:00.000000000 Z
12
+ date: 2023-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3'
20
+ version: '6'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '3'
27
+ version: '6'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: attributor
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '7.1'
34
+ version: '8.0'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '7.1'
41
+ version: '8.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: mime
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -207,6 +207,20 @@ dependencies:
207
207
  - - "~>"
208
208
  - !ruby/object:Gem::Version
209
209
  version: '1'
210
+ - !ruby/object:Gem::Dependency
211
+ name: activerecord
212
+ requirement: !ruby/object:Gem::Requirement
213
+ requirements:
214
+ - - "~>"
215
+ - !ruby/object:Gem::Version
216
+ version: '6'
217
+ type: :development
218
+ prerelease: false
219
+ version_requirements: !ruby/object:Gem::Requirement
220
+ requirements:
221
+ - - "~>"
222
+ - !ruby/object:Gem::Version
223
+ version: '6'
210
224
  - !ruby/object:Gem::Dependency
211
225
  name: coveralls_reborn
212
226
  requirement: !ruby/object:Gem::Requirement
@@ -333,6 +347,20 @@ dependencies:
333
347
  - - "~>"
334
348
  - !ruby/object:Gem::Version
335
349
  version: '1'
350
+ - !ruby/object:Gem::Dependency
351
+ name: sequel
352
+ requirement: !ruby/object:Gem::Requirement
353
+ requirements:
354
+ - - "~>"
355
+ - !ruby/object:Gem::Version
356
+ version: '5'
357
+ type: :development
358
+ prerelease: false
359
+ version_requirements: !ruby/object:Gem::Requirement
360
+ requirements:
361
+ - - "~>"
362
+ - !ruby/object:Gem::Version
363
+ version: '5'
336
364
  description:
337
365
  email:
338
366
  - blanquer@gmail.com
@@ -677,7 +705,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
677
705
  - !ruby/object:Gem::Version
678
706
  version: 1.3.1
679
707
  requirements: []
680
- rubygems_version: 3.3.7
708
+ rubygems_version: 3.4.10
681
709
  signing_key:
682
710
  specification_version: 4
683
711
  summary: Building APIs the way you want it.