Fork me on GitHub

if I have hyphens in my schema keys, like {:foo-tastic s/Int} is it possible to configure Ring Swagger to do some kind of property name conversion from foo-tastic to foo_tastic?


I'm wondering if its worth the trouble to use hyphens in schema keywords as they are causing trouble when converted to JSON.. but its the Clojure convention


there is a helper function ring.swagger.swagger2/transform-operations to walk through the endpoints before passing into ring-swagger. Still, you would have to do it on three places: 1) after parsing the body 2) when returning the body c) for the docs. Did that once, was not worth it. But, could be done. Example of a ring-swagger doc transformation:


thanks.. so do you just use underscores in your schemas if you're exposing some APIs ?


or more accurately, avoid hyphens? 🙂


depends on the project, have tried ‘em all I guess 🙂 Hyphens work with javascript too btw. Or are they illegal in the JSON spec?


yeah it works.. but i'd prefer the users of API to be able to use it like obj.property_name instead of obj["property-name"] .. im not sure of JSON spec


in ring swagger spec there's the :schema map entry.. does it have to be a symbol like MySchema or can it be just inline map ? I suppose inline should work ?


trying a different route, transforming the schema before i pass it to ring swagger.. using this to transform the schema:


i can transform the schema quite easily.. but for some reason :references ends up with my schemas, but there is no :properties


im not sure how the resolutions to :definitions works, but my transformed schema has :name in its metadata.. i suppose its required


@sammikko yes, the $ref is taken from the name. Haven’t uses the bijections lib, looks cool. There is also which retains the schema meta-data.


with walkers you could change the key names if that’s the case.


cool.. i think i found my problem.. i converted the keys in my schema map from keywords to strings and that didnt work in ring swagger.. im not sure if thats even supported in schema 🙂


now i just rename the keywords and seems to work


cool, ill check out schema-tools too


awesome! Schema allows String keys, ring-swagger might not be happy with those. Please write an issue if you need that.


there is a lovely use-case for Schema walkers in the schema-viz lib, like


bookmarked the bijections, thanks for the tip.


oh yeah, we actually used schema-viz too 🙂 it works but we ran into trouble when running on a headless server: No X11 DISPLAY variable was set, but this program performed an operation which requires it., compiling:(rhizome/viz.clj:27:1)


some problem in the underlying lib