Skip to content

Commit

Permalink
Fixes desc generation if now useful prop is in content. (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeFnord authored Oct 24, 2023
1 parent 43e0684 commit 00266bc
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/starter/importer/description.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@ def initialize(content:)
@content = content
end

def to_s
def to_s # rubocop:disable Metrics/AbcSize
return if content.blank?

desc = content['summary'] || name
desc = content['summary'] || content['operationId']
entry = "desc '#{desc}'\n"

entry = "desc '#{desc}' do\n"
return entry unless block_keys.intersect?(content.keys)

entry.sub!("\n", " do\n")
entry << " detail '#{content['description']}'\n" if content.key?('description')
entry << " tags #{content['tags']}\n" if content.key?('tags')
entry << 'end'

entry
end

def block_keys
%w[
description
tags
]
end
end
end
end

0 comments on commit 00266bc

Please # to comment.