lib//meta/json_schema/schemas/ref_schema.rb in meta-api-0.1.0 vs lib//meta/json_schema/schemas/ref_schema.rb in meta-api-0.1.1
- old
+ new
@@ -38,11 +38,14 @@
end
def defined_scopes(stage:, defined_scopes_mapping:)
defined_scopes_mapping ||= {}
- schema_name = object_schema.properties.schema_name(stage)
- return defined_scopes_mapping[schema_name] if defined_scopes_mapping.key?(schema_name)
+ if object_schema.properties.respond_to?(:schema_name)
+ # 只有命名实体才会被缓存
+ schema_name = object_schema.properties.schema_name(stage)
+ return defined_scopes_mapping[schema_name] if defined_scopes_mapping.key?(schema_name)
+ end
defined_scopes_mapping[schema_name] = []
defined_scopes = object_schema.properties.each.map do |name, property|
property.defined_scopes(stage: stage, defined_scopes_mapping: defined_scopes_mapping)
end.flatten.uniq.sort