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

Improve Javadocs for styx-api module #271

Merged
merged 13 commits into from
Sep 10, 2018
Merged

Conversation

mikkokar
Copy link
Contributor

@mikkokar mikkokar commented Sep 6, 2018

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:

mvn javadoc:javadoc

Or specifically for the styx-api module:

mvn -f components/api/pom.xml javadoc:javadoc

Copy link
Contributor

@kvosper kvosper left a 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.

@Override
public Optional<String> header(CharSequence name) {
return headers.get(name);
}

/**
* Returns all HTTP headers as {@link HttpHeaders} instance.
Copy link
Contributor

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".

Copy link
Contributor Author

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.

Copy link
Contributor

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".

pom.xml 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
Copy link
Contributor

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 ..."

Copy link
Contributor Author

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.

@mikkokar mikkokar changed the title Add Javadoc maven plugin and improve docs for styx-api module Improve Javadocs for styx-api module Sep 7, 2018
@@ -106,7 +106,7 @@
* Creates a request with the GET method.
*
* @param uri URI
* @return {@code this}
* @return {@link FullHttpRequest.Builder}
Copy link
Contributor

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?

Copy link
Contributor Author

@mikkokar mikkokar Sep 10, 2018

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?

@mikkokar mikkokar merged commit 2c7625c into ExpediaGroup:master Sep 10, 2018
@mikkokar mikkokar deleted the api-docs branch September 10, 2018 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants