Skip to content

Instantly share code, notes, and snippets.

View MathRobin's full-sized avatar
🌍
<3

Mathieu KIM ROBIN MathRobin

🌍
<3
  • CTO Airporting
  • Pessac, Gironde, France
View GitHub Profile
@MathRobin
MathRobin / index.js
Created October 31, 2019 10:06
object to json oas
function doc (obj){
var res = {};
_.each(obj, function (val, key) {
if(_.isArray(val)) {
res[key] = {"type": "array", items:{type:"object","properties": doc(val)}};
} else if(_.isObject(val)) {
res[key] = {"type": "object","properties": doc(val)};
} else if(_.isString(val)){
res[key] = {type:'string'};
} else if(_.isInteger(val)){