<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Documentation: UploadError marked as “open union”, is “datatype with subtype” in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467154#M1553</link>
    <description>&lt;P&gt;In /upload, the documentation gives UploadError as an open union, but is actually a datatype with subtype.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of what the server returns:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{
  "error_summary": "path/conflict/folder/...",                                                                                                                                      
  "error": {                                                                                                                                                                        
    ".tag": "path",                                                                                                                                                                 
    "reason": {                                                                                                                                                                     
      ".tag": "conflict",                                                                                                                                                           
      "conflict": {".tag": "folder"}                                                                                                                                                
    },                                                                                                                                                                              
    "upload_session_id": "AAAAAAAAVfvllHwbx7wZGA"                                                                                                                                   
  }                                                                                                                                                                                 
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Nov 2020 18:27:47 GMT</pubDate>
    <dc:creator>xguerin</dc:creator>
    <dc:date>2020-11-04T18:27:47Z</dc:date>
    <item>
      <title>Documentation: UploadError marked as “open union”, is “datatype with subtype”</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467154#M1553</link>
      <description>&lt;P&gt;In /upload, the documentation gives UploadError as an open union, but is actually a datatype with subtype.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example of what the server returns:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{
  "error_summary": "path/conflict/folder/...",                                                                                                                                      
  "error": {                                                                                                                                                                        
    ".tag": "path",                                                                                                                                                                 
    "reason": {                                                                                                                                                                     
      ".tag": "conflict",                                                                                                                                                           
      "conflict": {".tag": "folder"}                                                                                                                                                
    },                                                                                                                                                                              
    "upload_session_id": "AAAAAAAAVfvllHwbx7wZGA"                                                                                                                                   
  }                                                                                                                                                                                 
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 18:27:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467154#M1553</guid>
      <dc:creator>xguerin</dc:creator>
      <dc:date>2020-11-04T18:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Documentation: UploadError marked as “open union”, is “datatype with subtype”</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467172#M1554</link>
      <description>&lt;P&gt;Thanks for the note, and apologies for the confusion. You can find information on how errors are structured in &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#error-handling" target="_self"&gt;the documentation here&lt;/A&gt;. In this case, this part is relevant:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;H2&gt;Endpoint-specific errors (409)&lt;/H2&gt;
&lt;P&gt;&lt;SPAN&gt;The following table describes the top-level JSON object attributes present in the body of 409 responses.&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE class="api-param-values center-first-col"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH&gt;Key&lt;/TH&gt;
&lt;TH&gt;Description&lt;/TH&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;error&lt;/TD&gt;
&lt;TD&gt;A value that conforms to the error data type schema defined in the definition of each route.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So, for example, for&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload" target="_self"&gt;/2/files/upload&lt;/A&gt;, the&amp;nbsp;UploadError error type is referring to the value in the 'error' field, which can be either a 'path' or 'properties_error' (and is 'path' in your example here).&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 19:39:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467172#M1554</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-11-04T19:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Documentation: UploadError marked as “open union”, is “datatype with subtype”</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467179#M1555</link>
      <description>&lt;P&gt;Thank you Greg. I indeed agree with you about the content of the "error" field (being "path" in my example). However, IIRC, since the "UploadError" type is specified as an union, the ".tag" field is supposed to contain the name of the field in the union (as per the documentation). So I would have expected the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;{
  "error_summary": "path/conflict/folder/...",                                                                                                                                      
  "error": {                                                                                                                                                                        
    ".tag": "path",                                                                                                                                                                 
    “path”: {
      "reason": {                                                                                                                                                                     
        ".tag": "conflict",                                                                                                                                                           
        "conflict": {".tag": "folder"}                                                                                                                                                
      },                                                                                                                                                                              
      "upload_session_id": "AAAAAAAAVfvllHwbx7wZGA"
    }                                                                                                                                   
  }                                                                                                                                                                                 
}&lt;/PRE&gt;&lt;P&gt;The fact that the content of "UploadWriteFailed" are merged with the content of "UploadError" makes me think of a subtype, not union.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 20:02:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467179#M1555</guid>
      <dc:creator>xguerin</dc:creator>
      <dc:date>2020-11-04T20:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: Documentation: UploadError marked as “open union”, is “datatype with subtype”</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467202#M1556</link>
      <description>&lt;P&gt;I see, thanks for clarifying. I believe the combined serialization is expected in this case, per &lt;A href="https://github.com/dropbox/stone/blob/main/docs/json_serializer.rst#union" target="_self"&gt;the Stone documentation&lt;/A&gt;:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Union members that are ordinary structs (&lt;/SPAN&gt;&lt;CODE&gt;coord&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;in the example) serialize as the struct with the addition of a&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;.tag&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;key.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;In this case, the&amp;nbsp;UploadError union member&amp;nbsp;UploadWriteFailed is a struct.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2020 21:04:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/467202#M1556</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-11-04T21:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: Documentation: UploadError marked as “open union”, is “datatype with subtype”</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/536660#M2050</link>
      <description>&lt;P&gt;There are relatively few such cases in the API, and UploadWriteFailed (a struct inside an error union) is one of them; the others seem to be recent additions (e.g., LockConflictError inside LockFileError).&lt;/P&gt;&lt;P&gt;I also tripped over this error, because the author of the dropboxQt package that I use (&lt;A href="https://github.com/osoftteam/dropboxQt" target="_self"&gt;https://github.com/osoftteam/dropboxQt&lt;/A&gt;) made the same mistake in their translation from Stone to C++/Qt (expecting the struct to stand as a single object embedded in the union, not broken out as fields). &amp;nbsp;Sigh.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 01:53:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Documentation-UploadError-marked-as-open-union-is-datatype-with/m-p/536660#M2050</guid>
      <dc:creator>R Brown</dc:creator>
      <dc:date>2021-08-03T01:53:53Z</dc:date>
    </item>
  </channel>
</rss>

