Module: Aws::Api::Docs::Utils Private
- Includes:
- Seahorse::Model, Seahorse::Model::Shapes
- Included in:
- ClientTypeDocumenter, OperationDocumenter, ParamFormatter, RequestSyntaxExample, ResponseStructureExample, SharedExample
- Defined in:
- lib/aws-sdk-core/api/docs/utils.rb
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.
Instance Method Summary collapse
-
#compute_recursive_shapes(ref, stack = [], recursive = Set.new) ⇒ Object
private
Given a shape reference, this function returns a Set of all of the recursive shapes found in tree.
-
#document_struct_member(yard_class, member_name, ref, read_write = true) ⇒ Object
private
Documents a structure member as a attribute method.
-
#input_type(ref, link = false) ⇒ Object
private
Given a shape ref, returns the type accepted when given as input.
- #operation_input_ref(operation, options = {}) ⇒ Object private
-
#output_type(ref, link = false) ⇒ Object
private
Given a shape ref, returns the type returned in output.
- #struct_member_docstring(docs, ref) ⇒ Object private
- #summary(string) ⇒ Object private
- #tag(string) ⇒ Object private
Instance Method Details
#compute_recursive_shapes(ref, stack = [], recursive = Set.new) ⇒ 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.
Given a shape reference, this function returns a Set of all of the recursive shapes found in tree.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/aws-sdk-core/api/docs/utils.rb', line 53 def compute_recursive_shapes(ref, stack = [], recursive = Set.new) if ref && !stack.include?(ref.shape) stack.push(ref.shape) case ref.shape when StructureShape ref.shape.members.each do |_, member_ref| compute_recursive_shapes(member_ref, stack, recursive) end when ListShape compute_recursive_shapes(ref.shape.member, stack, recursive) when MapShape compute_recursive_shapes(ref.shape.value, stack, recursive) end stack.pop elsif ref recursive << ref.shape end recursive end |
#document_struct_member(yard_class, member_name, ref, read_write = true) ⇒ 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.
Documents a structure member as a attribute method
104 105 106 107 108 109 110 111 112 113 |
# File 'lib/aws-sdk-core/api/docs/utils.rb', line 104 def document_struct_member(yard_class, member_name, ref, read_write = true) m = YARD::CodeObjects::MethodObject.new(yard_class, member_name) m.scope = :instance m.docstring = struct_member_docstring(ref.documentation, ref) returns = "@return [#{output_type(ref)}] #{summary(ref.documentation)}" m.add_tag(tag(returns)) yard_class.instance_attributes[member_name] = read_write ? { :read => m, :write => m } : { :read => m } end |
#input_type(ref, link = false) ⇒ 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.
Given a shape ref, returns the type accepted when given as input.
74 75 76 77 78 79 80 |
# File 'lib/aws-sdk-core/api/docs/utils.rb', line 74 def input_type(ref, link = false) if BlobShape === ref.shape 'IO,String' else output_type(ref, link) end end |
#operation_input_ref(operation, options = {}) ⇒ 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.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/aws-sdk-core/api/docs/utils.rb', line 23 def operation_input_ref(operation, = {}) struct = StructureShape.new # add the response target input member if the operation is streaming if operation.output && operation.output[:payload] && operation.output[:payload_member][:streaming] then target = ShapeRef.new(shape: BlobShape.new) target[:response_target] = true target.documentation = "Specifies where to stream response data. You can provide the path where a file will be created on disk, or you can provide an IO object. If omitted, the response data will be loaded into memory and written to a StringIO object." struct.add_member(:response_target, target) end # copy existing input members skip = [:without] || Set.new if operation.input operation.input.shape.members.each do |member_name, member_ref| unless skip.include?(member_name.to_s) struct.add_member(member_name, member_ref) end end end ShapeRef.new(shape: struct) end |
#output_type(ref, link = false) ⇒ 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.
Given a shape ref, returns the type returned in output.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/aws-sdk-core/api/docs/utils.rb', line 83 def output_type(ref, link = false) case ref.shape when StructureShape type = "Types::" + ref.shape.name link ? "{#{type}}" : type when ListShape "Array<#{output_type(ref.shape.member, link)}>" when MapShape "Hash<String,#{output_type(ref.shape.value, link)}>" when BlobShape ref[:streaming] ? 'IO' : 'String' when BooleanShape then 'Boolean' when FloatShape then 'Float' when IntegerShape then 'Integer' when StringShape then 'String' when TimestampShape then 'Time' else raise "unsupported shape #{ref.shape.class.name}" end end |
#struct_member_docstring(docs, ref) ⇒ 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.
115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/aws-sdk-core/api/docs/utils.rb', line 115 def struct_member_docstring(docs, ref) if Seahorse::Model::Shapes::StringShape === ref.shape && ref.shape.enum then docs = "#{docs}<p>Possible values:</p><ul>" docs += ref.shape.enum.map { |v| "<li><tt>#{v}</tt></li>" }.join docs += "</ul>" docs else docs end end |
#summary(string) ⇒ 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.
15 16 17 18 19 20 21 |
# File 'lib/aws-sdk-core/api/docs/utils.rb', line 15 def summary(string) if string YARD::DocstringParser.new.parse(string).to_docstring.summary else nil end end |
#tag(string) ⇒ 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.
11 12 13 |
# File 'lib/aws-sdk-core/api/docs/utils.rb', line 11 def tag(string) YARD::DocstringParser.new.parse(string).to_docstring..first end |