Skip to content

[Dart] Generated methods aren't annotated with @deprecated #10323

@mway-dmueller

Description

@mway-dmueller
Description

For other languages, the generated method is annotated with @Deprecated to inform the developer that this method (or in this case: REST endpoint) is deprecated and will be removed soon.
For this purpose, Dart supports two annotations:

  1. @deprecated which is taking a mandatory parameter to describe since when this method is deprecated.
  2. @deprecated which doesn't require any parameters or imports.
    Because of the fact that the Swagger data model doesn't provide us any information since when a REST endpoint is marked as deprecated, we could at least choose the second option so the client developer can react on the deprecation.
Swagger-codegen version

2.4.14

Swagger declaration file content or url
Command line used for generation

Both executed in https://github.com/swagger-api/swagger-codegen/tree/master/modules/swagger-codegen:

  • mvn clean package
  • ./bin/dart-petstore.sh
Steps to reproduce
  1. Use the Dart Petstore sample.
  2. Check file https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml : it contains the deprecated REST endpoint GET /pet/findByTags.
  3. Execute ./bin/dart-petstore.sh to generate the Dart Swagger client.
  4. Check the locally generated file swagger-codegen/samples/client/petstore/dart/swagger/lib/api/pet_api.dart in which the method findPetsByTags(List<String> tags) isn't marked as deprecated.
Related issues/PRs

Pull Request: #10324

Suggest a fix/enhancement

I'll extend the api.mustache file for Dart in a separate Pull Request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions