Skip to content

feat(core): generate @Deprecated for deprecated operations and schemas#82

Open
halotukozak wants to merge 1 commit into
masterfrom
feat/39-deprecated
Open

feat(core): generate @Deprecated for deprecated operations and schemas#82
halotukozak wants to merge 1 commit into
masterfrom
feat/39-deprecated

Conversation

@halotukozak

@halotukozak halotukozak commented Jun 9, 2026

Copy link
Copy Markdown
Member

What

OpenAPI deprecated: true was ignored. Now it propagates to generated Kotlin.

  • Parser extracts deprecated from operations, schemas, and schema properties (Endpoint.deprecated, Parameter.deprecated, SchemaModel.deprecated, PropertyModel.deprecated).
  • ClientGenerator adds @Deprecated to suspend functions of deprecated operations.
  • ModelGenerator adds @Deprecated to deprecated data classes / sealed hierarchies / sealed interfaces / typealiases, and to deprecated data class properties.

Note on operation parameters

Kotlin's @Deprecated is applicable to data class properties (so deprecated schema fields are annotated), but not to plain function value parameters (compiler: "this annotation is not applicable to target 'value parameter'"). Deprecated operation parameters are therefore not annotated; the flag is still parsed (Parameter.deprecated) for potential future use.

Tests

  • Parser: deprecated operation, parameter, schema, and property flags.
  • ClientGenerator: @Deprecated present/absent on functions.
  • ModelGenerator: @Deprecated present/absent on data classes and on individual properties.

Closes #39

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Coverage Report

Overall Project 96.68% -0.12% 🍏
Files changed 90.74% 🍏

File Coverage
ApiSpec.kt 100% 🍏
ClientGenerator.kt 99.8% 🍏
SpecParser.kt 95.75% 🍏
ModelGenerator.kt 95.05% -0.69%
Utils.kt 86.5% 🍏

…properties

Parser extracts the deprecated flag from operations, schemas, and schema
properties. Generated suspend functions and model types (data classes,
sealed hierarchies, sealed interfaces, typealiases) carry @deprecated
when the source element is deprecated. Deprecated schema properties get
@deprecated on the generated data class property.

Kotlin's @deprecated is not applicable to plain function value
parameters, so deprecated operation parameters are not annotated; the
flag is still parsed (Parameter.deprecated) for future use.

Closes #39

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@halotukozak halotukozak force-pushed the feat/39-deprecated branch from 4d86a06 to fe9f23d Compare June 9, 2026 14:22
@halotukozak halotukozak added this to the 1.0.0 milestone Jun 9, 2026
@halotukozak halotukozak self-assigned this Jun 9, 2026
@halotukozak halotukozak added the enhancement New feature or request label Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate @Deprecated annotation for deprecated operations and schemas

1 participant