ohm icon indicating copy to clipboard operation
ohm copied to clipboard

Clashing (identically-defined) pathItem keys

Open cbornet opened this issue 5 years ago • 2 comments

Comment from @mikeralphson on the blog post:

If you use single value enums, won't you hit the problem of clashing (identically-defined) pathItem keys? How would you distinguish them? Hence my suggestion to dynamically build the enum lists based on allowable values for the parameter (maybe within a page range etc to prevent the list being too large).

cbornet avatar Nov 11 '20 13:11 cbornet

That's a problem of OAI using a map for pathItems. I could have chosen to directly reference an array of pathItems in controls but then it wouldn't be 100% compatible with existing tools and libs (eg. swagger-ui) which is I think a strength ot the OHM format. Eg in the paging implementation, you can have 2 links with the same path+method (eg. "first page" and "previous page"). I worked around it by setting a fragment in the path to distinguish the 2 affordances. This fragment being ignored server-side. The problem of an enum list is that if you have several params, you don't know which combination of enum is allowed. And I don't see how to associate an affordance (eg. "first page") to an enum value.

cbornet avatar Nov 11 '20 15:11 cbornet

Swagger-ui currently doesn't support fragments : https://github.com/swagger-api/swagger-ui/issues/6620 So the OHM-browser has been patched to remove the fragment before doing the request.

cbornet avatar Nov 16 '20 14:11 cbornet