Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Management API Deprecations #22611

Open
StefanHufschmidt opened this issue Aug 8, 2024 · 2 comments
Open

Android Management API Deprecations #22611

StefanHufschmidt opened this issue Aug 8, 2024 · 2 comments
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@StefanHufschmidt
Copy link

While having a look at the Android Management API Client in comparison with the reference documentation, I noticed that there are some fields and methods marked as deprecated within the reference but not within the Java client library.
E.g.: "statusBarDisabled" of Policies.

As developer I'd love to notice deprecated API fields inside the related client code, so I can handle them directly when using them.

My suggestion would be to include a proper @Deprecated annotation in combination with a good JavaDoc which leads me to the correct place. This would increase the visibility of deprecation within the regular development process.
E.g:

/**
   * Password requirements. The field password_requirements.require_password_unlock must not be set.
   * 
   * @deprecated Use passwordPolicies instead.
   * 
   * Note: Complexity-based values of PasswordQuality, that is,
   * COMPLEXITY_LOW, COMPLEXITY_MEDIUM, and COMPLEXITY_HIGH, cannot be used here.
   * unified_lock_settings cannot be used here.
   * @param passwordRequirements passwordRequirements or {@code null} for none
   */
  @Deprecated
  public Policy setPasswordRequirements(PasswordRequirements passwordRequirements) {
    this.passwordRequirements = passwordRequirements;
    return this;
  }

I'm willing to contribute with a PR containing the annotations of deprecations of the Android Management API together with proper documentation about alternatives as described within the API reference documentation. Just add the "Accepting Contributions" label and I'll set up a PR for it.

@diegomarquezp diegomarquezp added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Aug 8, 2024
@burkedavison
Copy link
Member

The clients in this repository are generated from discovery docs. Resolving this feature request should be done by modifying the generator. We are not yet ready to accept contributions for this feature.

@StefanHufschmidt
Copy link
Author

StefanHufschmidt commented Aug 9, 2024

Sorry, my bad. I think we could use the deprecated attribute from inside the discovery docs to automatically add the @Deprecated annotation within the generated Java code. What do you think?

                "passwordRequirements": {
                    "description": "Password requirements. The field password_requirements.require_password_unlock must not be set. DEPRECATED - Use passwordPolicies.Note:Complexity-based values of PasswordQuality, that is, COMPLEXITY_LOW, COMPLEXITY_MEDIUM, and COMPLEXITY_HIGH, cannot be used here. unified_lock_settings cannot be used here.",
                    "deprecated": true,
                    "$ref": "PasswordRequirements"
                },

My suggestion would be to add it to the CodeObject class for the templates so that it can be used for classes, methods and variables. It would be added the same way as the description: https://github.com/googleapis/google-api-java-client-services/blob/main/generator/src/googleapis/codegen/template_objects.py#L126-L129
Afterwards it should be use-able within the specific templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants