Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Response Data docs #75

Merged
merged 17 commits into from
Nov 23, 2022
Merged

Response Data docs #75

merged 17 commits into from
Nov 23, 2022

Conversation

nevans
Copy link
Collaborator

@nevans nevans commented Nov 21, 2022

I've converted the documentation for all of the response data structs' fields to meta-method rdoc. (I prefer the rdoc formatting for methods vs attr.) This allows us to link to the documentation for specific fields from elsewhere.

In several places, I did more than just copy the existing doecumentation to a new format. E.g:

  • Added relevant RFC links throughout.
  • Added information about many standard codes to ResponseCode
  • Added much more detail was to FetchData, Envelope, Address, and BodyType*
  • Added BodyStructure mixin module for the BodyType* structs (this should be the only code change).
  • Added deprecation warnings to BodyTypeExtension and BodyTypeAttachment.

This should be fairly complete, self-contained, and safe to merge as-is. One caveat: the MailboxList links (in bafc119) are broken. These point to the Mailbox attributes and special use attributes sections in Net::IMAP, and there's an rdoc bug that section links with spaces or special chars are intepreted as (broken) label links.

I have other changes in another branch (soon-to-be PR) that simplifies working with Response => ResponseText => ResponseCode, BodyStructure and the BodyType* classes, and makes the documented changes to ResponseParser so we can remove BodyTypeExtension and BodyTypeAttachment. Those PRs will update these docs again, but I think it's fine to merge this first rather than wait for those PRs to be complete.


FYI: cherry-picks 981ea30 (to avoid conflicts later)

@nevans nevans requested a review from shugo November 21, 2022 17:07
@nevans nevans added the documentation Improvements or additions to documentation label Nov 21, 2022
@nevans
Copy link
Collaborator Author

nevans commented Nov 22, 2022

@shugo: the reference to nevans/rdoc has been removed from this PR.

I updated every single struct in response_data.rb, but you can see the more interesting changes here:


Also, please let me know what you think about my bodystructure comments

Even with those changes, a lot of servers have had difficulty producing valid bodystructures, so I have some "foolproof" bodystructure code that I've been using for years. It was too big of a change to send along with the other parser PRs I pushed, but I think I can simplify it for a future PR. IIRC, any violation of the spec that didn't have an unambiguous or obvious alternative interpretation causes the parser to backtrack and parse the how bodystructure as a generic parenthesized list of astrings and nested lists of the same, and return that inside a BodystructUnparsable object.

Copy link
Member

@shugo shugo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks fine!

* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Document backwards-compatibility for unparsed response code data.
* Document Net::IMAP#responses behavior.
* Document RFC3501 codes.
* List RFC5530 codes.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.

Attempt to link to mailbox attr docs, but rdoc section links are broken.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.

Expand the attr hash documentation, to provide more examples.  Add more
data item details from the RFCs.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Link to the appropriate RFC(s).
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.
* Move struct field docs from the class to methods inside the class.
* Remove ABNF comments.
* Add type information to the call-seq or the method rdoc text.
* Link to the data type(s) that are returned, when possible.

Add warnings to BodyTypeAttachment and BodyTypeExtension.  BodyTypeText
and BodyTypeMessage link to BodyTypeBasic for documentation of common
fields.  Link to relevant RFCs where relevant.  Update formatting.
This can be used for documentation, `case` statements and pattern
matching, and functionality common to all `BodyType*` structs.
@nevans nevans merged commit 9c28428 into master Nov 23, 2022
@nevans nevans deleted the response-docs branch November 23, 2022 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Development

Successfully merging this pull request may close these issues.

2 participants