@@ -85,8 +85,10 @@ public void append(PythonWriter pythonWriter, OperationSection section) {
8585 fileWriter .write (".. autoclass:: " + inputSymbolName + "\n :members:\n " );
8686 fileWriter .write ("=================\n Output:\n =================\n \n " );
8787 if (section .isStream ()) {
88- String unionShapeName = outputSymbolName .replace ("OperationOutput" , "Output" );
89- fileWriter .write (".. autodata:: " + unionShapeName + " \n \n " );
88+ var streamShape =
89+ context .model ().expectShape (output .getAllMembers ().get ("stream" ).getId ());
90+ var streamName = context .symbolProvider ().toSymbol (streamShape ).toString ();
91+ fileWriter .write (".. autodata:: " + streamName + " \n \n " );
9092 } else {
9193 fileWriter .write (".. autoclass:: " + outputSymbolName + "\n " + ":members:\n \n " );
9294 }
@@ -114,11 +116,11 @@ public void append(PythonWriter pythonWriter, StructureSection section) {
114116 var symbol = context .symbolProvider ().toSymbol (shape );
115117 String docsFileName = String .format ("docs/models/%s.rst" ,
116118 symbol .getName ());
117- // Generally we want to skip input and output shapes because those will
118- // be generated on the operation's page; if it ends with
119- // "OperationOutput", that suggests it's a wrapper around the standard
120- // output shape. In this case we want to document it since the streaming
121- // class documents the wrapped class.
119+ // Input and output shapes are typically skipped since they are generated
120+ // on the operation's page. Shapes ending with "OperationOutput" are
121+ // wrappers around streaming output shapes. These should be documented
122+ // because the streaming class refers to and documents the wrapped class
123+ // and will link to the wrapper class.
122124 if (!shape .hasTrait (InputTrait .class ) && !shape .hasTrait (OutputTrait .class ) || symbol .getName ().endsWith ("OperationOutput" )) {
123125 context .writerDelegator ().useFileWriter (docsFileName , "" , writer -> {
124126 writer .write (generateHeader (symbol .getName ()));
0 commit comments