-
Notifications
You must be signed in to change notification settings - Fork 79
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
Improve Javadocs for styx-api module #271
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have noticed a few mistakes, some are English language mistakes, some are violations of the Javadoc convention.
I have not added a comment to every single example of convention mistakes, so please apply the corrections to other Javadoc comments that contain the same mistakes.
components/api/src/main/java/com/hotels/styx/api/ContentOverflowException.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/ContentOverflowException.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/ContentOverflowException.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/FullHttpRequest.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/FullHttpRequest.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/HttpResponse.java
Outdated
Show resolved
Hide resolved
@Override | ||
public Optional<String> header(CharSequence name) { | ||
return headers.get(name); | ||
} | ||
|
||
/** | ||
* Returns all HTTP headers as {@link HttpHeaders} instance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be "Returns all HTTP headers as {@link HttpHeaders} instances".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? It returns just a single HttpHeaders
instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, then it needs an indefinite article instead: "Returns all HTTP headers as an {@link HttpHeaders} instance".
components/api/src/main/java/com/hotels/styx/api/package-info.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/package-info.java
Outdated
Show resolved
Hide resolved
Back off Javadoc plugin changes to the pom.xml.
* HTTP request with a fully aggregated/decoded body. | ||
* An immutable HTTP request object including full body content. | ||
* <p> | ||
* A {@link FullHttpRequest} is useful for request messages with a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to just say "requests" instead of "request messages", even though they both make sense. I think HTTP requests are typically just referred to that way.
Perhaps we could go with "A {@link FullHttpRequest} is useful for representing requests with ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd leave it like this:
* A {@link FullHttpRequest} is useful for requests with a
* finite body content, such as when PUT or POST are used to create or
* modify a RESTful object.
components/api/src/main/java/com/hotels/styx/api/FullHttpResponse.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/HttpRequest.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/HttpRequest.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/HttpRequest.java
Outdated
Show resolved
Hide resolved
components/api/src/main/java/com/hotels/styx/api/HttpResponse.java
Outdated
Show resolved
Hide resolved
components/api/src/test/java/com/hotels/styx/api/HttpResponseTest.java
Outdated
Show resolved
Hide resolved
@@ -106,7 +106,7 @@ | |||
* Creates a request with the GET method. | |||
* | |||
* @param uri URI | |||
* @return {@code this} | |||
* @return {@link FullHttpRequest.Builder} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous text was intended to show that it was the same builder being returned, so that chained calls can be used to set the values. The new text only tells us the type, which we already know.
Is there some builder convention we should be following?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The methods calls can still be chained even if the a new instance was returned.
Whether the builder class is mutable or immutable persistent data structure is an implementation aspect affecting all setter methods. I would describe this in the class level javadoc rather than separately in each method. Like I said it would make no difference to method chaining.
If you feel strongly about this then let's create another issue to specifically improve javadocs for the Builder classes. For now, the priority is to cover the most important gaps in the javadocs, namely 1) the HTTP message API, and (in subsequent PRs) 2) the interceptors API, and 3) application providers.
We haven't agreed on any conventions. Feel free to suggest one.
Is this the only remaining issue that is blocking this PR?
This PR also adds package level API docs for
com.hotels.styx.api
and improves existing Javadocs for HTTP message objects.BTW, the Javadocs can be generated locally with:
Or specifically for the styx-api module: