lazy_api_doc 0.1.6 → 0.2.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +22 -3
- data/docs/example/api.yml +1355 -0
- data/docs/example/index.html +24 -0
- data/docs/example/layout.yml +14 -0
- data/lib/generators/lazy_api_doc/install_generator.rb +42 -14
- data/lib/lazy_api_doc/generator.rb +22 -15
- data/lib/lazy_api_doc/route_parser.rb +6 -6
- data/lib/lazy_api_doc/variants_parser.rb +2 -2
- data/lib/lazy_api_doc/version.rb +1 -1
- data/lib/lazy_api_doc.rb +92 -51
- data/screenshot.png +0 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f0e518996dd248ab2ae4db3fff35867c58ef74810786fa49f7de71218cb45bf
|
4
|
+
data.tar.gz: 3885d2a3adbc40da030de0647ab19f5afb0b8d5268f7076988e65f300b2b75a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc95af1ff9d2fa9f593e8198d6b7909e1ae6d9ab364ceee1e33cad60687eac8b4543a9385e700bd3ba5858236f087f94830b863c6d0e9999ffd8065ae510296d
|
7
|
+
data.tar.gz: 442a7d980e4b867eaa7f880452058ff9f95754a76c42e3704b59e75d07fd06bf68bf2809c7ed879704ad87120391c24d8d0dd766af0584601e8fb0615737c724
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
# LazyApiDoc
|
2
2
|
|
3
|
-
A library to generate OpenAPI V3 documentation from tests.
|
3
|
+
A library to generate OpenAPI V3 documentation from tests. Try out the results
|
4
|
+
[here](https://bguban.github.io/lazy_api_doc/example).
|
4
5
|
|
5
6
|
LazyApiDoc collects requests and responses from your controller and request specs, retrieves data types, optional
|
6
7
|
attributes, endpoint description and then generates OpenAPI documentation.
|
7
8
|
|
9
|
+

|
10
|
+
|
8
11
|
## Installation
|
9
12
|
|
10
13
|
Add this line to your application's Gemfile:
|
@@ -25,6 +28,22 @@ Then run install task
|
|
25
28
|
|
26
29
|
$ rails g lazy_api_doc:install
|
27
30
|
|
31
|
+
## Configuration
|
32
|
+
|
33
|
+
You can customize LazyApiDoc behavior using config file or environment variables.
|
34
|
+
|
35
|
+
```yaml
|
36
|
+
# config/lazy_api_doc.yml
|
37
|
+
|
38
|
+
# base directory for storing layout files and generated documentation
|
39
|
+
path: 'doc/lazy_api_doc' # ENV['LAZY_API_DOC_PATH'] default: 'public/lazy_api_doc'
|
40
|
+
|
41
|
+
# TTL for files generated by running tests in different processes (ParallelTest). Each process generates a file.
|
42
|
+
# After all the processes are done one of them collects all example files and generates the documentation. In case
|
43
|
+
# when the example files were not deleted before running the tests, old files will be ignored.
|
44
|
+
example_file_ttl: 1800 # ENV['LAZY_API_DOC_EXAMPLE_FILE_TTL'] default: 1800 (30 minutes)
|
45
|
+
```
|
46
|
+
|
28
47
|
## Usage
|
29
48
|
|
30
49
|
Update files `public/lazy_api_doc/index.html` and `public/lazy_api_doc/layout.yml`. These files will be
|
@@ -33,11 +52,11 @@ so on.
|
|
33
52
|
|
34
53
|
And just run your tests with `DOC=true` environment variable:
|
35
54
|
|
36
|
-
$
|
55
|
+
$ LAZY_API_DOC=true rspec
|
37
56
|
|
38
57
|
or
|
39
58
|
|
40
|
-
#
|
59
|
+
# LAZY_API_DOC=true rake test
|
41
60
|
|
42
61
|
The documentation will be placed `public/lazy_api_doc/api.yml`. To see it just run server
|
43
62
|
|