reqcord 0.1.0 → 0.1.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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +90 -0
  3. data/Gemfile +10 -0
  4. data/LICENSE.txt +21 -0
  5. data/README.md +252 -95
  6. data/Rakefile +13 -0
  7. data/docs/configuration.md +319 -0
  8. data/examples/reqcord.yml +58 -0
  9. data/gemfiles/rails_7.1.gemfile +13 -0
  10. data/gemfiles/rails_7.2.gemfile +13 -0
  11. data/gemfiles/rails_8.0.gemfile +13 -0
  12. data/gemfiles/rails_8.1.gemfile +13 -0
  13. data/lib/reqcord/capture/collector.rb +31 -0
  14. data/lib/reqcord/capture/integration_patch.rb +209 -0
  15. data/lib/reqcord/capture/minitest_context.rb +34 -0
  16. data/lib/reqcord/capture/rspec_context.rb +42 -0
  17. data/lib/reqcord/capture/test_context.rb +25 -0
  18. data/lib/reqcord/capture.rb +19 -0
  19. data/lib/reqcord/configuration.rb +198 -0
  20. data/lib/reqcord/dataset.rb +176 -0
  21. data/lib/reqcord/endpoint.rb +263 -0
  22. data/lib/reqcord/errors.rb +9 -0
  23. data/lib/reqcord/exporters/curl.rb +68 -0
  24. data/lib/reqcord/exporters/markdown.rb +295 -0
  25. data/lib/reqcord/exporters/postman.rb +206 -0
  26. data/lib/reqcord/exporters.rb +32 -0
  27. data/lib/reqcord/generator.rb +364 -0
  28. data/lib/reqcord/railtie.rb +51 -0
  29. data/lib/reqcord/renderers/curl.rb +56 -0
  30. data/lib/reqcord/renderers/payload.rb +69 -0
  31. data/lib/reqcord/request_example.rb +104 -0
  32. data/lib/reqcord/response_example.rb +72 -0
  33. data/lib/reqcord/route_collector.rb +242 -0
  34. data/lib/reqcord/sanitizers/sanitizer.rb +140 -0
  35. data/lib/reqcord/schema.rb +187 -0
  36. data/lib/reqcord/support.rb +58 -0
  37. data/lib/reqcord/version.rb +5 -0
  38. data/lib/reqcord.rb +78 -0
  39. data/lib/tasks/reqcord.rake +99 -0
  40. data/reqcord.gemspec +60 -0
  41. metadata +165 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a786e42c21b820aeb729b9b401a4dc61fe61e6946e27d5f615186cbffe1b554c
4
- data.tar.gz: b6fa31a65a90c88c20b51329b34cef327436890700b43fe07f43369056a18e3b
3
+ metadata.gz: 71c23f11e62a357bbc63bc7479cd77d65da3245062b9c0594e4b3d3dc0421fd2
4
+ data.tar.gz: d20cfd0db3a617adc966f2641da79c155be232baad7fb94b47db235820da3a2d
5
5
  SHA512:
