Skip to content

Commit

Permalink
Merge pull request #253 from asam-ev/246-show-enums-from-schemas-in-d…
Browse files Browse the repository at this point in the history
…ocumentation

Add enums to documentation
  • Loading branch information
ClemensLinnhoff authored Dec 18, 2024
2 parents 4e81064 + 140220f commit 55a62e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/json2asciidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def generate_asciidoc_properties(properties: Dict, required_fields: List[str], l
property_type = escape_special_chars(prop_data['type'])
asciidoc_content += f"\n*Type:* `+{property_type}+` +"

# Add enum options
if "enum" in prop_data:
asciidoc_content += f"\n*Enum:* `+{prop_data['enum']}+` +"

# Add pattern inline and handle escaping of backslashes and curly braces
if "pattern" in prop_data:
pattern = escape_special_chars(prop_data['pattern'])
Expand All @@ -104,6 +108,9 @@ def generate_asciidoc_properties(properties: Dict, required_fields: List[str], l
) + "\n"
else:
# Simple array, include the description of the array
# Add enum options
if "enum" in prop_data['items']:
asciidoc_content += f"\n*Items enum:* `+{prop_data['items'].get('enum', '')}+` +"
asciidoc_content += f"\n{prop_data['items'].get('description', '')}\n"

asciidoc_content += "\n"
Expand Down

0 comments on commit 55a62e1

Please sign in to comment.