Skip to content

Commit

Permalink
Fix alias field generation in docs (#9269) (#9498)
Browse files Browse the repository at this point in the history
Alias fields documented in the fields list were not correct. The reason is that `path` was used in our generation of the docs for a different puprose. This one was renamed and reporting of path was added for field alias.

(cherry picked from commit 753566b)
  • Loading branch information
ruflin authored Dec 11, 2018
1 parent 661641c commit 3283a9a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions libbeat/scripts/generate_fields_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ def document_fields(output, section, sections, path):
document_field(output, field, newpath)


def document_field(output, field, path):
def document_field(output, field, field_path):

if "path" not in field:
field["path"] = path
if "field_path" not in field:
field["field_path"] = field_path

output.write("*`{}`*::\n+\n--\n".format(field["path"]))
output.write("*`{}`*::\n+\n--\n".format(field["field_path"]))

if "deprecated" in field:
output.write("\ndeprecated[{}]\n\n".format(field["deprecated"]))
Expand All @@ -57,7 +57,8 @@ def document_field(output, field, path):
output.write("format: {}\n\n".format(field["format"]))
if "required" in field:
output.write("required: {}\n\n".format(field["required"]))

if "path" in field:
output.write("alias to: {}\n\n".format(field["path"]))
if "description" in field:
output.write("{}\n\n".format(field["description"]))

Expand All @@ -71,7 +72,7 @@ def document_field(output, field, path):

if "multi_fields" in field:
for subfield in field["multi_fields"]:
document_field(output, subfield, path + "." + subfield["name"])
document_field(output, subfield, field_path + "." + subfield["name"])
output.write("--\n\n")


Expand Down

0 comments on commit 3283a9a

Please sign in to comment.