Skip to content

Commit ded2580

Browse files
release: 5.5.0 (#546)
* codegen metadata * codegen metadata * chore(ci): run on more branches and use depot runners * chore(ci): only use depot for staging repos * chore(internal): java 17 -> 21 on ci * feat(api): api update * release: 5.5.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 89a6e65 commit ded2580

File tree

9 files changed

+205
-30
lines changed

9 files changed

+205
-30
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
name: CI
22
on:
33
push:
4-
branches:
5-
- main
6-
pull_request:
7-
branches:
8-
- main
9-
- next
4+
branches-ignore:
5+
- 'generated'
6+
- 'codegen/**'
7+
- 'integrated/**'
8+
- 'stl-preview-head/**'
9+
- 'stl-preview-base/**'
1010

1111
jobs:
1212
lint:
1313
timeout-minutes: 10
1414
name: lint
15-
runs-on: ubuntu-latest
15+
runs-on: ${{ github.repository == 'stainless-sdks/finch-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
16+
1617
steps:
1718
- uses: actions/checkout@v4
1819

@@ -22,7 +23,7 @@ jobs:
2223
distribution: temurin
2324
java-version: |
2425
8
25-
17
26+
21
2627
cache: gradle
2728

2829
- name: Set up Gradle
@@ -33,7 +34,7 @@ jobs:
3334
test:
3435
timeout-minutes: 10
3536
name: test
36-
runs-on: ubuntu-latest
37+
runs-on: ${{ github.repository == 'stainless-sdks/finch-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
3738
steps:
3839
- uses: actions/checkout@v4
3940

@@ -43,7 +44,7 @@ jobs:
4344
distribution: temurin
4445
java-version: |
4546
8
46-
17
47+
21
4748
cache: gradle
4849

4950
- name: Set up Gradle

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "5.4.0"
2+
".": "5.5.0"
33
}

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 45
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-a9dc15ba77c4c6e40c8f2429b1d614e7fe6888910579b54002fb90d418682d09.yml
3-
openapi_spec_hash: be98b11d320aa0a1f3443650ce1b5b90
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-05a1c7485ea6dd75ad2fb1a0628570d88a3e7c4f1e1ecad433711c78deae50e6.yml
3+
openapi_spec_hash: 6d6014d50e18c98219b496bb2a5dab1d
44
config_hash: 53778a0b839c4f6ad34fbba051f5e8a6

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Changelog
22

3+
## 5.5.0 (2025-04-23)
4+
5+
Full Changelog: [v5.4.0...v5.5.0](https://github.com/Finch-API/finch-api-java/compare/v5.4.0...v5.5.0)
6+
7+
### Features
8+
9+
* **api:** api update ([8cdf256](https://github.com/Finch-API/finch-api-java/commit/8cdf256b5b9e96b4162b8baa3fc068cb510613e2))
10+
11+
12+
### Chores
13+
14+
* **ci:** only use depot for staging repos ([415d708](https://github.com/Finch-API/finch-api-java/commit/415d708c3acfe3ab0b718e89178632d5952e261a))
15+
* **ci:** run on more branches and use depot runners ([876a6f9](https://github.com/Finch-API/finch-api-java/commit/876a6f9fb669c659dda8a349ba676545c5b78568))
16+
* **internal:** java 17 -&gt; 21 on ci ([5982e36](https://github.com/Finch-API/finch-api-java/commit/5982e367891992a817ad418309b575ba207a04b5))
17+
318
## 5.4.0 (2025-04-22)
419

520
Full Changelog: [v5.3.0...v5.4.0](https://github.com/Finch-API/finch-api-java/compare/v5.3.0...v5.4.0)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

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

5-
[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/5.4.0)
6-
[![javadoc](https://javadoc.io/badge2/com.tryfinch.api/finch-java/5.4.0/javadoc.svg)](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.4.0)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.tryfinch.api/finch-java)](https://central.sonatype.com/artifact/com.tryfinch.api/finch-java/5.5.0)
6+
[![javadoc](https://javadoc.io/badge2/com.tryfinch.api/finch-java/5.5.0/javadoc.svg)](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.5.0)
77

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

@@ -15,7 +15,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1515

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

18-
The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.4.0).
18+
The REST API documentation can be found on [developer.tryfinch.com](https://developer.tryfinch.com/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.tryfinch.api/finch-java/5.5.0).
1919

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

@@ -26,7 +26,7 @@ The REST API documentation can be found on [developer.tryfinch.com](https://deve
2626
### Gradle
2727

2828
```kotlin
29-
implementation("com.tryfinch.api:finch-java:5.4.0")
29+
implementation("com.tryfinch.api:finch-java:5.5.0")
3030
```
3131

3232
### Maven
@@ -35,7 +35,7 @@ implementation("com.tryfinch.api:finch-java:5.4.0")
3535
<dependency>
3636
<groupId>com.tryfinch.api</groupId>
3737
<artifactId>finch-java</artifactId>
38-
<version>5.4.0</version>
38+
<version>5.5.0</version>
3939
</dependency>
4040
```
4141

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repositories {
88

99
allprojects {
1010
group = "com.tryfinch.api"
11-
version = "5.4.0" // x-release-please-version
11+
version = "5.5.0" // x-release-please-version
1212
}
1313

1414
subprojects {

finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatementItemListResponse.kt

Lines changed: 140 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import com.tryfinch.api.core.ExcludeMissing
1111
import com.tryfinch.api.core.JsonField
1212
import com.tryfinch.api.core.JsonMissing
1313
import com.tryfinch.api.core.JsonValue
14+
import com.tryfinch.api.core.toImmutable
1415
import com.tryfinch.api.errors.FinchInvalidDataException
1516
import java.util.Collections
1617
import java.util.Objects
@@ -221,7 +222,7 @@ private constructor(
221222
class Attributes
222223
private constructor(
223224
private val employer: JsonField<Boolean>,
224-
private val metadata: JsonValue,
225+
private val metadata: JsonField<Metadata>,
225226
private val preTax: JsonField<Boolean>,
226227
private val type: JsonField<String>,
227228
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -232,7 +233,9 @@ private constructor(
232233
@JsonProperty("employer")
233234
@ExcludeMissing
234235
employer: JsonField<Boolean> = JsonMissing.of(),
235-
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
236+
@JsonProperty("metadata")
237+
@ExcludeMissing
238+
metadata: JsonField<Metadata> = JsonMissing.of(),
236239
@JsonProperty("pre_tax") @ExcludeMissing preTax: JsonField<Boolean> = JsonMissing.of(),
237240
@JsonProperty("type") @ExcludeMissing type: JsonField<String> = JsonMissing.of(),
238241
) : this(employer, metadata, preTax, type, mutableMapOf())
@@ -248,8 +251,11 @@ private constructor(
248251
/**
249252
* The metadata of the pay statement item derived by the rules engine if available. Each
250253
* attribute will be a key-value pair defined by a rule.
254+
*
255+
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
256+
* server responded with an unexpected value).
251257
*/
252-
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
258+
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
253259

254260
/**
255261
* `true` if the pay statement item is pre-tax. This field is only available for employee
@@ -275,6 +281,13 @@ private constructor(
275281
*/
276282
@JsonProperty("employer") @ExcludeMissing fun _employer(): JsonField<Boolean> = employer
277283

284+
/**
285+
* Returns the raw JSON value of [metadata].
286+
*
287+
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
288+
*/
289+
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
290+
278291
/**
279292
* Returns the raw JSON value of [preTax].
280293
*
@@ -311,7 +324,7 @@ private constructor(
311324
class Builder internal constructor() {
312325

313326
private var employer: JsonField<Boolean> = JsonMissing.of()
314-
private var metadata: JsonValue = JsonMissing.of()
327+
private var metadata: JsonField<Metadata> = JsonMissing.of()
315328
private var preTax: JsonField<Boolean> = JsonMissing.of()
316329
private var type: JsonField<String> = JsonMissing.of()
317330
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -354,7 +367,19 @@ private constructor(
354367
* The metadata of the pay statement item derived by the rules engine if available. Each
355368
* attribute will be a key-value pair defined by a rule.
356369
*/
357-
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
370+
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
371+
372+
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
373+
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
374+
375+
/**
376+
* Sets [Builder.metadata] to an arbitrary JSON value.
377+
*
378+
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
379+
* instead. This method is primarily for setting the field to an undocumented or not yet
380+
* supported value.
381+
*/
382+
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
358383

359384
/**
360385
* `true` if the pay statement item is pre-tax. This field is only available for
@@ -432,6 +457,7 @@ private constructor(
432457
}
433458

434459
employer()
460+
metadata().ifPresent { it.validate() }
435461
preTax()
436462
type()
437463
validated = true
@@ -454,9 +480,118 @@ private constructor(
454480
@JvmSynthetic
455481
internal fun validity(): Int =
456482
(if (employer.asKnown().isPresent) 1 else 0) +
483+
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
457484
(if (preTax.asKnown().isPresent) 1 else 0) +
458485
(if (type.asKnown().isPresent) 1 else 0)
459486

487+
/**
488+
* The metadata of the pay statement item derived by the rules engine if available. Each
489+
* attribute will be a key-value pair defined by a rule.
490+
*/
491+
class Metadata
492+
@JsonCreator
493+
private constructor(
494+
@com.fasterxml.jackson.annotation.JsonValue
495+
private val additionalProperties: Map<String, JsonValue>
496+
) {
497+
498+
@JsonAnyGetter
499+
@ExcludeMissing
500+
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
501+
502+
fun toBuilder() = Builder().from(this)
503+
504+
companion object {
505+
506+
/** Returns a mutable builder for constructing an instance of [Metadata]. */
507+
@JvmStatic fun builder() = Builder()
508+
}
509+
510+
/** A builder for [Metadata]. */
511+
class Builder internal constructor() {
512+
513+
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
514+
515+
@JvmSynthetic
516+
internal fun from(metadata: Metadata) = apply {
517+
additionalProperties = metadata.additionalProperties.toMutableMap()
518+
}
519+
520+
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
521+
this.additionalProperties.clear()
522+
putAllAdditionalProperties(additionalProperties)
523+
}
524+
525+
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
526+
additionalProperties.put(key, value)
527+
}
528+
529+
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
530+
apply {
531+
this.additionalProperties.putAll(additionalProperties)
532+
}
533+
534+
fun removeAdditionalProperty(key: String) = apply {
535+
additionalProperties.remove(key)
536+
}
537+
538+
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
539+
keys.forEach(::removeAdditionalProperty)
540+
}
541+
542+
/**
543+
* Returns an immutable instance of [Metadata].
544+
*
545+
* Further updates to this [Builder] will not mutate the returned instance.
546+
*/
547+
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
548+
}
549+
550+
private var validated: Boolean = false
551+
552+
fun validate(): Metadata = apply {
553+
if (validated) {
554+
return@apply
555+
}
556+
557+
validated = true
558+
}
559+
560+
fun isValid(): Boolean =
561+
try {
562+
validate()
563+
true
564+
} catch (e: FinchInvalidDataException) {
565+
false
566+
}
567+
568+
/**
569+
* Returns a score indicating how many valid values are contained in this object
570+
* recursively.
571+
*
572+
* Used for best match union deserialization.
573+
*/
574+
@JvmSynthetic
575+
internal fun validity(): Int =
576+
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
577+
578+
override fun equals(other: Any?): Boolean {
579+
if (this === other) {
580+
return true
581+
}
582+
583+
return /* spotless:off */ other is Metadata && additionalProperties == other.additionalProperties /* spotless:on */
584+
}
585+
586+
/* spotless:off */
587+
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
588+
/* spotless:on */
589+
590+
override fun hashCode(): Int = hashCode
591+
592+
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
593+
}
594+
460595
override fun equals(other: Any?): Boolean {
461596
if (this === other) {
462597
return true

finch-java-core/src/test/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageResponseTest.kt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ internal class HrisCompanyPayStatementItemListPageResponseTest {
1919
.attributes(
2020
PayStatementItemListResponse.Attributes.builder()
2121
.employer(true)
22-
.metadata(JsonValue.from(mapOf<String, Any>()))
22+
.metadata(
23+
PayStatementItemListResponse.Attributes.Metadata.builder()
24+
.putAdditionalProperty("foo", JsonValue.from("bar"))
25+
.build()
26+
)
2327
.preTax(true)
2428
.type("type")
2529
.build()
@@ -36,7 +40,11 @@ internal class HrisCompanyPayStatementItemListPageResponseTest {
3640
.attributes(
3741
PayStatementItemListResponse.Attributes.builder()
3842
.employer(true)
39-
.metadata(JsonValue.from(mapOf<String, Any>()))
43+
.metadata(
44+
PayStatementItemListResponse.Attributes.Metadata.builder()
45+
.putAdditionalProperty("foo", JsonValue.from("bar"))
46+
.build()
47+
)
4048
.preTax(true)
4149
.type("type")
4250
.build()
@@ -57,7 +65,11 @@ internal class HrisCompanyPayStatementItemListPageResponseTest {
5765
.attributes(
5866
PayStatementItemListResponse.Attributes.builder()
5967
.employer(true)
60-
.metadata(JsonValue.from(mapOf<String, Any>()))
68+
.metadata(
69+
PayStatementItemListResponse.Attributes.Metadata.builder()
70+
.putAdditionalProperty("foo", JsonValue.from("bar"))
71+
.build()
72+
)
6173
.preTax(true)
6274
.type("type")
6375
.build()

0 commit comments

Comments
 (0)