praxis 2.0.pre.30 → 2.0.pre.31

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: a2ffb701843f77a4f33c4b2628cdc7b609c5bb8b1d50bf0df454a77eded14ca3
4
- data.tar.gz: 34852fb86cd240a18701aa013a1d65508c17d9c8831ecf5176efa9c73f7b5339
3
+ metadata.gz: 6b0d313f269a5d2eee55bec87524dc37d0b424ed747969fa35f3f8454e658028
4
+ data.tar.gz: 894589492bcd9d0cd1c8af237215892e163c9229f6f81a6aa90a709b43623a25
5
5
  SHA512:
6
- metadata.gz: 6578cd3f42a3f5dde6f32f9a860169e90f68d20c5a58dddefee2511e51e18368ec81a8ee5c75e60581ee53134e44940cbdad079a9e4c460e1b65121bea613b5b
7
- data.tar.gz: 59073268280c18c2a9e77e626c5c75503c45d5b64351bd67898861d68b1f952b1f9c8c124af813049fc4b6aaed87cc74860d6561744c654343f00a60a1c59e4f
6
+ metadata.gz: 1744d64f7e8521185d687cc124c8b553b297f79734c74b0bffb83bab7a5f8bdbacf1e71899ffce8044fddbf1d92902270fae4892425808aaedc6eff7a2490f61
7
+ data.tar.gz: c5602b15ddf593f4b387f39c398fd411158e2b936e5763a21cf01edb86c3ea4c87f3a09f95c5fa2bff29317075ebae6bbec52eba5190b9594359e335e14ef23f
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## next
4
4
 
5
+ ## 2.0.pre.31
6
+ * Switch the locally generated index.html file to browse the generated OpenAPI docs to use `elements` instead of `reDoc`
7
+ * Spruce up the initial Gemfile for the generated example app
8
+ * Fix Praxis::Mapper ordering code, to not prefix top level columns with the table name, as this completely confuses ActiveRecord which switches to full-on eager loading all of the associations in the top query. i.e., passing an invalid table/column name in a `references` method will trigger that (seemingly a current bug)
9
+
5
10
  ## 2.0.pre.30
6
11
  * A few cleanup and robustness additions:
7
12
  * OpenAPI: Disable overriding a description when the schema is a ref (there are known issues with UI browsers)
@@ -171,30 +171,25 @@ module Praxis
171
171
  File.open("#{filename}.yml", 'w') { |f| f.write(YAML.dump(converted_full_data)) }
172
172
 
173
173
  html = <<-HTML
174
- <!DOCTYPE html>
175
- <html>
176
- <head>
177
- <title>ReDoc</title>
178
- <!-- needed for adaptive design -->
179
- <meta charset="utf-8"/>
180
- <meta name="viewport" content="width=device-width, initial-scale=1">
181
- <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
182
-
183
- <!--
184
- ReDoc doesn't change outer page styles
185
- -->
186
- <style>
187
- body {
188
- margin: 0;
189
- padding: 0;
190
- }
191
- </style>
192
- </head>
193
- <body>
194
- <redoc spec-url='http://localhost:9090/#{version_file}/openapi.json'></redoc>
195
- <script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>
196
- </body>
197
- </html>
174
+ <!doctype html>
175
+ <html lang="en">
176
+ <head>
177
+ <meta charset="utf-8">
178
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
179
+ <title>Elements in HTML</title>
180
+
181
+ <script src="https://unpkg.com/@stoplight/elements/web-components.min.js"></script>
182
+ <link rel="stylesheet" href="https://unpkg.com/@stoplight/elements/styles.min.css">
183
+ </head>
184
+ <body>
185
+
186
+ <elements-api
187
+ apiDescriptionUrl="http://localhost:9090/#{version_file}/openapi.json"
188
+ router="hash"
189
+ />
190
+
191
+ </body>
192
+ </html>
198
193
  HTML
199
194
  html_file = File.join(doc_root_dir, version_file, 'index.html')
200
195
  File.write(html_file, html)
@@ -36,7 +36,7 @@ module Praxis
36
36
  column_prefix = dotted.empty? ? root_resource.model.table_name : ([''] + dotted).join(AttributeFiltering::ActiveRecordFilterQueryBuilder::REFERENCES_STRING_SEPARATOR)
37
37
 
38
38
  # If the sorting refers to a deeper association, make sure to add the join and the special reference
39
- if column_prefix
39
+ if column_prefix && column_prefix != root_resource.model.table_name
40
40
  refval = AttributeFiltering::ActiveRecordFilterQueryBuilder.build_reference_value(column_prefix, query: query)
41
41
  # Outter join hash needs to be a string based hash format!! (if it's in symbols, it won't match it and we'll cause extra joins)
42
42
  query = query.left_outer_joins(info[:includes]).references(refval)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Praxis
4
- VERSION = '2.0.pre.30'
4
+ VERSION = '2.0.pre.31'
5
5
  end
@@ -1,18 +1,22 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'activerecord', '~> 6'
6
+ gem 'link_header' # For pagination extensions
7
+ gem 'oj' # For fast JSON de/serialization handlers
8
+ gem 'parslet' # For field selection extension
3
9
  gem 'praxis'
10
+ gem 'puma' # A much better web server than the default webrick
4
11
  gem 'rack'
5
12
  gem 'sqlite3'
6
- gem 'activerecord'
7
- gem 'puma' # A much better web server than the default webrick
8
- gem 'parslet' # For field selection extension
9
- gem 'link_header' # For pagination extensions
10
13
 
11
14
  group :development, :test do
12
- gem 'rake'
13
- gem 'rack-test'
14
- gem "rspec" # needed for rake task
15
15
  gem 'database_cleaner' # For transactional DB tests
16
+ gem 'rack-test'
17
+ gem 'rake'
18
+ gem 'rspec' # needed for rake task
19
+ gem 'webrick' # For serving the API documentation browser preview
16
20
 
17
21
  gem 'pry'
18
22
  gem 'pry-byebug'
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.30
4
+ version: 2.0.pre.31
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-03-01 00:00:00.000000000 Z
12
+ date: 2023-03-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -693,7 +693,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
693
693
  - !ruby/object:Gem::Version
694
694
  version: 1.3.1
695
695
  requirements: []
696
- rubygems_version: 3.1.2
696
+ rubygems_version: 3.3.7
697
697
  signing_key:
698
698
  specification_version: 4
699
699
  summary: Building APIs the way you want it.