Skip to content

docs: add comprehensive usage guide to README#33

Open
halotukozak wants to merge 2 commits intomasterfrom
docs/usage-guide
Open

docs: add comprehensive usage guide to README#33
halotukozak wants to merge 2 commits intomasterfrom
docs/usage-guide

Conversation

@halotukozak
Copy link
Member

Summary

  • Add Generated Client Usage section with dependencies, client creation, and auth examples
  • Document Bearer, API Key, Basic, and no-auth constructor patterns
  • Add HttpResult/Either error handling guide with HttpError subtype table
  • Add serialization setup with SerializersModule for polymorphic types
  • Add multi-spec configuration example

Test plan

  • Verify README renders correctly on GitHub
  • Verify code examples are accurate

🤖 Generated with Claude Code

- Add Generated Client Usage section with dependencies, client creation, auth examples
- Document Bearer, API Key, Basic, and no-auth constructor patterns
- Add HttpResult/Either error handling guide with HttpError subtype table
- Add serialization setup with SerializersModule for polymorphic types
- Add multi-spec configuration example

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 25, 2026 12:55
@github-actions
Copy link

Coverage Report

Overall Project 93.87% 🍏

There is no coverage information present for the Files changed

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “Generated Client Usage” section to the project README to document how consumers should add dependencies, instantiate generated clients, handle errors, and configure serialization when using the Gradle plugin’s generated Ktor clients.

Changes:

  • Document runtime dependencies and client instantiation patterns.
  • Add sections for authentication, request/response handling, error handling, and serialization setup.
  • Include an example for multi-spec Gradle configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Fix inaccuracies in generated client documentation to match actual
code: use tag-derived class names (PetsApi), Bearer-only auth,
Raise-based error handling, HttpErrorType enum, and correct JSON config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

implementation("io.ktor:ktor-client-content-negotiation:3.1.1")
implementation("io.ktor:ktor-serialization-kotlinx-json:3.1.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
implementation("io.arrow-kt:arrow-core:2.1.2")
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

The Arrow dependency version in this snippet (arrow-core:2.1.2) is inconsistent with the versions used in this repo’s own consumer examples/functional tests (arrow-core:2.2.1.1). To keep the README example buildable and aligned with what’s tested, update the version here (or omit explicit versions and recommend using the project’s version catalog/BOM).

Suggested change
implementation("io.arrow-kt:arrow-core:2.1.2")
implementation("io.arrow-kt:arrow-core:2.2.1.1")

Copilot uses AI. Check for mistakes.
Comment on lines +104 to +112
### Authentication

The generated constructor always takes a `baseUrl: String` and a `token: () -> String` parameter. The `token` lambda is called on each request and its value is sent as a `Bearer` token in the `Authorization` header:

```kotlin
val client = PetsApi(
baseUrl = "https://api.example.com",
token = { "your-bearer-token" },
)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

PR description says this adds constructor/auth patterns for Bearer, API Key, Basic, and no-auth, but the added README text documents only a single constructor shape (baseUrl + token) and only Bearer auth. Either expand this section to cover the additional auth patterns or adjust the PR description to match the actual documentation change.

Copilot uses AI. Check for mistakes.
Comment on lines +132 to +139
### Error Handling

Generated endpoints use [Arrow's Raise](https://arrow-kt.io/docs/typed-errors/) -- errors are raised, not returned as `Either`. Use Arrow's `either { ... }` block to obtain an `Either<HttpError, HttpSuccess<T>>`:

```kotlin
val result: Either<HttpError, HttpSuccess<Pet>> = either {
client.getPet(petId = 123)
}
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

PR description mentions an "HttpResult/Either error handling guide", but the README only documents obtaining an Either via either { ... } and doesn’t mention HttpResult anywhere. Please either add the missing HttpResult documentation or update the PR description to avoid implying it was added.

Copilot uses AI. Check for mistakes.
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.

2 participants