Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !13016

[kotlin-client] add ignoreUnknownKeys for kotlinx serialization

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/kassim/kotlinx_serialization_unknown_keys into master 3 years ago
  • Overview 2
  • Commits 1
  • Pipelines 0
  • Changes 3

Created by: kassim

fixes https://github.com/OpenAPITools/openapi-generator/issues/13013

initialises the Json instance for kotlinx serialization with ignoreUnknownKeys = true so that deserialisation doesn't fail when new keys are added to the API

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    Commit all changed files. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.1.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@jimschubert (2017/09) :heart:️, @dr4ke616 (2018/08) @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03)

Compare
  • master (base)

and
  • latest version
    06847773
    1 commit, 2 years ago

3 files
+ 3
- 3

    Preferences

    File browser
    Compare changes
docs/ge‎nerators‎
kotl‎in.md‎ +1 -1
modules/…/…/…/…/…‎/…/infrastructure‎
Serializer.‎kt.mustache‎ +1 -1
samples/…/…/…‎/…/…/…/…/…/…/…‎
Serial‎izer.kt‎ +1 -1
docs/generators/kotlin.md
+ 1
- 1
  • View file @ 06847773


@@ -36,7 +36,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|parcelizeModels|toggle "@Parcelize" for generated models| |null|
|requestDateConverter|JVM-Option. Defines in how to handle date-time objects that are used for a request (as query or parameter)|<dl><dt>**toJson**</dt><dd>[DEFAULT] Date formatter option using a json converter.</dd><dt>**toString**</dt><dd>Use the 'toString'-method of the date-time object to retrieve the related string representation.</dd></dl>|toJson|
|serializableModel|boolean - toggle &quot;implements Serializable&quot; for generated models| |null|
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson'| |moshi|
|serializationLibrary|What serialization library to use: 'moshi' (default), or 'gson' or 'jackson' or 'kotlinx_serialization'| |moshi|
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |null|
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |null|
|sourceFolder|source folder for generated code| |src/main/kotlin|
modules/openapi-generator/src/main/resources/kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache
+ 1
- 1
  • View file @ 06847773


@@ -115,6 +115,6 @@ import java.util.concurrent.atomic.AtomicLong
}
@JvmStatic
val jvmJson: Json by lazy { Json { serializersModule = kotlinSerializationAdapters } }
val jvmJson: Json by lazy { Json { serializersModule = kotlinSerializationAdapters; ignoreUnknownKeys = true } }
{{/kotlinx_serialization}}
}
samples/client/petstore/kotlin-retrofit2-kotlinx_serialization/src/main/kotlin/org/openapitools/client/infrastructure/Serializer.kt
+ 1
- 1
  • View file @ 06847773


@@ -32,5 +32,5 @@ object Serializer {
}
@JvmStatic
val jvmJson: Json by lazy { Json { serializersModule = kotlinSerializationAdapters } }
val jvmJson: Json by lazy { Json { serializersModule = kotlinSerializationAdapters; ignoreUnknownKeys = true } }
}
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
5.2.1
5.2.1 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!10146
Source branch: github/fork/kassim/kotlinx_serialization_unknown_keys

Menu

Explore Projects Groups Snippets