Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into CIAC-9930-xsiam_con…
Browse files Browse the repository at this point in the history
…tent_items
  • Loading branch information
yucohen committed Jun 4, 2024
2 parents 4674b16 + 794d9a1 commit b3f7e98
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .changelog/4320.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changes:
- description: Fix an issue in `generate-docs` when integration commands arguments are missing descriptions.
type: fix
pr_number: 4320
1 change: 1 addition & 0 deletions demisto_sdk/commands/generate_docs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from demisto_sdk.commands.run_cmd.runner import Runner

STRING_TYPES = (str, bytes) # type: ignore
DEFAULT_ARG_DESCRIPTION = "No description provided."


class HEADER_TYPE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
)
from demisto_sdk.commands.generate_docs.common import (
CONFIGURATION_SECTION_STEPS,
DEFAULT_ARG_DESCRIPTION,
add_lines,
build_example_dict,
generate_numbered_section,
Expand Down Expand Up @@ -936,7 +937,7 @@ def generate_single_command_section(
]
)
for arg in arguments:
description = arg.get("description")
description = arg.get("description", DEFAULT_ARG_DESCRIPTION)
if not description:
errors.append(
"Error! You are missing description in input {} of command {}".format(
Expand Down
47 changes: 47 additions & 0 deletions demisto_sdk/commands/generate_docs/tests/generate_docs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,53 @@ def test_integration_doc_credentials_display_missing(self, tmp_path: Path):
in readme_data
)

def test_missing_cmd_description(self, tmp_path: Path):
"""
Test generation of an integration README when one of the
command arguments is missing a description field.
Given:
- An integration YML.
When:
- The integration YML has a command that is missing
an argument description.
Then:
- The integration README is generated.
"""

yml_path = (
Path(__file__).parent
/ "test_files"
/ "test_missing_cmd_description"
/ "FTP.yml"
)

generate_integration_doc(str(yml_path), output=str(tmp_path))

assert (tmp_path / INTEGRATIONS_README_FILE_NAME).exists()

actual_text = (
(tmp_path / INTEGRATIONS_README_FILE_NAME).read_text().splitlines()
)
assert (
actual_text[54]
== f"| entry_id | {common.DEFAULT_ARG_DESCRIPTION} | Required | "
)
assert (
actual_text[55]
== f"| target | {common.DEFAULT_ARG_DESCRIPTION} | Required | "
)
assert (
actual_text[73]
== f"| file_path | {common.DEFAULT_ARG_DESCRIPTION} | Required | "
)
assert (
actual_text[74]
== f"| file_name | {common.DEFAULT_ARG_DESCRIPTION} | Required | "
)


class TestGetCommandExamples:
@staticmethod
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
category: Utilities
commonfields:
id: FTP
version: -1
configuration:
- display: ''
name: host
required: true
section: Connect
type: 0
- display: ''
name: user
required: false
section: Collect
type: 0
- display: ''
displaypassword: API Key
hiddenusername: true
name: passwd
required: true
section: Connect
type: 4
- advanced: true
display: Use system proxy settings
name: proxy
required: false
section: Connect
type: 8
description: 'FTP integration to download or upload file to remote ftp server. Please be noted that FTP transfer is insecure. Please use it with care. '
display: FTP
name: FTP
script:
commands:
- arguments:
- description: The path to list.
name: path
description: List all the files under current folder.
name: ftp-ls
- arguments:
- name: entry_id
required: true
- name: target
required: true
description: Upload file to ftp server.
name: ftp-put
- arguments:
- name: file_path
required: true
- name: file_name
required: true
description: Download file from ftp server.
name: ftp-get
dockerimage: demisto/python3:3.10.14.96411
runonce: false
script: ''
subtype: python3
type: python
fromversion: 6.0.0
tests:
- No tests (auto formatted)

0 comments on commit b3f7e98

Please sign in to comment.