Skip to content

Commit 44c2891

Browse files
committed
[API] Generator: Fix module definition in generated classes
1 parent 71689fc commit 44c2891

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

elasticsearch-api/utils/thor/generate_source.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def generate
6868
@http_path = __http_path
6969
@required_parts = __required_parts
7070

71+
@module_namespace.shift if @module_namespace.first == 'xpack'
7172
@path_to_file = @output.join(@module_namespace.join('/')).join("#{@method_name}.rb")
7273
dir = @output.join(@module_namespace.join('/'))
7374
empty_directory(dir, verbose: false)

elasticsearch-api/utils/thor/templates/method.erb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
# See the LICENSE file in the project root for more information
44

55
module Elasticsearch
6+
<%- if @xpack -%>
7+
<%= ' '*(@namespace_depth) %>module XPack
8+
<%- end %>
69
<%= ' '*(@namespace_depth) %>module API
710
<%- @module_namespace.each_with_index do |name, i| -%>
8-
<%= ' '*i %>module <%= name == 'xpack' ? 'XPack' : name.capitalize %>
11+
<%= ' '*i %>module <%= name.capitalize %>
912
<%- end -%>
1013
<%= ' '*(@namespace_depth+2) %>module Actions
1114
<%= ERB.new(File.new("./thor/templates/_documentation_top.erb").read, trim_mode: '-').result(binding) -%>

0 commit comments

Comments
 (0)