Commit 004dfb93 authored by Lionel Morin's avatar Lionel Morin Committed by Matthieu Lamalle

Modify API v1 message arg to be positional

parent 82ea3dee
......@@ -3,7 +3,7 @@ from collections import OrderedDict
from os.path import join, basename, dirname
from glob import glob
from tiramisu import StrOption, IntOption, BoolOption, ChoiceOption, OptionDescription, Config
from tiramisu import StrOption, IntOption, BoolOption, ChoiceOption, OptionDescription, Config, SymLinkOption
ALLOW_PRIVATE = False
ROOTPATH = join('..')
......@@ -54,7 +54,10 @@ def _parse_args(message_def,
if arg.ref:
needs.setdefault(message_def.uri, {}).setdefault(arg.ref, []).append(name)
for name, arg in new_options.items():
options.append(_get_option(name, arg, file_path))
current_opt = _get_option(name, arg, file_path)
options.append(current_opt)
if arg.shortarg:
options.append(SymLinkOption(arg.shortarg, current_opt))
def _parse_responses(message_def,
......@@ -74,12 +77,12 @@ def _parse_responses(message_def,
param_type = param_type[2:]
if param_type in ['Dict', 'File']:
pass
if message_def.response.parameters is not None:
for name, obj in message_def.response.parameters.items():
if name in responses:
raise Exception('multi response with name {} in {}'.format(name, file_path))
descr = obj.description.strip().rstrip()
keys['']['columns'][name] = {'description': obj.description,
'type': obj.type}
......@@ -139,7 +142,7 @@ def _get_root_option(optiondescriptions):
options_obj = [ChoiceOption('message',
'Sélectionner le message.',
tuple(messages),
properties=frozenset(['mandatory']))]
properties=frozenset(['mandatory', 'positional']))]
for name, options_descr in optiondescriptions.items():
description, options = options_descr
if len(options) != 1:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment