Module: Aws::Api::Docstrings Private
- Defined in:
- lib/aws-sdk-core/api/docstrings.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This module loads the API documentation for the given API.
Class Method Summary collapse
Class Method Details
.apply(client_class, path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/aws-sdk-core/api/docstrings.rb', line 7 def self.apply(client_class, path) api = client_class.api.definition docs = File.open(path, 'r', encoding: 'UTF-8') { |f| f.read } docs = MultiJson.load(docs) api['documentation'] = docs['service'] docs['operations'].each do |operation, doc| api['operations'][operation]['documentation'] = doc end docs['shapes'].each do |shape_name, shape| api['shapes'][shape_name]['documentation'] = shape['base'] shape['refs'].each do |ref,doc| target_shape_name, member = ref.split('$') target_shape = api['shapes'][target_shape_name] case target_shape['type'] when 'structure' then target_shape['members'][member]['documentation'] = doc when 'list' then target_shape[member]['documentation'] = doc when 'map' then target_shape[member]['documentation'] = doc else raise 'not handled' end end end client_class.set_api(Seahorse::Model::Api.new(api)) end |