rapitapir 0.1.2 β 2.1.0
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 +4 -4
- data/.rubocop.yml +7 -7
- data/.rubocop_todo.yml +88 -0
- data/CHANGELOG.md +29 -1
- data/README.md +1339 -236
- data/RUBY_WEEKLY_LAUNCH_POST.md +200 -0
- data/docs/RAILS_INTEGRATION_IMPLEMENTATION.md +209 -0
- data/docs/SINATRA_EXTENSION.md +399 -348
- data/docs/STRICT_VALIDATION.md +229 -0
- data/docs/VALIDATION_IMPROVEMENTS.md +218 -0
- data/docs/adr/0001-base-class-strategy.md +33 -0
- data/docs/adr/0002-type-shortcut-and-type-system.md +30 -0
- data/docs/adr/0003-openapi-source-of-truth.md +32 -0
- data/docs/adr/0004-client-generation-typescript-first.md +34 -0
- data/docs/adr/0005-auth-architecture.md +32 -0
- data/docs/adr/0006-observability-defaults.md +30 -0
- data/docs/adr/0007-ai-scope-and-boundaries.md +30 -0
- data/docs/adr/README.md +46 -0
- data/docs/adr/template.md +24 -0
- data/docs/ai-integration-plan.md +112 -0
- data/docs/auto-derivation.md +505 -92
- data/docs/blueprint.md +92 -4
- data/docs/endpoint-definition.md +536 -129
- data/docs/implementation-status.md +1 -1
- data/docs/n8n-integration.md +212 -0
- data/docs/observability.md +810 -500
- data/docs/using-mcp.md +93 -0
- data/examples/ai/knowledge_base_rag.rb +83 -0
- data/examples/ai/user_management_mcp.rb +92 -0
- data/examples/ai/user_validation_llm.rb +187 -0
- data/examples/auto_derivation_ruby_friendly.rb +44 -113
- data/examples/cli/user_api_endpoints.rb +63 -36
- data/examples/demo_api.rb +57 -18
- data/examples/enterprise_extension_demo.rb +13 -13
- data/examples/enterprise_rapitapir_api.rb +81 -93
- data/examples/nocodb/nocodb_scaffold/Gemfile +22 -0
- data/examples/nocodb/nocodb_scaffold/README.md +10 -0
- data/examples/nocodb/nocodb_scaffold/Rakefile +7 -0
- data/examples/nocodb/nocodb_scaffold/app/api/app.rb +1139 -0
- data/examples/nocodb/nocodb_scaffold/app/models/email_template.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models/faq.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models/feature.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models/idea.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models/itinerary_day.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models/route.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models/subscriber.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models/tour.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models/webhook.rb +6 -0
- data/examples/nocodb/nocodb_scaffold/app/models_loader.rb +3 -0
- data/examples/nocodb/nocodb_scaffold/config/database.yml +11 -0
- data/examples/nocodb/nocodb_scaffold/config.ru +9 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152012_create_features.rb +10 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152013_create_tours.rb +10 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152014_create_routes.rb +10 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152015_create_itinerary_days.rb +10 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152016_create_subscribers.rb +10 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152017_create_email_templates.rb +10 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152018_create_faqs.rb +10 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152019_create_webhooks.rb +10 -0
- data/examples/nocodb/nocodb_scaffold/db/migrate/20250808152020_create_ideas.rb +10 -0
- data/examples/nocodb/swagger.json +4378 -0
- data/examples/production_ready_example.rb +78 -58
- data/examples/rails/RAILS_8_GUIDE.md +165 -0
- data/examples/rails/RAILS_LOADING_FIX.rb +35 -0
- data/examples/rails/README.md +497 -0
- data/examples/rails/comprehensive_test.rb +91 -0
- data/examples/rails/config/routes.rb +48 -0
- data/examples/rails/debug_controller.rb +63 -0
- data/examples/rails/detailed_test.rb +46 -0
- data/examples/rails/enhanced_users_controller.rb +278 -0
- data/examples/rails/final_server_test.rb +50 -0
- data/examples/rails/hello_world_app.rb +116 -0
- data/examples/rails/hello_world_controller.rb +186 -0
- data/examples/rails/hello_world_routes.rb +28 -0
- data/examples/rails/rails8_minimal_demo.rb +132 -0
- data/examples/rails/rails8_simple_demo.rb +140 -0
- data/examples/rails/rails8_working_demo.rb +255 -0
- data/examples/rails/real_world_blog_api.rb +510 -0
- data/examples/rails/server_test.rb +46 -0
- data/examples/rails/test_direct_processing.rb +41 -0
- data/examples/rails/test_hello_world.rb +80 -0
- data/examples/rails/test_rails_integration.rb +54 -0
- data/examples/rails/traditional_app/Gemfile +37 -0
- data/examples/rails/traditional_app/README.md +265 -0
- data/examples/rails/traditional_app/app/controllers/api/v1/posts_controller.rb +254 -0
- data/examples/rails/traditional_app/app/controllers/api/v1/users_controller.rb +220 -0
- data/examples/rails/traditional_app/app/controllers/application_controller.rb +86 -0
- data/examples/rails/traditional_app/app/controllers/application_controller_simplified.rb +87 -0
- data/examples/rails/traditional_app/app/controllers/documentation_controller.rb +149 -0
- data/examples/rails/traditional_app/app/controllers/health_controller.rb +42 -0
- data/examples/rails/traditional_app/config/routes.rb +25 -0
- data/examples/rails/traditional_app/config/routes_best_practice.rb +25 -0
- data/examples/rails/traditional_app/config/routes_simplified.rb +36 -0
- data/examples/rails/traditional_app_runnable.rb +406 -0
- data/examples/rails/users_controller.rb +4 -1
- data/examples/serverless/Gemfile +43 -0
- data/examples/serverless/QUICKSTART.md +331 -0
- data/examples/serverless/README.md +520 -0
- data/examples/serverless/aws_lambda_example.rb +307 -0
- data/examples/serverless/aws_sam_template.yaml +215 -0
- data/examples/serverless/azure_functions_example.rb +407 -0
- data/examples/serverless/deploy.rb +204 -0
- data/examples/serverless/gcp_cloud_functions_example.rb +367 -0
- data/examples/serverless/gcp_function.yaml +23 -0
- data/examples/serverless/host.json +24 -0
- data/examples/serverless/package.json +32 -0
- data/examples/serverless/spec/aws_lambda_spec.rb +196 -0
- data/examples/serverless/spec/spec_helper.rb +89 -0
- data/examples/serverless/vercel.json +31 -0
- data/examples/serverless/vercel_example.rb +404 -0
- data/examples/simple_demo_api.rb +40 -7
- data/examples/strict_validation_examples.rb +104 -0
- data/examples/user_api.rb +130 -132
- data/examples/validation_error_examples.rb +173 -0
- data/lib/rapitapir/ai/llm_instruction.rb +456 -0
- data/lib/rapitapir/ai/mcp.rb +134 -0
- data/lib/rapitapir/ai/rag.rb +287 -0
- data/lib/rapitapir/ai/rag_middleware.rb +147 -0
- data/lib/rapitapir/auth/oauth2.rb +44 -58
- data/lib/rapitapir/cli/command.rb +392 -6
- data/lib/rapitapir/cli/mcp_export.rb +18 -0
- data/lib/rapitapir/cli/scaffold_generator.rb +639 -0
- data/lib/rapitapir/cli/validator.rb +3 -7
- data/lib/rapitapir/core/endpoint.rb +59 -6
- data/lib/rapitapir/core/enhanced_endpoint.rb +3 -7
- data/lib/rapitapir/dsl/enhanced_structures.rb +1 -1
- data/lib/rapitapir/dsl/fluent_endpoint_builder.rb +53 -0
- data/lib/rapitapir/endpoint_registry.rb +47 -0
- data/lib/rapitapir/observability/health_check.rb +4 -4
- data/lib/rapitapir/observability/logging.rb +10 -10
- data/lib/rapitapir/openapi/schema_generator.rb +46 -2
- data/lib/rapitapir/schema.rb +2 -2
- data/lib/rapitapir/server/enhanced_rack_adapter.rb +11 -8
- data/lib/rapitapir/server/middleware.rb +2 -2
- data/lib/rapitapir/server/rack_adapter.rb +1 -3
- data/lib/rapitapir/server/rails/configuration.rb +77 -0
- data/lib/rapitapir/server/rails/controller_base.rb +185 -0
- data/lib/rapitapir/server/rails/documentation_helpers.rb +76 -0
- data/lib/rapitapir/server/rails/resource_builder.rb +181 -0
- data/lib/rapitapir/server/rails/routes.rb +114 -0
- data/lib/rapitapir/server/rails_adapter.rb +10 -3
- data/lib/rapitapir/server/rails_adapter_class.rb +1 -3
- data/lib/rapitapir/server/rails_controller.rb +1 -3
- data/lib/rapitapir/server/rails_integration.rb +67 -0
- data/lib/rapitapir/server/rails_response_handler.rb +16 -3
- data/lib/rapitapir/server/sinatra_adapter.rb +29 -5
- data/lib/rapitapir/server/sinatra_integration.rb +4 -4
- data/lib/rapitapir/sinatra/extension.rb +2 -2
- data/lib/rapitapir/sinatra/oauth2_helpers.rb +34 -40
- data/lib/rapitapir/types/array.rb +4 -0
- data/lib/rapitapir/types/auto_derivation.rb +4 -20
- data/lib/rapitapir/types/datetime.rb +1 -3
- data/lib/rapitapir/types/float.rb +2 -6
- data/lib/rapitapir/types/hash.rb +40 -2
- data/lib/rapitapir/types/integer.rb +4 -12
- data/lib/rapitapir/types/object.rb +6 -2
- data/lib/rapitapir/types.rb +6 -2
- data/lib/rapitapir/version.rb +1 -1
- data/lib/rapitapir.rb +5 -3
- data/rapitapir.gemspec +3 -2
- metadata +142 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d2520e4b24ee5927e01f130de108a554b6b820f0cb501160e129dc054852320
|
|
4
|
+
data.tar.gz: 0ffafcc50aeb89b89ab477dbc252fcd8a5352d51134960ac92ee02053bc6b7e3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd644750fd860960c7e0b78af2ef56d60b8ffbfc575d65f22937f8e2c1de3a4907898b7ba62711d4a27baaa2497f3dd9052c0547fbc30f06d7c6d4c107f56b2d
|
|
7
|
+
data.tar.gz: 1ef21dc5edb5a112e91a0e9ce0be85b8894d380a1877714ab1cd1578185fed5d2ccc0e76d25734910eabebd41c6392d6e95a0bdb7b94dffa93a6b7e7207b8520
|
data/.rubocop.yml
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# RuboCop configuration for RapiTapir
|
|
2
|
+
inherit_from: .rubocop_todo.yml
|
|
3
|
+
|
|
4
|
+
inherit_mode:
|
|
5
|
+
merge:
|
|
6
|
+
- Exclude
|
|
7
|
+
|
|
2
8
|
AllCops:
|
|
3
|
-
TargetRubyVersion: 3.
|
|
9
|
+
TargetRubyVersion: 3.1
|
|
4
10
|
NewCops: enable
|
|
5
11
|
SuggestExtensions: false
|
|
6
12
|
Exclude:
|
|
@@ -38,12 +44,6 @@ Style/ClassVars:
|
|
|
38
44
|
Exclude:
|
|
39
45
|
- 'spec/**/*'
|
|
40
46
|
|
|
41
|
-
# Line length is reasonable for API definitions
|
|
42
|
-
Layout/LineLength:
|
|
43
|
-
Max: 120
|
|
44
|
-
Exclude:
|
|
45
|
-
- 'spec/**/*'
|
|
46
|
-
|
|
47
47
|
# Disable some newer cops that may cause issues
|
|
48
48
|
Gemspec/AddRuntimeDependency:
|
|
49
49
|
Enabled: false
|
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2025-08-07 14:11:39 UTC using RuboCop version 1.79.2.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 7
|
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
11
|
+
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
|
|
12
|
+
# URISchemes: http, https
|
|
13
|
+
Layout/LineLength:
|
|
14
|
+
Max: 160
|
|
15
|
+
|
|
16
|
+
# Offense count: 3
|
|
17
|
+
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
|
|
18
|
+
Lint/DuplicateBranch:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'lib/rapitapir/server/rails/routes.rb'
|
|
21
|
+
|
|
22
|
+
# Offense count: 19
|
|
23
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
24
|
+
Metrics/AbcSize:
|
|
25
|
+
Max: 48
|
|
26
|
+
|
|
27
|
+
# Offense count: 13
|
|
28
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
29
|
+
Metrics/CyclomaticComplexity:
|
|
30
|
+
Max: 16
|
|
31
|
+
|
|
32
|
+
# Offense count: 7
|
|
33
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
34
|
+
Metrics/PerceivedComplexity:
|
|
35
|
+
Max: 14
|
|
36
|
+
|
|
37
|
+
# Offense count: 1
|
|
38
|
+
Naming/AccessorMethodName:
|
|
39
|
+
Exclude:
|
|
40
|
+
- 'lib/rapitapir/auth/oauth2.rb'
|
|
41
|
+
|
|
42
|
+
# Offense count: 7
|
|
43
|
+
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
|
|
44
|
+
# SupportedStyles: snake_case, camelCase
|
|
45
|
+
# ForbiddenIdentifiers: __id__, __send__
|
|
46
|
+
Naming/MethodName:
|
|
47
|
+
Exclude:
|
|
48
|
+
- 'lib/rapitapir/server/rails/controller_base.rb'
|
|
49
|
+
|
|
50
|
+
# Offense count: 3
|
|
51
|
+
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
|
|
52
|
+
# NamePrefix: is_, has_, have_, does_
|
|
53
|
+
# ForbiddenPrefixes: is_, has_, have_, does_
|
|
54
|
+
# AllowedMethods: is_a?
|
|
55
|
+
# MethodDefinitionMacros: define_method, define_singleton_method
|
|
56
|
+
Naming/PredicatePrefix:
|
|
57
|
+
Exclude:
|
|
58
|
+
- 'spec/**/*'
|
|
59
|
+
- 'lib/rapitapir/sinatra/oauth2_helpers.rb'
|
|
60
|
+
|
|
61
|
+
# Offense count: 3
|
|
62
|
+
# Configuration parameters: AllowedConstants.
|
|
63
|
+
Style/Documentation:
|
|
64
|
+
Exclude:
|
|
65
|
+
- 'spec/**/*'
|
|
66
|
+
- 'lib/rapitapir/cli/mcp_export.rb'
|
|
67
|
+
- 'lib/rapitapir/server/rails_integration.rb'
|
|
68
|
+
|
|
69
|
+
# Offense count: 1
|
|
70
|
+
Style/MissingRespondToMissing:
|
|
71
|
+
Exclude:
|
|
72
|
+
- 'lib/rapitapir/server/rails_integration.rb'
|
|
73
|
+
|
|
74
|
+
# Offense count: 2
|
|
75
|
+
Style/OpenStructUse:
|
|
76
|
+
Exclude:
|
|
77
|
+
- 'lib/rapitapir/sinatra/oauth2_helpers.rb'
|
|
78
|
+
|
|
79
|
+
# Offense count: 1
|
|
80
|
+
# Configuration parameters: Max.
|
|
81
|
+
Style/SafeNavigationChainLength:
|
|
82
|
+
Exclude:
|
|
83
|
+
- 'lib/rapitapir/ai/mcp.rb'
|
|
84
|
+
|
|
85
|
+
# Top-level String monkey-patch for pluralization/singularization
|
|
86
|
+
Style/OneClassPerFile:
|
|
87
|
+
Exclude:
|
|
88
|
+
- 'lib/rapitapir/sinatra/resource_builder.rb'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.1.0] - 2026-11-22
|
|
9
|
+
|
|
10
|
+
### Summary
|
|
11
|
+
Dependency refresh to the latest gem releases, with code adaptations for
|
|
12
|
+
breaking API changes, and a full repair of the example catalog.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- π¦ **jwt runtime dependency declared in the gemspec** (`>= 2.10, < 4.0`) β it was lazily `require`d by `RapiTapir::Auth` OAuth2 validation but never declared, so installs could silently lack it
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- π’ **Bumped all dependencies to their latest releases**: dotenv 3.2, json 3.1, jwt 3.3, rack 3.2, puma 8.1, simplecov 1.3, sinatra 4.2, webmock 3.38, rubocop 1.92, rackup 2.3, rack-test 2.3, rspec 3.13, webrick 1.9, OpenTelemetry exporter-otlp 0.37 / instrumentation-all 0.102 / sdk 1.13
|
|
19
|
+
- πΎ **Minimum Ruby raised to 3.3** (`required_ruby_version >= 3.3`). The latest OpenTelemetry stack (api 1.9+, sdk 1.11+, common 0.24+) declares `ruby >= 3.3`; keeping the current otel releases required dropping the EOL 3.1/3.2 runtimes. CI matrix and all workflows now test 3.3/3.4. **This is a breaking change for Ruby 3.1/3.2 users.**
|
|
20
|
+
- β¬οΈ **json range widened in the gemspec** to `>= 2.6, < 4.0` to match the refreshed stack
|
|
21
|
+
- π§© **JWT v3 compatibility**: `JWT.decode` no longer accepts the positional `verify` argument β replaced with the `verify_signature: true` option (works on jwt β₯ 2.10 and 3.x)
|
|
22
|
+
- π¨ **RuboCop 1.92 compliance**: `Style/DirectiveScope` disable/enable pairs converted to `disable-next`
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- π **`examples/enterprise_rapitapir_api.rb`**: `configure`/`set` were called from an instance `initialize` (crash on boot); auth/middleware setup moved to class level; `SinatraAdapter` now binds to the app class (Sinatra 4 removed instanceβclass delegation); handlers use the adapter's `[status, headers, body]` response protocol
|
|
26
|
+
- π **`examples/enterprise_extension_demo.rb`**: `bearer_auth` β `add_auth_scheme(:bearer, RapiTapir::Auth.bearer_token(...))` (the real `Configuration` API)
|
|
27
|
+
- π **`examples/demo_api.rb`, `simple_demo_api.rb`, `cli/user_api_endpoints.rb`, `user_api.rb`, `production_ready_example.rb`**: rewritten from the removed `.in/.out/.error_out` DSL onto the current builder (`json_body`, `ok`, `created`, `no_content`, `not_found`, β¦) with proper `RapiTapir::Types.hash/array` types
|
|
28
|
+
- π **`examples/auto_derivation_ruby_friendly.rb`**: now demos only the real derivation APIs (`from_hash`, `from_open_struct`, `from_json_schema`, `from_protobuf`)
|
|
29
|
+
- π§ͺ **All 18 examples verified running**, including live HTTP checks of the three server examples
|
|
30
|
+
|
|
31
|
+
### Verification
|
|
32
|
+
- β
695 RSpec examples, 0 failures
|
|
33
|
+
- β
RuboCop: 91 files, no offenses
|
|
34
|
+
- β
`gem build` produces a clean installable package
|
|
35
|
+
|
|
8
36
|
## [Unreleased] - 2025-08-02
|
|
9
37
|
|
|
10
38
|
### Summary
|