lib/prmd/templates/schemata/helper.erb in prmd-0.11.3 vs lib/prmd/templates/schemata/helper.erb in prmd-0.11.4
- old
+ new
@@ -2,13 +2,13 @@
def extract_attributes(schema, properties)
attributes = []
_, properties = schema.dereference(properties)
- properties.keys.sort.each do |key|
+ properties.each do |key, value|
# found a reference to another element:
- _, value = schema.dereference(properties[key])
+ _, value = schema.dereference(value)
# include top level reference to nested things, when top level is nullable
if value.has_key?('type') && value['type'].include?('null') && (value.has_key?('items') || value.has_key?('properties'))
attributes << build_attribute(schema, key, value)
end
@@ -74,10 +74,10 @@
if example.nil? && Prmd::DefaultExamples.key?(type)
example = "`%s`" % Prmd::DefaultExamples[type].to_json
end
[key, type, description, example]
}
- return attributes
+ return attributes.sort
end
def extract_schemata_refs(schema, properties)
ret = []
properties.each do |_, value|