6
- metadata.gz: 0d4bc1a375c768e8f025f555887c341a39eb980841f6f49eb7de5ca1f5f78a82dff51ad5b554d91b434da042d73d2abe446f159d41ad4e7a54e646f5b64f428d
7
- data.tar.gz: 80b569646f903b92d778af3dd00f140817b8f308213074022b8b9bc050307bf0f83ed076cfc5a2f7598c5bc9b6cde43c3f5b08c540a116c79d4cac09f83103c4
6
+ metadata.gz: a5c2d1ebe2463d5c3647e843d4f70b04114fe3d225a8059b5e6e09d9461945305203c5bbfe4189039a8b48edc713cf39a3d0e5cafadefb6648f62f70aaff4595
7
+ data.tar.gz: 98406f42d54d21b3d7854a4b36960be53cfe0293be738ca1d1e64194215920b4194c30649a730662e078d4b9558298c1ec9a13d15096207bb4a99257733d4b1f
data/CHANGELOG.md ADDED
@@ -0,0 +1,90 @@
1
+ # Changelog
2
+
3
+ ## [0.1.2] - Unreleased
4
+
5
+ ### Added
6
+
7
+ * Rails 7.1 and 7.2 are supported alongside 8.x (Ruby 3.2+); CI runs every
8
+ supported Ruby × Rails pair through `gemfiles/`.
9
+
10
+ ### Fixed
11
+
12
+ * CI resolves the bundle per Ruby (no committed `Gemfile.lock`) and pins
13
+ `json < 3` for development: activesupport 8.1 calls `JSON.parse(json,
14
+ options)`, a signature json 3.0 dropped.
15
+
16
+ ## [0.1.1] - 2026-09-15
17
+
18
+ ### Added
19
+
20
+ * Postman Collection v2.1 exporter (`postman/collection.json`), on by default.
21
+ Folders follow controller namespaces, requests come from the successful
22
+ captured example, every captured status is a saved response, sanitizer
23
+ placeholders become collection variables and `Bearer {{token}}` becomes
24
+ collection-level auth. Hoppscotch imports the same file.
25
+ * Request parameters (`parameters.path/query/body`) and response fields
26
+ (`responses[].schema`) inferred per endpoint from accepted requests, written
27
+ to `dataset.json` (`schema_version: 2`) and rendered as typed tables in
28
+ Markdown, with closed value sets listed (`"active" | "passive"`).
29
+ * Full route table coverage: `match … via: [:get, :post]` becomes one endpoint
30
+ per verb, `via: :all` is documented per verb the tests used, mounted engines
31
+ are walked under their mount path, `resource :cart` and `root` are titled
32
+ sensibly, optional segments and globs are path parameters.
33
+ * PATCH/PUT twins of `update` fold into one endpoint (`also_methods`).
34
+ * Resources are grouped by full controller path, so `admin/customers` and
35
+ `api/v2/customers` get separate directories and Postman folders.
36
+ * The run reconciles the route table:
37
+ `routes = documented + uncovered + skipped`, with redirects and Rack mounts
38
+ counted as skipped instead of vanishing.
39
+ * `RESOURCE=` accepts the singular (`cart`) and the controller path.
40
+ * `route_name` (the `as:` name) is kept in the dataset.
41
+ * `Renderers::Payload`: the JSON/form and query-flattening decisions shared by
42
+ cURL and Postman.
43
+ * `test.paths`: name the directories (or files, or globs) the API tests live
44
+ in and Reqcord picks the runner — `bin/rails test`, `rspec`, or a plain Ruby
45
+ runner when the project has no `bin/rails`. `test.command` still wins when
46
+ given, and its globs now expand.
47
+ * Three-resource examples (`customers`, `users`, `tasks`) in both
48
+ `examples/test-app` and `examples/spec-app`.
49
+
50
+ ### Changed
51
+
52
+ * Canonical cURL comes only from captured 2xx requests; error-case payloads
53
+ stay as response examples.
54
+ * Endpoint Markdown/cURL files are written only when a successful request was
55
+ captured; uncovered routes are listed under `uncovered_routes` and in the
56
+ index.
57
+ * Form bodies render as `--data 'a=b'` / `urlencoded`, never re-invented as
58
+ JSON.
59
+ * `reqcord:init` defaults `test.command` to `bin/rails test`.
60
+
61
+ ### Fixed
62
+
63
+ * `Endpoint#add_exchange` records the response status on the request, so the
64
+ public API produces documented endpoints without extra setup.
65
+ * `RequestExample.from_h` / `ResponseExample.from_h` ignore keys written by a
66
+ newer Reqcord.
67
+ * A request that produced a different status is kept as its own example even
68
+ when sanitization makes it read like an earlier one (a right and a wrong
69
+ password both become `{{password}}`), so test order can no longer decide
70
+ whether a login endpoint counts as covered.
71
+ * A parameter is only `required` when every accepted request carried it; a
72
+ request accepted with no parameters at all now counts, so `?status=` on a
73
+ list endpoint is documented as optional.
74
+ * Response fields list a closed set of values only when the values look like
75
+ tokens (`"open" | "done"`); fixture names and SKUs that merely repeat across
76
+ responses are shown as one example.
77
+
78
+ ## [0.1.0]
79
+
80
+ * RSpec request spec support (`test.framework: rspec`)
81
+ * Runnable Minitest and RSpec examples under `examples/`
82
+ * Minitest integration test capture for Rails 8, written to a lockable
83
+ capture file so parallel test workers can share it
84
+ * Rails route discovery and endpoint grouping
85
+ * `reqcord.yml` configuration
86
+ * Header and body sanitization
87
+ * Canonical `dataset.json`
88
+ * Markdown documentation with generated cURL examples
89
+ * Resource and API version filtering
90
+ * Routes with no captured example are reported as documentation gaps
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
6
+
7
+ # activesupport 8.1.3.1 calls JSON.parse(json, options), a signature json 3.0
8
+ # dropped, so every JSON request body fails to parse with a 400. Development
9
+ # only: the gemspec leaves json to the host application and to Rails.
10
+ gem "json", "< 3"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Ahmet Saridogan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.