Skip to content

Fix incompatibility with the latest json schema v4 updates before updating jsen #86

@TysonAndre

Description

@TysonAndre

Related to https://github.com/bugventure/jsen/issues/52

This will be a breaking change, and require changes to monocle-api and the applications using it.

diff --git a/lib/RequestRouter.js b/lib/RequestRouter.js
index e981568..822bcf4 100644
--- a/lib/RequestRouter.js
+++ b/lib/RequestRouter.js
@@ -209,6 +209,10 @@ function cleanParamKey(key) {
 
 function castParam(key, value, type) {
     var hasTypeError = false;
+    if (!type || !type.indexOf) {
+        // Type is not string or array?
+        return value;
+    }
 
     if (type.indexOf('boolean') !== -1) {
         switch(value) {
diff --git a/test/lib/Router_test.js b/test/lib/Router_test.js
index 9bae87f..7468d34 100644
--- a/test/lib/Router_test.js
+++ b/test/lib/Router_test.js
@@ -805,7 +805,7 @@ describe('API Router', function() {
                     this.meeSchema = {
                         type: 'object',
                         properties: {
-                            floatParam: {type: 'float'}
+                            floatParam: {type: 'number'}
                         }
                     };
 
@@ -1712,7 +1712,7 @@ describe('API Router', function() {
                             }
                         },
                         param4: {type: 'integer'},
-                        param5: {type: 'date-time'}
+                        param5: {format: 'date-time'}
                     }
                 };
                 this.postObjSpy = sinon.spy(function(request, connection) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions