lib/schemacop/v3/node.rb in schemacop-3.0.4 vs lib/schemacop/v3/node.rb in schemacop-3.0.5
- old
+ new
@@ -148,10 +148,14 @@
return result
end
protected
+ def context
+ Schemacop.context
+ end
+
def item_matches?(item, data)
item_result = Result.new(self)
item._validate(data, result: item_result)
return item_result.errors.none?
end
@@ -168,10 +172,10 @@
json[attr.to_s.camelize(:lower).to_sym] = options[attr]
end
end
json[:title] = @title if @title
- json[Schemacop.context.examples_keyword] = @examples if @examples
+ json[context.swagger_json? ? :example : :examples] = @examples if @examples
json[:description] = @description if @description
json[:default] = @default if @default
json[:enum] = @enum.to_a if @enum
return json.as_json