Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Fix for #668 and #669. These add defaults for Files and Arrays.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpbelang committed Nov 3, 2019
1 parent e4faa92 commit cfce124
Show file tree
Hide file tree
Showing 3 changed files with 261 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ public Node getDefaultValue(Node parent)
{
return new NativeTypeExpressionNode(TypeId.OBJECT.getType());
}
if (parent.get("items") != null)
{
return new NativeTypeExpressionNode(TypeId.ARRAY.getType());
}
if (parent.get("fileTypes") != null)
{
return new NativeTypeExpressionNode(TypeId.FILE.getType());
}

return new OverridableNativeTypeExpressionNode(defaultType.getType());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#%RAML 1.0
# Adding more tests for defaults based on facets (Arrays and Files...add more as required)
title: My API
mediaType: application/json

types:
someArray:
items:
properties:
Foo: integer
Bar: string
fireworks:
description: This is a new DataType
fileTypes:
- image/gif

/resource:
post:
body:
application/json:
type: array
items: integer
example: [1, 2]

/other_resource:
post:
body:
application/json:
items:
properties:
Foo: integer
Bar: string
example:
[{"Foo": 1, "Bar": "Qux"}]
Loading

0 comments on commit cfce124

Please sign in to comment.