[CONTROLLER-596] Swagger UI is failing to load Created: 03/Jul/14  Updated: 07/Jul/14  Resolved: 07/Jul/14

Status: Resolved
Project: controller
Component/s: restconf
Affects Version/s: Helium
Fix Version/s: None

Type: Bug
Reporter: Devin Avery Assignee: Devin Avery
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Mac OS
Platform: PC


External issue ID: 1290

 Description   

The swagger UI is no longer rendering any of the possible end points and if you look at the browser developer tools you see an exception getting thrown from the browser java script.



 Comments   
Comment by Devin Avery [ 03/Jul/14 ]

The cause:

I found the cause of this problem. The backend swagger documentation code that generated the JSON model for the yang file made the assumption that you can have two "types" for a property. However swagger is choking on that.

It appears that in swagger we were generating a list of types for the "Unions" that were defined in yang. We didn't actually have any unions in exposed models until OPNFLWPLUG-121 introduce a union in the port types yang file for port-number.

The Fix:

For union types, instead of passing back an array of types, we just append the multiples types together into a string with 'or'. So:

leaf port-number {
type union

{ type uint32; type string; }

}

becomes "integer or string" instead of "

{ 'integer', 'string' }

".

Swagger will now display that without any problem.

Comment by Devin Avery [ 03/Jul/14 ]

https://git.opendaylight.org/gerrit/8604

Generated at Wed Feb 07 19:53:25 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.