| { | ||
| "$schema": "http://json-schema.org/draft-04/schema#", | ||
| "title": "Error", | ||
| "id": "error/error.schema.json", | ||
| "description": "A server error", | ||
| "type": "object", | ||
| "properties": { | ||
| "code": {"type": "string"}, | ||
| "messages": {"type": "string"}, | ||
| "status": {"type": "integer"}, | ||
| "owner" : {"$ref":"../owner.schema.json"} | ||
| }, | ||
| "required": [ | ||
| "code", | ||
| "messages", | ||
| "status", | ||
| "owner" | ||
| ] | ||
| } |
@@ -49,2 +49,5 @@ var deref, util; | ||
| data.property.comment = property.description; | ||
| if (property['$ref']) { | ||
| console.log(property['ref']); | ||
| } | ||
| switch (property.type) { | ||
@@ -69,5 +72,2 @@ case 'array': | ||
| data.innerClass.classMembers = aux.classMembers; | ||
| } else if (property["$ref"]) { | ||
| innnerSchema = refMap[property["$ref"].split("#")[0]]; | ||
| data.property.type = util.capitalize(innnerSchema.title); | ||
| } else { | ||
@@ -88,6 +88,7 @@ data.property.type = 'Map'; | ||
| data.property.type = "Integer"; | ||
| break; | ||
| case 'object': | ||
| data.property.type = "Map"; | ||
| } | ||
| if (property["$ref"]) { | ||
| innnerSchema = refMap[property["$ref"].split("#")[0]]; | ||
| data.property.type = util.capitalize(innnerSchema.title); | ||
| } | ||
| data.property.kind = annotation + ("(\"" + data.property.name + "\")"); | ||
@@ -94,0 +95,0 @@ return data; |
+1
-1
| { | ||
| "name": "raml2code", | ||
| "version": "0.0.15", | ||
| "version": "0.0.16", | ||
| "description": "Raml spec to code", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -40,3 +40,4 @@ fs = require('fs') | ||
| normSchema = deref(schema, schemas) | ||
| # console.log "norm", JSON.stringify(normSchema, null, 2) | ||
| # console.log "--", Object.keys deref.refs | ||
| model = {} | ||
@@ -43,0 +44,0 @@ model.className = normSchema.title |
@@ -34,2 +34,4 @@ deref = require('deref')(); | ||
| data.property.comment = property.description | ||
| if property['$ref'] | ||
| console.log property['ref'] | ||
| switch property.type | ||
@@ -54,7 +56,2 @@ when 'array' | ||
| data.innerClass.classMembers = aux.classMembers | ||
| #if object has references we map on the POJO | ||
| else if property["$ref"] | ||
| innnerSchema = refMap[property["$ref"].split("#")[0]] | ||
| data.property.type = util.capitalize(innnerSchema.title) | ||
| else | ||
@@ -66,4 +63,8 @@ data.property.type = 'Map' | ||
| when 'integer' then data.property.type = "Integer" | ||
| when 'object' then data.property.type = "Map" | ||
| #if object has $references we map on the POJO | ||
| if property["$ref"] | ||
| innnerSchema = refMap[property["$ref"].split("#")[0]] | ||
| data.property.type = util.capitalize(innnerSchema.title) | ||
| data.property.kind = annotation + "(\"#{data.property.name}\")" | ||
@@ -70,0 +71,0 @@ data |
@@ -39,3 +39,3 @@ { | ||
| "type": "array", | ||
| "items": { "$ref": "error.schema.json" } | ||
| "items": { "$ref": "error/error.schema.json" } | ||
| } | ||
@@ -42,0 +42,0 @@ }, |
Sorry, the diff of this file is not supported yet
42397
1.2%42
2.44%788
2.6%