Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.6.0"
".": "0.7.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 21
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-e5c0c65637cdf3a6c4360b8193973b73a3d35ad1056ef607c3319ef03e591a55.yml
openapi_spec_hash: 7515d1e5fe3130b9f5411f7aacbc8a64
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser/cas-parser-e572d88c2af6e4d7bc4f7e119357fd3f68b1e67d612fd1d3a657d916cde0087c.yml
openapi_spec_hash: a9fc7d947111bffa9184f8ca8be4a579
config_hash: 5509bb7a961ae2e79114b24c381606d4
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 0.7.0 (2026-05-05)

Full Changelog: [v0.6.0...v0.7.0](https://github.com/CASParser/cas-parser-java/compare/v0.6.0...v0.7.0)

### Features

* **api:** api update ([298bc41](https://github.com/CASParser/cas-parser-java/commit/298bc41836f9daa2d97dd46cb1cff7a2f8116117))
* **api:** api update ([2744bf4](https://github.com/CASParser/cas-parser-java/commit/2744bf455786d58b2ccb12e2a7e8f125586b71b1))
* **client:** more robust error parsing ([98e6ec7](https://github.com/CASParser/cas-parser-java/commit/98e6ec79767f1c16a0cfff5262ae29dad9600873))
* support setting headers via env ([ee0b90d](https://github.com/CASParser/cas-parser-java/commit/ee0b90db7cf144c61c23891ff8d026b0b6c358da))


### Performance Improvements

* **client:** create one json mapper ([720bb86](https://github.com/CASParser/cas-parser-java/commit/720bb86a8c014e99d8e3a3adbd14b5b9ee4d337a))


### Chores

* remove duplicated dokka setup ([2265192](https://github.com/CASParser/cas-parser-java/commit/226519252d2ec845c0ca05a13902c3574e0d33e2))


### Documentation

* clarify forwards compat behavior ([1181b47](https://github.com/CASParser/cas-parser-java/commit/1181b475ff522b2753786939e5b36e783ab78690))

## 0.6.0 (2026-04-19)

Full Changelog: [v0.5.4...v0.6.0](https://github.com/CASParser/cas-parser-java/compare/v0.5.4...v0.6.0)
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

<!-- x-release-please-start-version -->

[![Maven Central](https://img.shields.io/maven-central/v/com.cas_parser.api/cas-parser-java)](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.6.0)
[![javadoc](https://javadoc.io/badge2/com.cas_parser.api/cas-parser-java/0.6.0/javadoc.svg)](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.6.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.cas_parser.api/cas-parser-java)](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.7.0)
[![javadoc](https://javadoc.io/badge2/com.cas_parser.api/cas-parser-java/0.7.0/javadoc.svg)](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.7.0)

<!-- x-release-please-end -->

Expand All @@ -22,7 +22,7 @@ Use the Cas Parser MCP Server to enable AI assistants to interact with this API,

<!-- x-release-please-start-version -->

The REST API documentation can be found on [casparser.in](https://casparser.in/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.6.0).
The REST API documentation can be found on [casparser.in](https://casparser.in/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.7.0).

<!-- x-release-please-end -->

Expand All @@ -33,7 +33,7 @@ The REST API documentation can be found on [casparser.in](https://casparser.in/d
### Gradle

```kotlin
implementation("com.cas_parser.api:cas-parser-java:0.6.0")
implementation("com.cas_parser.api:cas-parser-java:0.7.0")
```

### Maven
Expand All @@ -42,7 +42,7 @@ implementation("com.cas_parser.api:cas-parser-java:0.6.0")
<dependency>
<groupId>com.cas_parser.api</groupId>
<artifactId>cas-parser-java</artifactId>
<version>0.6.0</version>
<version>0.7.0</version>
</dependency>
```

Expand Down Expand Up @@ -562,7 +562,9 @@ In rare cases, the API may return a response that doesn't match the expected typ

By default, the SDK will not throw an exception in this case. It will throw [`CasParserInvalidDataException`](cas-parser-java-core/src/main/kotlin/com/cas_parser/api/errors/CasParserInvalidDataException.kt) only if you directly access the property.

If you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:
Validating the response is _not_ forwards compatible with new types from the API for existing fields.

If you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`:

```java
import com.cas_parser.api.models.credits.CreditCheckResponse;
Expand Down
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {

allprojects {
group = "com.cas_parser.api"
version = "0.6.0" // x-release-please-version
version = "0.7.0" // x-release-please-version
}

subprojects {
Expand All @@ -22,7 +22,6 @@ subprojects {
group = "Verification"
description = "Verifies all source files are formatted."
}
apply(plugin = "org.jetbrains.dokka")
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ class CasParserOkHttpClient private constructor() {
/**
* Whether to call `validate` on every response before returning it.
*
* Setting this to `true` is _not_ forwards compatible with new types from the API for
* existing fields.
*
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ class CasParserOkHttpClientAsync private constructor() {
/**
* Whether to call `validate` on every response before returning it.
*
* Setting this to `true` is _not_ forwards compatible with new types from the API for
* existing fields.
*
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ private constructor(
/**
* Whether to call `validate` on every response before returning it.
*
* Setting this to `true` is _not_ forwards compatible with new types from the API for existing
* fields.
*
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
Expand Down Expand Up @@ -230,6 +233,9 @@ private constructor(
/**
* Whether to call `validate` on every response before returning it.
*
* Setting this to `true` is _not_ forwards compatible with new types from the API for
* existing fields.
*
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
Expand Down Expand Up @@ -375,6 +381,14 @@ private constructor(
(System.getProperty("casparser.apiKey") ?: System.getenv("CAS_PARSER_API_KEY"))?.let {
apiKey(it)
}
System.getenv("CAS_PARSER_CUSTOM_HEADERS")?.let { customHeadersEnv ->
for (line in customHeadersEnv.split("\n")) {
val colon = line.indexOf(':')
if (colon >= 0) {
putHeader(line.substring(0, colon).trim(), line.substring(colon + 1).trim())
}
}
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.time.temporal.ChronoField

fun jsonMapper(): JsonMapper =
fun jsonMapper(): JsonMapper = JSON_MAPPER

private val JSON_MAPPER: JsonMapper =
JsonMapper.builder()
.addModule(kotlinModule())
.addModule(Jdk8Module())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ class RequestOptions private constructor(val responseValidation: Boolean?, val t
private var responseValidation: Boolean? = null
private var timeout: Timeout? = null

/**
* Whether to call `validate` on the response before returning it.
*
* Setting this to `true` is _not_ forwards compatible with new types from the API for
* existing fields.
*
* Defaults to false, which means the shape of the response will not be validated upfront.
* Instead, validation will only occur for the parts of the response that are accessed.
*/
fun responseValidation(responseValidation: Boolean) = apply {
this.responseValidation = responseValidation
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ package com.cas_parser.api.errors
import com.cas_parser.api.core.JsonValue
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

class BadRequestException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
CasParserServiceException("400: $body", cause) {
CasParserServiceException(
"400: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
cause,
) {

override fun statusCode(): Int = 400

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package com.cas_parser.api.errors
import com.cas_parser.api.core.JsonValue
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

Expand All @@ -14,7 +15,11 @@ private constructor(
private val headers: Headers,
private val body: JsonValue,
cause: Throwable?,
) : CasParserServiceException("$statusCode: $body", cause) {
) :
CasParserServiceException(
"$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
cause,
) {

override fun statusCode(): Int = statusCode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ package com.cas_parser.api.errors
import com.cas_parser.api.core.JsonValue
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

class NotFoundException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
CasParserServiceException("404: $body", cause) {
CasParserServiceException(
"404: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
cause,
) {

override fun statusCode(): Int = 404

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ package com.cas_parser.api.errors
import com.cas_parser.api.core.JsonValue
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

class PermissionDeniedException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
CasParserServiceException("403: $body", cause) {
CasParserServiceException(
"403: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
cause,
) {

override fun statusCode(): Int = 403

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ package com.cas_parser.api.errors
import com.cas_parser.api.core.JsonValue
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

class RateLimitException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
CasParserServiceException("429: $body", cause) {
CasParserServiceException(
"429: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
cause,
) {

override fun statusCode(): Int = 429

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ package com.cas_parser.api.errors
import com.cas_parser.api.core.JsonValue
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

class UnauthorizedException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
CasParserServiceException("401: $body", cause) {
CasParserServiceException(
"401: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
cause,
) {

override fun statusCode(): Int = 401

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package com.cas_parser.api.errors
import com.cas_parser.api.core.JsonValue
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

Expand All @@ -14,7 +15,11 @@ private constructor(
private val headers: Headers,
private val body: JsonValue,
cause: Throwable?,
) : CasParserServiceException("$statusCode: $body", cause) {
) :
CasParserServiceException(
"$statusCode: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
cause,
) {

override fun statusCode(): Int = statusCode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ package com.cas_parser.api.errors
import com.cas_parser.api.core.JsonValue
import com.cas_parser.api.core.checkRequired
import com.cas_parser.api.core.http.Headers
import com.cas_parser.api.core.jsonMapper
import java.util.Optional
import kotlin.jvm.optionals.getOrNull

class UnprocessableEntityException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
CasParserServiceException("422: $body", cause) {
CasParserServiceException(
"422: ${if (body.isMissing()) "Unknown" else jsonMapper().writeValueAsString(body)}",
cause,
) {

override fun statusCode(): Int = 422

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,15 @@ private constructor(

private var validated: Boolean = false

/**
* Validates that the types of all values in this object match their expected types
* recursively.
*
* This method is _not_ forwards compatible with new types from the API for existing fields.
*
* @throws CasParserInvalidDataException if any value type in this object doesn't match its
* expected type.
*/
fun validate(): Body = apply {
if (validated) {
return@apply
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@ private constructor(

private var validated: Boolean = false

/**
* Validates that the types of all values in this object match their expected types recursively.
*
* This method is _not_ forwards compatible with new types from the API for existing fields.
*
* @throws CasParserInvalidDataException if any value type in this object doesn't match its
* expected type.
*/
fun validate(): AccessTokenCreateResponse = apply {
if (validated) {
return@apply
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,15 @@ private constructor(

private var validated: Boolean = false

/**
* Validates that the types of all values in this object match their expected types
* recursively.
*
* This method is _not_ forwards compatible with new types from the API for existing fields.
*
* @throws CasParserInvalidDataException if any value type in this object doesn't match its
* expected type.
*/
fun validate(): Body = apply {
if (validated) {
return@apply
Expand Down
Loading
Loading