Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse fails on non-unique nicknames. #154

Open
bedge opened this issue May 9, 2018 · 1 comment
Open

Parse fails on non-unique nicknames. #154

bedge opened this issue May 9, 2018 · 1 comment

Comments

@bedge
Copy link

bedge commented May 9, 2018

The app docs: https://github.com/mission-liao/pyswagger/blob/develop/docs/md/ref/app.md state:

call an API when its nickname is unique

App.op['getPetById']

call an API when its nickname collid with other resources

...

which implies that a non-unique nickname is OK.

However, on parsing, if nicknames are not used within the API, the parse fails if they are non-unique:

api_applications = App.create('./api_name.json')
...
~/.pyenv/versions/3.6.5/envs/3.6/lib/python3.6/site-packages/pyswagger/spec/v1_2/objects.py in init(self, ctx)
269 name = op.nickname
270 if name in new_api.keys():
--> 271 raise ValueError('duplication operation found: ' + name)
272
273 # Operation objects now have 'path' attribute.

ValueError: duplication operation found: get

Admittedly, not what I would have chosen for a nickname, but I'm dealing with a foreign API I have no control over.

@mission-liao
Copy link
Member

@bedge Yep, it's a behavior to tolerate the different between Swagger 1.2 to 2.0. But this exception should only raise when duplicated nickname found in the same resource, and it's unexpected. For example:

# OK
pet.updatePet
user.updatePet

# NOK
pet.updatePet
pet.updatePet

Could you check if this is your case, if not, could you help to provide a reproducible example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants