Skip to content

Commit

Permalink
Merge pull request #582 from yandex/release
Browse files Browse the repository at this point in the history
Fixes from release
  • Loading branch information
fomars authored May 3, 2018
2 parents 85a1c81 + 7261191 commit c17bc47
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions yandextank/validator/docs_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
EXAMPLES = 'examples'
ANYOF = 'anyof'
NO_DSC = '(no description)'
VALIDATOR = 'validator'


class TextBlock(object):
Expand Down Expand Up @@ -306,14 +307,14 @@ def scalar_formatter(self, renderer, header=True):
hdr = renderer.subtitle(renderer.mono(self.option_name) + ' ' + '({})'.format(self.option_kwargs.get(TYPE))) \
if header else ''
dsc = self.format_dsc(renderer)
body = render_body(renderer, self.option_kwargs, [TYPE, DESCRIPTION, DEFAULT, REQUIRED], {'allowed': allowed})
body = render_body(renderer, self.option_kwargs, [VALIDATOR, TYPE, DESCRIPTION, DEFAULT, REQUIRED], {'allowed': allowed})
return '\n'.join([_ for _ in [hdr, dsc, body] if _])

def scalar_with_values_description(self, renderer, header=True):
hdr = renderer.subtitle(renderer.mono(self.option_name) + ' ' + '({})'.format(self.option_kwargs.get(TYPE))) \
if header else ''
dsc = self.format_dsc(renderer)
body = render_body(renderer, self.option_kwargs, [TYPE, DESCRIPTION, DEFAULT, REQUIRED, ALLOWED, VALUES_DSC])
body = render_body(renderer, self.option_kwargs, [VALIDATOR, TYPE, DESCRIPTION, DEFAULT, REQUIRED, ALLOWED, VALUES_DSC])
values_description_block = render_values_description(renderer, self.option_kwargs)
return '\n'.join([_ for _ in [hdr, dsc, body, values_description_block] if _])

Expand All @@ -327,7 +328,7 @@ def dict_formatter(self, renderer, header=True):
schema_block = renderer.field_list({
'{} ({})'.format(renderer.mono(key), dict_schema[key][TYPE]): get_formatter({key: value})(renderer, header=False)
for key, value in dict_schema.items()})
body = render_body(renderer, self.option_kwargs, [TYPE, DESCRIPTION, DEFAULT, REQUIRED, SCHEMA])
body = render_body(renderer, self.option_kwargs, [VALIDATOR, TYPE, DESCRIPTION, DEFAULT, REQUIRED, SCHEMA])
return '\n'.join([_ for _ in [hdr, dsc, schema_block, body] if _])

def anyof_formatter(self, renderer, header=True):
Expand All @@ -337,7 +338,7 @@ def anyof_formatter(self, renderer, header=True):
dsc = self.format_dsc(renderer)
values_description_block = render_values_description(renderer, self.option_kwargs) \
if VALUES_DSC in self.option_kwargs else ''
body = render_body(renderer, self.option_kwargs, [TYPE, DESCRIPTION, DEFAULT, REQUIRED, ANYOF, VALUES_DSC])
body = render_body(renderer, self.option_kwargs, [VALIDATOR, TYPE, DESCRIPTION, DEFAULT, REQUIRED, ANYOF, VALUES_DSC])

return '\n'.join([_ for _ in [hdr, dsc, values_description_block, body] if _])

Expand All @@ -347,7 +348,7 @@ def list_formatter(self, renderer, header=True):
' ' +
'({} of {})'.format(self.option_kwargs.get(TYPE, LIST), schema.get(TYPE, '')))
dsc = self.format_dsc(renderer)
body = render_body(renderer, self.option_kwargs, [TYPE, DEFAULT, REQUIRED, DESCRIPTION, SCHEMA])
body = render_body(renderer, self.option_kwargs, [VALIDATOR, TYPE, DEFAULT, REQUIRED, DESCRIPTION, SCHEMA])
if set(schema.keys()) - {TYPE}:
schema_block = renderer.field_list({
'[list_element] ({})'.format(schema.get(TYPE, '')):
Expand Down

0 comments on commit c17bc47

Please sign in to comment.