Skip to content

Commit 58c8c4f

Browse files
committed
[API] Generator: Adds env variable to ignore version in source docs url
1 parent ec84fc3 commit 58c8c4f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

elasticsearch-api/utils/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ $ thor code:generate
1818

1919
- The Ruby code will be generated in `elasticsearch-api/lib/elasticsearch/api/actions`.
2020
- The generator runs Rubocop to autolint and clean up the generated files.
21+
- You can use the environment variable `IGNORE_VERSION` to ignore the current version of the client when generating the source code documentation urls. This is currently used when generating code from `main`:
22+
23+
```bash
24+
$ IGNORE_VERSION=true thor code:generate
25+
```
2126

2227
### Development
2328

elasticsearch-api/utils/thor/generator/files_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def self.documentation_url(documentation_url)
4949
regex = /([0-9]{1,2}\.[0-9x]{1,2})/
5050
version = Elasticsearch::API::VERSION.match(regex)[0]
5151
# TODO - How do we fix this so it doesn't depend on which branch we're running from
52-
if version == '8.0'
52+
if ENV['IGNORE_VERSION']
5353
documentation_url
5454
else
5555
documentation_url.gsub(/\/(current|master|main)\//, "/#{version}/")

0 commit comments

Comments
 (0)