OpenAPI-Specification icon indicating copy to clipboard operation
OpenAPI-Specification copied to clipboard

Enhancement - label on Resource Object

Open rmullinnix opened this issue 11 years ago • 10 comments

Request to add a label field to the Resource Object and display that on the swagger-ui if present instead of the path field.

Reason - I use a library that generates the swagger spec from service at runtime with endpoint of /swagger. I have a top level service that generates a Resource Listing from a registry of active services. In the swagger-ui, each service shows up with a label of "swagger" (i.e., the path). So I get a multi-service list of .../registration/swagger, .../identity/swagger, etc. which just displays the last node in the path ("swagger").

screen shot 2015-02-03 at 9 44 56 am

Screen shot with mod to swagger-ui.js to display label (temporary hack on older version). screen shot 2015-02-03 at 9 46 35 am

rmullinnix avatar Feb 03 '15 15:02 rmullinnix

That's actually already resolved in Swagger 2.0 as there are no longer resources but tags. You can assign a path to zero or more tags, and it will appear in all of them in the UI. If there are no tags, the ui will put them under the 'default' group. Hope this helps.

webron avatar Feb 03 '15 18:02 webron

Looks like I'll have to update my library to generate a 2.0 spec as opposed to 1.2. Go figure, submit a request and generate work for myself. Cheers.

rmullinnix avatar Feb 03 '15 18:02 rmullinnix

The best kind of issues ;-)

webron avatar Feb 03 '15 18:02 webron

I feel your pain but 1.2 is a done deal so making enhancements to it doesn't make sense when its successor is already out.

whitlockjc avatar Feb 03 '15 18:02 whitlockjc

Definitely puts a crimp in my procrastination efforts. ;-) Btw, cool product guys. We're starting the full roll out to our dev staff this next week.

rmullinnix avatar Feb 03 '15 18:02 rmullinnix

And you're releasing your cool library as a FOSS?!

webron avatar Feb 03 '15 19:02 webron

Of course. I prototype in Go in a Java dev shop, so most of my stuff goes FOSS. Just need to improve my lack of documentation skills.

rmullinnix avatar Feb 03 '15 19:02 rmullinnix

Documentation is for weak people.

webron avatar Feb 03 '15 20:02 webron

I have the basics done to produce a 2.0 doc on a single service. Have some work to do on complex types in the definitions section as well as the security portion. The schema object is a beast. I have a few ideas to aggregate multiple services into a single doc, but can already see some complications. I'll use the forum as I hit roadblocks. One thing I see is name collision in the definitions section. One idea to help would be a namespace attribute in the schema. The thing driving the single page of services is that we're pursuing micro services and feel a single inventory will promote reuse.

I am getting the error icon on the page, but since I'm behind the firewall, the debugger redirect doesn't work. I paste the json in the Swagger Editor and it says it's a valid doc. No biggie right now.

If you want samples for the spec (see a lot of TODO), let me know.

rmullinnix avatar Feb 05 '15 13:02 rmullinnix

Sure thing, would be happy to help where possible. Feel free to join us on IRC as well for a more interactive conversation if you want.

webron avatar Feb 05 '15 13:02 webron