Repository navigation
[pull] master from OpenAPITools:master - #805
Merged
Merged
Conversation
… JSON (#24820) * fix(csharp): throw JsonException from generated converters on invalid JSON The post-loop validation in generated JsonConverter<T>.Read() threw ArgumentException and ArgumentNullException when a required property was missing or a non-nullable property was null. Both violate the System.Text.Json converter contract. Two consequences. System.Text.Json only enriches a JsonException with the JSON path of the failure, so the path was lost for these errors. And callers that wrap deserialization in catch (JsonException) did not catch them, which surfaces as an unhandled exception rather than a deserialization failure. Throw JsonException from both, naming the property in the message since JsonException carries no parameter name. Read() already documented JsonException as the exception it throws. The ArgumentNullException in WriteProperties is left alone: that one validates an object supplied by the caller during serialization, where an argument exception is the right choice. Fixes #24345 * Update CSharpClientCodegenTest for the new exception type The two assertions that pinned ArgumentException and ArgumentNullException in the generated Read() validation now expect JsonException. The same test already expected JsonException from the in-loop null checks.
* [BUG][JAVA] Add @nullable to resttemplate api method parameters Fixes #23656 by using nullableArgumentForApi in resttemplate api.mustache. This ensures optional and nullable operation parameters are annotated with @nullable when useJspecify is enabled, matching webclient and restclient. * Update resttemplate samples
… appears in config-help and the docs (#24977) * fix(kotlin): register enumUnknownDefaultCase as a CliOption enumUnknownDefaultCase has worked for the kotlin generator since it shipped in v5.3.1, but has never been advertised: it appears in neither `config-help -g kotlin` nor docs/generators/kotlin.md, so the only way to discover it is to read the generator source. Root cause: AbstractKotlinCodegen.java:308 calls cliOptions.clear() and re-adds only Kotlin-specific options, discarding the registration DefaultCodegen.java:2190 makes. DefaultCodegen.processOpts() still reads the key back from additionalProperties (DefaultCodegen.java:449), so the flag stayed functional while invisible. The clear() predates the flag by nearly four years (7cad47d, 2018-01-27 vs c305c71, 2021-12-21), so Kotlin was never deliberately excluded. Registered on KotlinClientCodegen rather than AbstractKotlinCodegen because kotlin is the only Kotlin generator whose templates implement the fallback; kotlin-spring, kotlin-server, kotlin-vertx, kotlin-misk and kotlin-wiremock have zero references to it. Mirrors GoClientCodegen, which re-registers this same option after AbstractGoCodegen's clear(). docs/generators/kotlin.md regenerated with bin/utils/export_docs_generators.sh. No sample changes: the default is unchanged at false. Refs #12970 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * test(kotlin): guard the enumUnknownDefaultCase registration Adds a regression test asserting the option is present in KotlinClientCodegen.cliOptions(). The defect being fixed is an option silently disappearing from cliOptions, so without a test the same thing can happen again on the next refactor. Verified it discriminates: with the registration reverted it fails with "enumUnknownDefaultCase is not registered". Also shortens the `true` value description to "Each enum gains an `unknown_default_open_api` case." The previous wording promised that unrecognized values decode to it, which contradicts the option description directly above it - gson and multiplatform emit the case without decoding to it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * refactor(kotlin): drop the redundant explicit default on the new option CliOption.newBoolean(opt, description) already delegates to the 3-arg overload with false, so .defaultValue(Boolean.FALSE.toString()) set what was already set. Matches this constructor's own convention: USE_JACKSON_3 and USE_NON_ASCII_HEADERS omit it, USE_RESPONSE_AS_RETURN_TYPE passes true explicitly because true is not the default. Docs output is unchanged. The regression test still asserts the default is false, so it now covers the implicit path too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * docs(kotlin): make the enumUnknownDefaultCase caveat accurate per library The first wording claimed jackson and kotlinx_serialization decode unknown values to the fallback, and that gson and multiplatform "fail". Reading the templates, all three claims are wrong: - enum_class.mustache gates the jackson `decode()` fallback on {{^isNullable}}, so a nullable enum returns null. `decode()` carries @jsoncreator, so Jackson routes through it and never reaches the @JsonEnumDefaultValue / READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE path Serializer.kt configures. - The kotlinx_serialization KSerializer falls back only under {{#isString}}; {{^isString}} throws IllegalArgumentException, so integer enums still throw. - gson registers no enum adapter, so Gson's built-in returns null rather than failing - quieter than "fail" implies, and worse, since null is indistinguishable from an absent field. Also annotates `multiplatform` as (library) rather than leaving it inside a (serializationLibrary) clause - it is a library value, and line 300 of this file sets the convention of tagging each name with its own option. Test javadoc said the guard stops the option disappearing "again"; it never disappeared, it was never registered. Reworded. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * test(kotlin): use Set.of in the cliOption guard Set.of is already used across the test tree, including the kotlin package, and the target is Java 11. Drops the Arrays and HashSet imports. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Fix UUID serialization in okhttp-gson inner enums * Add runtime regression coverage for okhttp-gson UUID inner enums
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )