question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Follow-up for 653 Issue - Duplicate operationIds and underscore symbol - AutoRest has a bug around underscores

See original GitHub issue

The issue #653 mentions an article about how to solve the problem with duplicate operationIds generated by Swashbuckle.

Duplicate operationId is not only Swashbuckle fault, Autorest can’t parse OperationId with more than one underscore correctly: so if your operationIds are :

"operationId": "Debug_Get",
"operationId": "Debug_GetByid",
"operationId": "Debug_ReceiveCommandByjsonData",
"operationId": "Debug_Get2Bymodel",

Autorest will work fine.

if you have some prefixed operationIds like (they are still unique though):

"operationId": "V1_Debug_Get",
"operationId": "V1_Debug_GetByid",
"operationId": "V1_Debug_ReceiveCommandByjsonData",
"operationId": "V1_Debug_Get2Bymodel",

Autorest fails to interpert these operationIds correctly - you’ll get a message

error: [FATAL] Error generating client model: Found operation objects with duplicate operationId ‘V1_Debug’. OperationId must be unique among all operations described in the API.

It was mentioned by @VR-Architect in #651 that it was fixed in v.0.14, but I checked valid swagger.json with both v.0.15 and v.0.14 and they are both failing to parse operationid when it has more than one underscore.

As soon as I update swagger definition to have operationId with just one underscore - it works fine.

It seems like an issue in AutoRest operationId parsing.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:22 (10 by maintainers)

github_iconTop GitHub Comments

11reactions
mossyblogcommented, Jan 11, 2017

If you need a case study for why verb_another_verb_whatever etc is going to continue then look no further than EVE Online - https://esi.tech.ccp.is/latest/swagger.json?datasource=tranquility

Point is if you’re going to walk into this entire “AutoRest” with the attitude of “if its not within our bubble, its not at all” then you’ve learned nothing from our days with SOAP.

Deferring for “stable” is also a weak avoidance behaviour. Address the issue and keep this open until you’ve confined the solution to a reasonable approach. GitHub isn’t Microsoft Connect and the days of when we used to triage problematic issues like this with “as per design” or “deferred to x” isn’t going to work with OSS space.

This is how you bank hate debt with developers.

2reactions
fearthecowboycommented, Jan 18, 2017

I have never been a fan of the implicit decision in AutoRest to parse the operationId and use that as the basis for choosing “method-group” and “method” names. Seems kinda hacky to me to begin with.

AutoRest is replete with implicit assumptions … such is the life when you inherit a codebase.

Later this week, we’re starting work on an overhauled configuration system that will make it simpler to override behavior in the code generation process (by providing an external file that contains the information to the generator), without having to edit the swagger file itself (which helps not only @bowman-jm 's scenario of an automated swagger generation, but others who don’t want to pollute the swagger with information that doesn’t really describe the wire-behavior)

It should not be terribly difficult to provide an override for methodgroup and method name on a per-operation basis in there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate operationIds and underscore symbol - Bountysource
Follow-up for 653 Issue - Duplicate operationIds and underscore symbol - AutoRest has a bug around underscores.
Read more >
getting duplicate operationid when trying to create rest api
I finally had to go back and remove every underscore '_' in my model and controller. I removed them in the database table...
Read more >
Wi-Fi-Hotspot not working while AFWall+ is enabled - Java afwall
Adding a custom script solves the problem: $IPTABLES -A afwall-3g-tether -p tcp ... Duplicate operationIds and underscore symbol - AutoRest has a bug...
Read more >
OpenAPI (f.k.a Swagger) Specification code generator ...
Follow-up for 653 Issue - Duplicate operationIds and underscore symbol - AutoRest has a bug around underscores. The issue #653 mentions an ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found